-
Notifications
You must be signed in to change notification settings - Fork 721
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
Add initial Sonoff smart water valve quirk #3346
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #3346 +/- ##
=======================================
Coverage 89.67% 89.67%
=======================================
Files 316 317 +1
Lines 10281 10298 +17
=======================================
+ Hits 9219 9235 +16
- Misses 1062 1063 +1 ☔ View full report in Codecov by Sentry. |
Normal = 0 | ||
Water_Shortage = 1 | ||
Water_Leakage = 2 | ||
Water_Shortage_And_Leakage = 3 |
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.
Would two separate binary sensors make more sense for this? (instead of an enum sensor)
We can't really parse it this via v2 quirks (yet), so just wondering.
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.
I would vote for 2 binary sensors. This would make it more convenient for triggers and alerts.
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.
zigpy/zha#305 and zigpy/zha#303 would be required for this.
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.
@TheJulianJES what about the approach in #3340 to have 2 binary sensors?
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.
It would work, but we're creating "fake" attributes there, which isn't optimal.
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.
@TheJulianJES While the work is being decided, can we get this without the enum so at least people can fiddle with the attributes directly using e.g. zha toolkit?
Or you reckon zigpy/zha#305 and zigpy/zha#303 would be handled relatively soon?
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.
Let's temporarily remove the quirks v2 enum sensor then. We should be able to get the quirk in the HA Core 2024.12 beta for tomorrow then.
Not sure on the timeline of the "attribute converters" yet. I hope we can get to it soon, but no promises.
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.
Awesome, thank you!
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.
Thanks for the PR!
I've removed the quirks v2 enum sensor for now. We should be able to get the quirk in the HA Core 2024.12 beta for tomorrow then.
Hopefully, we get to add the "attribute converters" for quirks v2 relatively soon, so we can also add the binary sensor entities for HA.
Proposed change
Add quirk for Sonoff SWV.
Additional information
This exposes the
water_valve_state
attribute in the custom cluster andadds a sensor to HA with the same information.EDIT: The enum sensor will not be added with this initial PR. We'd like two get two different binary sensors to parse the same attribute. Since quirks v2 can't do this yet, we'll need to do this work in a future PR.
This initial PR will just expose the attribute.
Checklist
pre-commit
checks pass / the code has been formatted using Black