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

Accept valid checksum or CRC for device responses #10

Merged
merged 9 commits into from
Jul 27, 2023

Conversation

mill1000
Copy link
Owner

@mill1000 mill1000 commented Jul 27, 2023

This PR allows a response through if either a CRC or checksum matches. Some devices appear to protect the response payload with a 2nd checksum instead of a CRC8. See issue #9 for related reports.

Additionally this PR

  • Add some unit tests for response parsing
  • Fixes an uncaught exception when trying to access the response ID field after failing to parse
  • Fixes some lint issues with the response classes
  • Restructures the response parsing.

Close #9 and close mill1000/midea-ac-py#11

mill1000 added 8 commits July 25, 2023 19:39
Return None when a payload fails to validate
…te errors when short packet arrives.

Add more units tests
… to ensure they don't overwrite the valus from unpack().

Feels like a hack to me!
- Eliminate the abstract unpack method and have the derived classes parse the data as part of their own __init__ methods
- Raise exceptions on bad CRCs and checksums and catch them at the appliance level
- Make the payload member of the base class a property
- Pass around a memoryview for efficient slicing
@mill1000 mill1000 self-assigned this Jul 27, 2023
@mill1000
Copy link
Owner Author

Waiting to confirm this PR functions on my own system.

@mill1000 mill1000 merged commit e5b44b1 into future Jul 27, 2023
@mill1000 mill1000 deleted the issue/checksum_as_crc branch July 27, 2023 23:38
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.

Certain devices are failing payload CRC checks Device became unavailable after last MSmartHome app upgrade
1 participant