From 70c87184e57a110acaab15178a1b5bf343805e75 Mon Sep 17 00:00:00 2001 From: LiShuzhen Date: Tue, 24 Jun 2025 14:03:28 +0800 Subject: [PATCH] feat: subscribe the BLE device up messages even though the device is offline (#1170) --- custom_components/xiaomi_home/miot/miot_client.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/custom_components/xiaomi_home/miot/miot_client.py b/custom_components/xiaomi_home/miot/miot_client.py index cdfe110..927f639 100644 --- a/custom_components/xiaomi_home/miot/miot_client.py +++ b/custom_components/xiaomi_home/miot/miot_client.py @@ -983,13 +983,17 @@ class MIoTClient: and self._device_list_lan[did].get('push_available', False) ): from_new = 'lan' - if ( from_new is None and did in self._device_list_cloud - and self._device_list_cloud[did].get('online', False) ): - from_new = 'cloud' + # MIoT cloud service may not publish the online state updating + # message for the BLE device. + if did.startswith('blt.'): + from_new = 'cloud' + elif self._device_list_cloud[did].get('online', False): + from_new = 'cloud' + if from_new == from_old: # No need to update return