Skip to content

Commit

Permalink
update state only on changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vmartinv committed Aug 31, 2021
1 parent d59ee11 commit 54c840a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/localtuya/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,15 @@ async def async_added_to_hass(self):

def _update_handler(status):
"""Update entity state when status was updated."""
status_changed = self._status != status
if status is not None:
self._status = status
self.status_updated()
else:
self._status = {}

self.schedule_update_ha_state()
if status_changed:
self.schedule_update_ha_state()

signal = f"localtuya_{self._config_entry.data[CONF_DEVICE_ID]}"
self.async_on_remove(
Expand Down

0 comments on commit 54c840a

Please sign in to comment.