From cc1b56870e4300abbaa17ea92c259c9f9cff25ac Mon Sep 17 00:00:00 2001 From: topsworld Date: Fri, 3 Jan 2025 21:37:43 +0800 Subject: [PATCH 1/3] feat: filter miwifi.* devices --- custom_components/xiaomi_home/miot/miot_cloud.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/custom_components/xiaomi_home/miot/miot_cloud.py b/custom_components/xiaomi_home/miot/miot_cloud.py index 0cfc272..a034738 100644 --- a/custom_components/xiaomi_home/miot/miot_cloud.py +++ b/custom_components/xiaomi_home/miot/miot_cloud.py @@ -535,6 +535,14 @@ class MIoTHttpClient: _LOGGER.error( 'get_device_list, cloud, invalid device, %s', device) continue + if did.startswith('miwifi.'): + # All devices with did starting with "miwifi." are routers + # that interface between the Xiaomi home cloud and the Xiaomi + # router cloud. These routers have all defined functions but + # have not been implemented, so they are all filtered out; some + # routers that are not "miwifi.*" also have this problem. + _LOGGER.info('ignore miwifi.* device, %s', did) + continue device_infos[did] = { 'did': did, 'uid': device.get('uid', None), From 4d8d5391a1af0c22abf1e9dfb018caf43844c892 Mon Sep 17 00:00:00 2001 From: sworld Date: Fri, 3 Jan 2025 22:44:44 +0800 Subject: [PATCH 2/3] feat: update log level --- .../xiaomi_home/miot/miot_cloud.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/custom_components/xiaomi_home/miot/miot_cloud.py b/custom_components/xiaomi_home/miot/miot_cloud.py index a034738..7ed3875 100644 --- a/custom_components/xiaomi_home/miot/miot_cloud.py +++ b/custom_components/xiaomi_home/miot/miot_cloud.py @@ -531,17 +531,18 @@ class MIoTHttpClient: name = device.get('name', None) urn = device.get('spec_type', None) model = device.get('model', None) - if did is None or name is None or urn is None or model is None: - _LOGGER.error( - 'get_device_list, cloud, invalid device, %s', device) + if did is None or name is None: + _LOGGER.info( + 'invalid device, cloud, %s', device) + continue + if urn is None or model is None: + _LOGGER.info( + 'missing the urn|model field, cloud, %s', device) continue if did.startswith('miwifi.'): - # All devices with did starting with "miwifi." are routers - # that interface between the Xiaomi home cloud and the Xiaomi - # router cloud. These routers have all defined functions but - # have not been implemented, so they are all filtered out; some - # routers that are not "miwifi.*" also have this problem. - _LOGGER.info('ignore miwifi.* device, %s', did) + # The miwifi.* routers defined SPEC functions, but none of them + # were implemented. + _LOGGER.info('ignore miwifi.* device, cloud, %s', did) continue device_infos[did] = { 'did': did, @@ -642,7 +643,7 @@ class MIoTHttpClient: for did in dids: if did not in results: devices.pop(did, None) - _LOGGER.error('get device info failed, %s', did) + _LOGGER.info('get device info failed, %s', did) continue devices[did].update(results[did]) # Whether sub devices From 47b63639ad468326fe4fcbcbb38254db10fd991b Mon Sep 17 00:00:00 2001 From: topsworld Date: Mon, 6 Jan 2025 14:40:56 +0800 Subject: [PATCH 3/3] feat: filter special xiaomi router model, xiaomi.router.rd03 --- custom_components/xiaomi_home/miot/specs/spec_filter.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/custom_components/xiaomi_home/miot/specs/spec_filter.json b/custom_components/xiaomi_home/miot/specs/spec_filter.json index 5cea69f..274fb34 100644 --- a/custom_components/xiaomi_home/miot/specs/spec_filter.json +++ b/custom_components/xiaomi_home/miot/specs/spec_filter.json @@ -59,5 +59,10 @@ "1", "5" ] + }, + "urn:miot-spec-v2:device:router:0000A036:xiaomi-rd03": { + "services": [ + "*" + ] } } \ No newline at end of file