-
Notifications
You must be signed in to change notification settings - Fork 31
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 IASZone binary sensors for extra bits #246
base: dev
Are you sure you want to change the base?
Conversation
This PR adds new entities to existing devices so CI is expected to fail. |
I want to discuss how the extra bits on the IASZone should be made available in HA. Having those bits are specially important for things like smoke or gas sensors, for users to know when battery gets low, for example. Some of those sensors beep when battery get critically low, which gets annoying when it happens at 4am. This in turn makes some people start looking at the code and opening RFC PRs 👀 Since IASZone devices usually do not implement all bits, but there is unfortunately no way to identify which ones are implemented, having them available by default would be wrong and lead users to complain that the values never change. An alternative would be to have a flag on the quirk, specifying which entities to expose. The downside is that it makes it hard to actually identify bits supported by a device, since users would really have no practical way to track that proactively for new devices. A mixed approach would be to create the entities disabled by default, and have a quirk flag that would make some of them enabled by default for specific devices. This would make the entities show up for devices that are already known to support them, while still allowing the users to manually enable them for newer devices with no quirk. The downside is that some users may still enabled them for devices that do not support them, and complain. I was planing to implement the later. |
Sorry, I was still writing the comment. |
I think entities disabled by default is a good approach, with v2 quirks providing extra metadata to enable them for known-supported devices. We could also possibly explore auto-enabling entities if we ever find that the state ever changes. |
Quick backgroundWe also have the ability to assign one It's not used too often, but it is very useful in those cases. It also makes sure the quirk is applied before trying to create the entities. Other configuration entities in ZHA just check the model for example. Sometimes, the quirk doesn't even, so they'll error out because the custom cluster they're expecting isn't there. (*The Tuya plug quirks cannot be converted to v2 quirks due to ignoring manufacturer (so the model in Tuya's case), as the quirks only match per their endpoint/cluster signature.) Important part (why it's relevant for this)We should probably allow a quirk to have multiple quirk IDs and we could rename it to something like But for this, we could have exposed features called something along the lines of "IAS tamper" and "IAS trouble". We could also easily make IMO, this might be worth exploring, especially for this use-case. |
I like the Could it also be used in negative? For example, for devices that are known to not support something (such as aqara motion sensors not supporting Tamper), could we have a "No IAS Tamper", to prevent the entity from getting created (instead of having it disabled)? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #246 +/- ##
==========================================
+ Coverage 96.33% 96.35% +0.01%
==========================================
Files 61 61
Lines 9388 9429 +41
==========================================
+ Hits 9044 9085 +41
Misses 344 344 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
I discussed with the other ZHA maintainers and I think adding the disabled-by-default entities for every IASZone device is going to be too drastic of a change. We're instead going to add a way to expose this feature via quirks per-device. There are so few devices with this feature (I think I have only a single sensor by Bosch that has a microswitch for the battery cover) that it's going to cause more confusion than benefit. |
Thanks for the feedback @puddly ! |
The new entities are disabled by default since devices do not support all bits and there is no way to automatically find if a device supports each bit.
Requires: home-assistant/core#129706