zigpy / bellows

A Python 3 project to implement EZSP for EmberZNet devices
GNU General Public License v3.0
177 stars 86 forks source link

Fix command deserialization for `getTokenData` #619

Closed puddly closed 2 months ago

puddly commented 2 months ago

This is likely not the only place this error will be present (see #618). It looks like we were hiding a lot of deserialization errors in places where an unsuccessful command response will omit future fields.

[bellows.ezsp.protocol] Send command getTokenData: (<NV3KeyId.CREATOR_STACK_RESTORED_EUI64: 57642>, 0)
[bellows.ezsp.protocol] Failed to parse frame getTokenData: b'b5'

To fix this, I've temporarily set up command deserialization to work with Struct objects. We should migrate bellows to use Structs for all commands in the future, as it makes the interface much more ergonomic (see https://github.com/lhespress/zigpy-espzb/blob/b6e9dd5057015cdc4659a82b5a7174699c191041/zigpy_espzb/commands.py)

Related: https://github.com/home-assistant/core/issues/116320 and https://github.com/home-assistant/core/issues/116301.

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 94.44444% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 99.65%. Comparing base (7833647) to head (e38b6d2).

:exclamation: Current head e38b6d2 differs from pull request most recent head 4337a78. Consider uploading reports for the commit 4337a78 to get more accurate results

Files Patch % Lines
bellows/ezsp/protocol.py 85.71% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #619 +/- ## ========================================== - Coverage 99.67% 99.65% -0.03% ========================================== Files 74 74 Lines 4874 4881 +7 ========================================== + Hits 4858 4864 +6 - Misses 16 17 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.