-
Couldn't load subscription status.
- Fork 53
Fix IasZone binary sensor not implementing recompute_capabilities
#545
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
Fix IasZone binary sensor not implementing recompute_capabilities
#545
Conversation
|
The test failure is "expected" for now, but reveals a (bigger) underlying issue: The linked Frient quirks prevent entity creation by directly accessing For real world devices, this likely didn't cause any issues, as no known Now, when |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #545 +/- ##
=======================================
Coverage 96.94% 96.94%
=======================================
Files 63 63
Lines 10518 10518
=======================================
Hits 10197 10197
Misses 321 321 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| self._cluster_handler = cluster_handlers[0] | ||
| super().__init__(cluster_handlers, endpoint, device, **kwargs) | ||
| self._state: bool = self.is_on | ||
| self.recompute_capabilities() |
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 method call is a bit weird in ZHA in general. self.recompute_capabilities() should be called as part of creating the instance but we don't have a way to do that in the base class.
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.
Yeah, I noticed 😄
|
I think we can merge it as is for now to already get the actual bugfix in the beta. For the TODOs:
|
Proposed change
This PR fixes an issue where the
IasZonebinary sensor did not get its device class and translation key assigned.This is done by correctly implementing
recompute_capabilitiesfor theIASZoneclass. Before, it tried to directly access attribute cache during initialization, at which point it would not have been read for real devices.Additional information
IasZonebinary sensor created before attributes read backlog#50TODO:
prevent_default_entity_creationfor these devices, relying on directly accessingentity.translation_key:-> see comment for TODOs: #545 (comment)