Reduce lagging update

This commit is contained in:
Andre Basche 2023-06-08 20:01:55 +02:00
parent c433714a94
commit 80b3741f2f
10 changed files with 57 additions and 24 deletions

View file

@ -271,9 +271,10 @@ class HonBinarySensorEntity(HonEntity, BinarySensorEntity):
)
@callback
def _handle_coordinator_update(self):
def _handle_coordinator_update(self, update=True) -> None:
self._attr_native_value = (
self._device.get(self.entity_description.key, "")
== self.entity_description.on_value
)
self.async_write_ha_state()
if update:
self.async_write_ha_state()