Skip to content

Implement quirks v2 attribute_converter #360

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

Merged
merged 13 commits into from
Jan 28, 2025

Conversation

TheJulianJES
Copy link
Contributor

@TheJulianJES TheJulianJES commented Jan 26, 2025

Proposed change

This adds an attribute_converter to the following quirk v2 platforms:

  • binary sensor
  • sensor

This will allow us to parse a ZCL attribute value in quirks, before passing it to the HA state.
This is mostly needed for binary sensors.

Additional information

Corresponding zigpy PR:

Closes:

@TheJulianJES TheJulianJES force-pushed the tjj/quirks_v2_attribute_converter branch from 0b93b23 to 8434f19 Compare January 28, 2025 20:26
@TheJulianJES TheJulianJES marked this pull request as ready for review January 28, 2025 20:28
Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.58%. Comparing base (f6f4b6c) to head (efef2cf).
Report is 2 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #360   +/-   ##
=======================================
  Coverage   96.58%   96.58%           
=======================================
  Files          61       61           
  Lines        9514     9526   +12     
=======================================
+ Hits         9189     9201   +12     
  Misses        325      325           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TheJulianJES
Copy link
Contributor Author

TheJulianJES commented Jan 28, 2025

This should be ready to review too now. No official quirks will use it with HA 2025.2.0 yet, but it'll allow development for new ones to be easier.

There are some changes in test_switch that I can move to another PR if wanted. To follow patterns in other tests, it's changed to use a test-specific DeviceRegistry instead of the global one.
EDIT: Removed them from this PR now. They're not related anymore, since the attriubte_converter for switches was removed. We should still make the changes in another PR though (and likely also to some other tests).

@TheJulianJES TheJulianJES merged commit 8fd7bc5 into zigpy:dev Jan 28, 2025
9 checks passed
jeverley added a commit to jeverley/zha-device-handlers that referenced this pull request Feb 5, 2025
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.

1 participant