[WIP] Add support for other APCI services #253
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for additional APCI services. APCI services are the actual payloads to communicate with actors. These payloads can be used for broadcast messages such as GroupValueWrite, but also for unicast messages such as MemoryRead. I need this to perform low(er)-level operations on my custom actors.
The main focus of this library was GroupValue payloads, so I had to refactor several parts of this library to make it more extensible. Fortunately, most of the higher-level API is still the same. In short:
Telegram.group_address
got replaced byTelegram.address
(APCI supports both types)Telegram.payload
should be a class that extendsknx.telegram.apci.APCI
. For instance, to write a DPT to a group address, you now useTelegram(.., payload=GroupValueWrite(DPTArray(..)))
.Telegram.telegramtype
is now encoded inknx.telegram.apci.APCI.code
.I've added two examples (example_info.py and example_restart.py) to demonstate the new features.
Current limitation is that payloads can only be used in connectionless mode. This is not different from before, but several unicast messages are typically used with an active connection (that also supports sequencing and ACK/NACK on transport level). This would require more changes.
Current state is WIP and should not yet be merged. It's here to show and share my interest in this feature, and collect preliminary feedback. I'll continue on this one, but it needs a bit more time to fix the last part.