Knxdclient

Latest version: v1.1.0

Safety actively analyzes 623827 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.1.0

New features and improvements

- New constructor parameter `timeout` for `KNXDConnection`: Allows to specify a timeout for receiving new packets from KNXd. If no packet is received for at least `timeout` seconds, the `run()` coroutine raises a Timeout exception. (Note, that sufficient KNX bus activity is required to avoid timeouts under normal conditions) (thanks to NanoSpicer)
- Raise `ConnectionAbortedError` exception from `open_group_socket()` and `iterate_group_telegrams()` when `run()` loop exits (for any reason (thanks to NanoSpicer for the discussion and implementation)

Development improvements

- Update used external GitHub Actions and add testing on Python 3.12 to GitHub Actions CI

1.0.0

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)

0.4.1

This is a small maintenance release with backported critical encoding/decoding fixes from the upcoming 1.0.0 release:

- 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)

0.4.0

- New method `set_group_apdu_handler()` for setting a non-asynchronous callback function for handling incoming group telegrams
- New method `iterate_group_telegrams()` for asynchronously iterating incoming group telegrams as they arrive
- **DEPRECATING** `register_telegram_handler()` in favor of the two new methods

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.