Support APS_Encryption transmit option - #277
Merged
Merged
Conversation
zigpy sets `TransmitOptions.APS_Encryption` for unicasts that require APS layer encryption (currently the Zigbee Direct Configuration cluster, which rejects unencrypted frames with `NOT_AUTHORIZED`). Map it onto deCONZ's `SECURITY_ENABLED` TX option. APS security uses the (trust center) link key, so `USE_NWK_KEY_SECURITY` must not be set at the same time.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #277 +/- ##
=======================================
Coverage 99.14% 99.14%
=======================================
Files 7 7
Lines 931 933 +2
=======================================
+ Hits 923 925 +2
Misses 8 8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds support for zigpy’s TransmitOptions.APS_Encryption by mapping it to deCONZ’s SECURITY_ENABLED transmit option when sending packets that require APS-layer encryption, while ensuring the network-key security option is not set at the same time (since APS security uses the link key).
Changes:
- Update
send_packet()to selectSECURITY_ENABLEDwhenAPS_Encryptionis requested, otherwise default toUSE_NWK_KEY_SECURITY. - Add a unit test validating the
tx_optionsmapping for APS encryption.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
zigpy_deconz/zigbee/application.py |
Conditionally maps zigpy’s APS encryption transmit option to the correct deCONZ TX flags. |
tests/test_send_receive.py |
Adds coverage to ensure APS encryption results in SECURITY_ENABLED (and not USE_NWK_KEY_SECURITY) while preserving APS ACK behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
zigpy sets
TransmitOptions.APS_Encryptionfor unicasts that require APS layer encryption (currently the Zigbee Direct Configuration cluster, which rejects unencrypted frames withNOT_AUTHORIZED). Map it onto deCONZ'sSECURITY_ENABLEDTX option.APS security uses the (trust center) link key, so
USE_NWK_KEY_SECURITYmust not be set at the same time.Related zigpy PR that requires this (but zigpy-deconz doesn't require a new zigpy version):