-
Notifications
You must be signed in to change notification settings - Fork 908
Add Sonoff SNZB-01M Smart Scene remote #4447
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
base: dev
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #4447 +/- ##
==========================================
+ Coverage 92.24% 92.26% +0.02%
==========================================
Files 369 370 +1
Lines 12088 12120 +32
==========================================
+ Hits 11150 11182 +32
Misses 938 938 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
TheJulianJES
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds a v1 quirk that doesn't use any constants in the quirk signature and replacement. This is something that all other v1 quirks do. Like, you'd wanna do OnOff.cluster_id instead of 0x0006.
Some parts of the tests are also a bit unnecessary as well.
In general, we shouldn't add new v1 quirks anymore if v2 quirks also work.
I'll get back to you with more details soon, but for now, please take a look at some v2 quirks adding device automation triggers:
- https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/sonoff/button.py
This one doesn't use a custom cluster though, but it's a nice simple example. - https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/smarthjemmet/quadzigsw.py
This one is a bit special, but does use a custom cluster, and works around a firmware issue with all the extra endpoints/clusters. - Maybe also see: https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/candeo/rotary_dimmer_switches.py
You'll wanna use the QuirkBuilder, .replaces(SonoffButtonCluster, endpoint_id=x) for the custom cluster, and .device_automation_triggers(...).
For the test, something like https://github.com/zigpy/zha-device-handlers/blob/dev/tests/test_smarthjemmet.py would be enough. We don't need to test that the quirk definition and so on works properly, just added logic, like in the new custom cluster.
…ocus tests on cluster behavior
…ocus tests on cluster behavior
|
Thanks for the review and the example links — that helped a lot.
Files changed
@TheJulianJES When you have a moment,could you please review the latest changes in this PR? Thanks |
Proposed change
Additional information
Device diagnostics
Checklist
pre-commitchecks pass / the code has been formatted using Black