Simplify signalling for updating available property of deCONZ entities (#58078)

This commit is contained in:
Robert Svensson 2021-10-20 14:59:36 +02:00 committed by GitHub
parent 2bd64cec11
commit 3ad3f4e2ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 27 deletions

View file

@ -129,11 +129,11 @@ class DeconzBinarySensor(DeconzDevice, BinarySensorEntity):
self.entity_description = entity_description
@callback
def async_update_callback(self, force_update=False):
def async_update_callback(self):
"""Update the sensor's state."""
keys = {"on", "reachable", "state"}
if force_update or self._device.changed_keys.intersection(keys):
super().async_update_callback(force_update=force_update)
if self._device.changed_keys.intersection(keys):
super().async_update_callback()
@property
def is_on(self):
@ -183,11 +183,11 @@ class DeconzTampering(DeconzDevice, BinarySensorEntity):
return f"{self.serial}-tampered"
@callback
def async_update_callback(self, force_update: bool = False) -> None:
def async_update_callback(self) -> None:
"""Update the sensor's state."""
keys = {"tampered", "reachable"}
if force_update or self._device.changed_keys.intersection(keys):
super().async_update_callback(force_update=force_update)
if self._device.changed_keys.intersection(keys):
super().async_update_callback()
@property
def is_on(self) -> bool: