Skip to content

Commit ec833b6

Browse files
authored
feat: subscribe the proxy gateway child device up messages even though the device is offline (#1393)
* feat: subscribe the proxy gateway child device up messages even though the device is offline (#1313) * feat: do not subscribe proxy gateway child device online/offline state message
1 parent f2200ba commit ec833b6

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

custom_components/xiaomi_home/miot/miot_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,10 +1374,13 @@ async def __update_devices_from_cloud_async(
13741374
"""Update cloud devices.
13751375
NOTICE: This function will operate the cloud_list
13761376
"""
1377-
# MIoT cloud service may not publish the online state updating message
1377+
# MIoT cloud may not publish the online state updating message
13781378
# for the BLE device. Assume that all BLE devices are online.
1379+
# MIoT cloud does not publish the online state updating message for the
1380+
# child device under the proxy gateway (eg, VRF air conditioner
1381+
# controller). Assume that all proxy gateway child devices are online.
13791382
for did, info in cloud_list.items():
1380-
if did.startswith('blt.'):
1383+
if did.startswith('blt.') or did.startswith('proxy.'):
13811384
info['online'] = True
13821385
for did, info in self._device_list_cache.items():
13831386
if filter_dids and did not in filter_dids:

custom_components/xiaomi_home/miot/miot_mips.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -998,9 +998,11 @@ def on_state_msg(topic: str, payload: str, ctx: Any) -> None:
998998
did, MIoTDeviceState.ONLINE if msg['event'] == 'online'
999999
else MIoTDeviceState.OFFLINE, ctx)
10001000

1001-
if did.startswith('blt.'):
1002-
# MIoT cloud may not publish BLE device online/offline state message.
1003-
# Do not subscribe BLE device online/offline state.
1001+
if did.startswith('blt.') or did.startswith('proxy.'):
1002+
# MIoT cloud may not publish BLE device or proxy gateway child device
1003+
# online/offline state message.
1004+
# Do not subscribe BLE device or proxy gateway child device
1005+
# online/offline state.
10041006
return True
10051007
return self.__reg_broadcast_external(
10061008
topic=topic, handler=on_state_msg, handler_ctx=handler_ctx)

0 commit comments

Comments
 (0)