An Asynchronous Library for the KNX protocol. Documentation: https://xknx.io/
Project description
XKNX - An asynchronous KNX library written in Python
Documentation
See documentation at: https://xknx.io/
Help
We need your help for testing and improving XKNX. For questions, feature requests, bug reports either open an issue, join the XKNX chat on Discord or write an email.
Development
You will need at least Python 3.10 in order to use XKNX.
Setting up your local environment:
- Install requirements:
pip install -r requirements/testing.txt
- Install pre-commit hook:
pre-commit install
Testing
To run all tests, linters, formatters and type checker call tox
Running only unit tests is possible with pytest
Running specific unit tests can be invoked by: pytest -vv test/management_tests/procedures_test.py -k test_nm_individual_address_serial_number_write_fail
Home-Assistant
XKNX is the underlying library for the KNX integration in Home Assistant.
Example
"""Example for switching a light on and off."""
import asyncio
from xknx import XKNX
from xknx.devices import Light
async def main():
"""Connect to KNX/IP bus, switch on light, wait 2 seconds and switch it off again."""
async with XKNX() as xknx:
light = Light(
xknx,
name='TestLight',
group_address_switch='1/0/9',
)
xknx.devices.async_add(light)
await light.set_on()
await asyncio.sleep(2)
await light.set_off()
asyncio.run(main())
Attributions
Many thanks to Weinzierl Engineering GmbH and MDT technologies GmbH for providing us each an IP Secure Router to support testing and development of xknx.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file xknx-3.3.0.tar.gz
.
File metadata
- Download URL: xknx-3.3.0.tar.gz
- Upload date:
- Size: 154.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfdfbb2871ad405aac64817b4b558cd920b22d2e251baaad5190d9ee8e3999b9 |
|
MD5 | 1342a874d0dfabd57dcef9995a85831a |
|
BLAKE2b-256 | c17fc04fd83c8b3a42a26378976d194a605e63020392ce1f81393d56e8d26ef5 |
File details
Details for the file xknx-3.3.0-py3-none-any.whl
.
File metadata
- Download URL: xknx-3.3.0-py3-none-any.whl
- Upload date:
- Size: 230.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d18ad7f2962c5bf3e9249eab11197898c1d050b07256f70f0ec4a8eaac812b0a |
|
MD5 | a199108de55f259167316440151533c4 |
|
BLAKE2b-256 | 4d1fbe5606f4d5e8cf1fd1eabfc38988640469fd4652d97a2185fd0852f092e9 |