Fix ZHA state restore by always restoring last seen on devices (#26271)

* fix state restore by always restoring last seen

* cleanup
This commit is contained in:
David F. Mulcahey 2019-08-29 15:44:53 -04:00 committed by Paulus Schoutsen
parent 069e762da0
commit bb52e17364

View File

@ -304,6 +304,8 @@ class ZHAGateway:
manufacturer=zha_device.manufacturer,
model=zha_device.model,
)
entry = self.zha_storage.async_get_or_create(zha_device)
zha_device.async_update_last_seen(entry.last_seen)
return zha_device
@callback
@ -356,10 +358,6 @@ class ZHAGateway:
)
await self._async_device_joined(device, zha_device)
# This is real traffic from a device so lets update last seen on the entry
entry = self.zha_storage.async_get_or_create(zha_device)
zha_device.async_update_last_seen(entry.last_seen)
device_info = async_get_device_info(
self._hass, zha_device, self.ha_device_registry
)