This releases includes the following changes in comparison to version 0.4.0:
Breaking changes
- Deprecated method `KNXDConnection.register_telegram_handler()` finally removed. Use the `set_group_apdu_handler()` method, introduced in version 0.4.0, instead.
This method takes a single callback function that is called synchronously for each incoming KNX group telegram, instead of multiple coroutines that are each run in an asyncio Task for each incoming telegram. If you still need to run an asynchronous coroutine for each incoming telegram or even multiple coroutines in separate tasks, you can do this in your custom group APDU handler function:
python
def group_apdu_handler(apdu: knxdclient.ReceivedGroupAPDU) -> None:
for coro in my_async_group_handlers:
asyncio.create_task(coro(apdu))
knxd_connection.set_group_apdu_handler(group_apdu_handler)
You can also stick with [release 0.4.1](https://github.com/mhthies/knxdclient/releases/tag/v0.4.1), which includes the critical fixes from this release, but still supports the `register_telegram_handler()`. However, the 0.4.x branch does not receive the code quality fixes and testing (see below) and will probably be no longer maintained.
Fixes
- Fixed encoding and decoding of year in date and datetime telegrams (KNX DPT 11.xxx and 19.xxx)
- Fixed encoding of weekday in datetime telegrams (KNX DPT 19.xxx)
- Fixed decoding of single character telegrams (KNX DPT 4.xxx)
Code Quality Improvements
- Added comprehensive unittests, including communication testing against actual KNXD daemon. Currently around 90% code coverage and full coverage of all major features.
- Fixed codestyle according to PEP8
- Added Continuous Integration with [GitHub Actions](https://github.com/mhthies/knxdclient/actions/workflows/build.yml) for unit tests, type checking (MyPy) and code style checking
- Split up library into multiple Python modules
- Changed packaging metadata to declarative `setup.cfg` and included `pyproject.toml` for direct installing with pip and packaging with `python -m build`
- Improved examples to use `asyncio.run()` instead of deprecated functions (thanks to simongregorebner)