Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion homeassistant/components/zha/core/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import itertools
import logging
import os
import time
import traceback
from typing import List, Optional

Expand Down Expand Up @@ -478,7 +479,9 @@ async def async_update_device_storage(self):
async def async_device_initialized(self, device: zha_typing.ZigpyDeviceType):
"""Handle device joined and basic information discovered (async)."""
zha_device = self._async_get_or_create_device(device)

# This is an active device so set a last seen if it is none
if zha_device.last_seen is None:
zha_device.async_update_last_seen(time.time())
_LOGGER.debug(
"device - %s:%s entering async_device_initialized - is_new_join: %s",
device.nwk,
Expand Down
4 changes: 2 additions & 2 deletions homeassistant/components/zha/core/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def async_create_device(self, device: ZhaDeviceType) -> ZhaDeviceEntry:
name=device.name, ieee=str(device.ieee), last_seen=device.last_seen
)
self.devices[device_entry.ieee] = device_entry

return self.async_update_device(device)
self.async_schedule_save()
return device_entry

@callback
def async_get_or_create_device(self, device: ZhaDeviceType) -> ZhaDeviceEntry:
Expand Down