zha: Clean up binary_sensor listener registration/state updates (#14197)
- Instead of registering listeners in the entity __init__, do it in async_added_to_hass to avoid errors updating an entity which isn't fully set up yet - Change from schedule_update_ha_state to async_schedule_update_ha_state
This commit is contained in:
1 parent
a4e0c9c251
commit
9d4d1c8233
3 files changed
+21
-16
No files matched your search
@@ -71,7 +71,7 @@ class Sensor(zha.Entity):
|
||||
_LOGGER.debug("Attribute updated: %s %s %s", self, attribute, value)
|
||||
if attribute == self.value_attribute:
|
||||
self._state = value
|
||||
self.schedule_update_ha_state()
|
||||
self.async_schedule_update_ha_state()
|
||||
|
||||
|
||||
class TemperatureSensor(Sensor):
|
||||
|
||||
Reference in new issue
Block a user