From bccc9644e5003aabd58b69bd471f550a7e8c6c96 Mon Sep 17 00:00:00 2001 From: LiShuzhen Date: Thu, 31 Jul 2025 09:20:35 +0800 Subject: [PATCH] fix: update mesh offline state --- custom_components/xiaomi_home/miot/miot_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/custom_components/xiaomi_home/miot/miot_client.py b/custom_components/xiaomi_home/miot/miot_client.py index c48d058..3965edb 100644 --- a/custom_components/xiaomi_home/miot/miot_client.py +++ b/custom_components/xiaomi_home/miot/miot_client.py @@ -1495,6 +1495,8 @@ class MIoTClient: if did not in filter_dids: continue 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 device_new = gw_list.pop(did, None) if device_new: @@ -1508,7 +1510,7 @@ class MIoTClient: device_old['online'] = False # Update cache 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 self.__update_device_msg_sub(did=did) state_old: Optional[bool] = info.get('online', None)