Add cleanup to SimpliSafe (#32889)

This commit is contained in:
Aaron Bach
2020-03-17 05:02:30 -06:00
committed by GitHub
parent d98432c328
commit a3e2504470

View File

@@ -642,13 +642,17 @@ class SimpliSafeEntity(Entity):
@callback
def update():
"""Update the state."""
self.async_schedule_update_ha_state(True)
self.update_from_latest_data()
self.async_write_ha_state()
self._async_unsub_dispatcher_connect = async_dispatcher_connect(
self.hass, TOPIC_UPDATE.format(self._system.system_id), update
)
async def async_update(self):
self.update_from_latest_data()
@callback
def update_from_latest_data(self):
"""Update the entity."""
self.async_update_from_rest_api()