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.9 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')
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-2.12.2.tar.gz
.
File metadata
- Download URL: xknx-2.12.2.tar.gz
- Upload date:
- Size: 147.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b881928f57e3725c821fe663bc8a33177f27bf89c4014ef10724757ae310316 |
|
MD5 | 27a2adc898c7060e644139ac1502eae7 |
|
BLAKE2b-256 | 3f6ab0de2fb7cebd1ac2c0fc9e966e25a3d4a054892f7ac1a7cdacebc332e486 |
File details
Details for the file xknx-2.12.2-py3-none-any.whl
.
File metadata
- Download URL: xknx-2.12.2-py3-none-any.whl
- Upload date:
- Size: 223.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fccbba0664a0b5c4f1ce3a70f314b05d63b3766f6e7c7b9524e38a0902c15391 |
|
MD5 | 9d00993512fd163691ed0b58a3612c2b |
|
BLAKE2b-256 | 334f3db700834752b61c0a7ae8773e53a6448c9afa2559f80cacc981bff7e992 |