Compare commits

...

2 Commits

Author SHA1 Message Date
Gavin
8325be9dbf
Merge f5bc880c62 into b40d357230 2026-01-03 02:09:14 +08:00
Li Shuzhen
b40d357230
fix: update mesh offline state (#1579)
Some checks failed
Tests / check-rule-format (push) Has been cancelled
Validate / validate-hassfest (push) Has been cancelled
Validate / validate-hacs (push) Has been cancelled
Validate / validate-lint (push) Has been cancelled
Validate / validate-setup (push) Has been cancelled
2025-12-31 09:58:29 +08:00

View File

@ -1605,6 +1605,8 @@ class MIoTClient:
if did not in filter_dids: if did not in filter_dids:
continue continue
device_old = self._device_list_gateway.get(did, None) device_old = self._device_list_gateway.get(did, None)
gw_state_old = device_old.get(
'online', False) if device_old else False
gw_state_new: bool = False gw_state_new: bool = False
device_new = gw_list.pop(did, None) device_new = gw_list.pop(did, None)
if device_new: if device_new:
@ -1618,7 +1620,7 @@ class MIoTClient:
device_old['online'] = False device_old['online'] = False
# Update cache group_id # Update cache group_id
info['group_id'] = group_id info['group_id'] = group_id
if not gw_state_new: if (gw_state_old == gw_state_new) and (not gw_state_new):
continue continue
self.__update_device_msg_sub(did=did) self.__update_device_msg_sub(did=did)
state_old: Optional[bool] = info.get('online', None) state_old: Optional[bool] = info.get('online', None)