update state only on changes
This commit is contained in:
@@ -234,13 +234,13 @@ class LocalTuyaEntity(RestoreEntity, pytuya.ContextualLogger):
|
|||||||
|
|
||||||
def _update_handler(status):
|
def _update_handler(status):
|
||||||
"""Update entity state when status was updated."""
|
"""Update entity state when status was updated."""
|
||||||
if status is not None:
|
if status is None:
|
||||||
self._status = status
|
status = {}
|
||||||
self.status_updated()
|
if self._status != status:
|
||||||
else:
|
self._status = status.copy()
|
||||||
self._status = {}
|
if status:
|
||||||
|
self.status_updated()
|
||||||
self.schedule_update_ha_state()
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
signal = f"localtuya_{self._config_entry.data[CONF_DEVICE_ID]}"
|
signal = f"localtuya_{self._config_entry.data[CONF_DEVICE_ID]}"
|
||||||
self.async_on_remove(
|
self.async_on_remove(
|
||||||
|
Reference in New Issue
Block a user