Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ignore): encrypted GP frame should not parse commandFrame until decrypted #1363

Merged
merged 2 commits into from
Mar 23, 2025

Conversation

Nerivec
Copy link
Collaborator

@Nerivec Nerivec commented Mar 23, 2025

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 the commandFrame 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 the commandFrame 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 when commandID 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...

} else if (this.isMore()) {
return {raw: this.buffer.subarray(this.position)};

Note: I tested the changes on the PTM216Z that uses commandFrame raw payload in converter to determine key presses. All good on that front 👍

@Nerivec Nerivec changed the title fix(ignore): GP encrypted cant parse commandFrame until decrypted fix(ignore): encrypted GP frame should not parse commandFrame until decrypted Mar 23, 2025
@Koenkk Koenkk merged commit e47367c into Koenkk:master Mar 23, 2025
1 check passed
@Nerivec Nerivec deleted the gp-encrypted-fix branch March 23, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[New device support]: ZT-LP-ZEU2S-WH-MS MOES
2 participants