fix(ignore): encrypted GP frame should not parse commandFrame
until decrypted
#1363
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.
Another one... This is fun without a device to test/experiment with!
Should fix Koenkk/zigbee2mqtt#19405 (comment)
Since the
commandID
is encrypted, we can't parse thecommandFrame
here, as it may match a command ID with further processing (commissioning, channel request, etc) and would potentially fail based on the remaining bytes in the payload (would be garbage data anyway). So, if FULLENCR, skip thecommandFrame
until re-parsed decrypted in GreenPower class (GPP data & mic might still get parsed at wrong offset, but that shouldn't matter since they will be discarded/replaced after GP decryption and we know we have enough bytes to read them since they are bitmask-dependent).Also, removed the GPP data & mic from the
raw
payload that gets parsed whencommandID
is not specifically parsed (so it's the actual payload). It's a bit more important now that GP has generated definition support (avoids trying to figure out what the bytes mean for new devices... when they are just duplicated metadata). With some extra tests to try to cover everything as much as possible...zigbee-herdsman/src/zspec/zcl/buffaloZcl.ts
Lines 526 to 527 in 5bba7d6
Note: I tested the changes on the PTM216Z that uses
commandFrame
raw
payload in converter to determine key presses. All good on that front 👍