mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2026-01-12 03:40:43 +08:00
Compare commits
5 Commits
5fd9a78344
...
59ac6268df
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59ac6268df | ||
|
|
8804a789c9 | ||
|
|
ae047758de | ||
|
|
b40d357230 | ||
|
|
f4d591b4d3 |
@ -1256,7 +1256,15 @@ class MIoTClient:
|
|||||||
) -> None:
|
) -> None:
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
'gateway devices list changed, %s, %s', mips.group_id, did_list)
|
'gateway devices list changed, %s, %s', mips.group_id, did_list)
|
||||||
payload: dict = {'filter': {'did': did_list}}
|
payload: dict = {
|
||||||
|
'filter': {
|
||||||
|
'did': did_list
|
||||||
|
},
|
||||||
|
'info': [
|
||||||
|
'name', 'model', 'urn',
|
||||||
|
'online', 'specV2Access', 'pushAvailable'
|
||||||
|
]
|
||||||
|
}
|
||||||
gw_list = await mips.get_dev_list_async(
|
gw_list = await mips.get_dev_list_async(
|
||||||
payload=json.dumps(payload))
|
payload=json.dumps(payload))
|
||||||
if gw_list is None:
|
if gw_list is None:
|
||||||
@ -1519,6 +1527,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:
|
||||||
@ -1532,7 +1542,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)
|
||||||
@ -1590,7 +1600,14 @@ class MIoTClient:
|
|||||||
if not mips.mips_state:
|
if not mips.mips_state:
|
||||||
_LOGGER.debug('local mips disconnect, skip refresh, %s', group_id)
|
_LOGGER.debug('local mips disconnect, skip refresh, %s', group_id)
|
||||||
return
|
return
|
||||||
gw_list: dict = await mips.get_dev_list_async()
|
payload: dict = {
|
||||||
|
'info': [
|
||||||
|
'name', 'model', 'urn',
|
||||||
|
'online', 'specV2Access', 'pushAvailable'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
gw_list: dict = await mips.get_dev_list_async(
|
||||||
|
payload=json.dumps(payload))
|
||||||
if gw_list is None:
|
if gw_list is None:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
'refresh gw devices with group_id failed, %s, %s',
|
'refresh gw devices with group_id failed, %s, %s',
|
||||||
|
|||||||
@ -601,15 +601,8 @@ class MIoTHttpClient:
|
|||||||
'bssid': device.get('bssid', None),
|
'bssid': device.get('bssid', None),
|
||||||
'order_time': device.get('orderTime', 0),
|
'order_time': device.get('orderTime', 0),
|
||||||
'fw_version': device.get('extra', {}).get(
|
'fw_version': device.get('extra', {}).get(
|
||||||
'fw_version', 'unknown'),
|
|
||||||
}
|
|
||||||
if isinstance(device.get('extra', None), dict) and device['extra']:
|
|
||||||
device_infos[did]['fw_version'] = device['extra'].get(
|
|
||||||
'fw_version', None)
|
'fw_version', None)
|
||||||
device_infos[did]['mcu_version'] = device['extra'].get(
|
}
|
||||||
'mcu_version', None)
|
|
||||||
device_infos[did]['platform'] = device['extra'].get(
|
|
||||||
'platform', None)
|
|
||||||
|
|
||||||
next_start_did = res_obj.get('next_start_did', None)
|
next_start_did = res_obj.get('next_start_did', None)
|
||||||
if res_obj.get('has_more', False) and next_start_did:
|
if res_obj.get('has_more', False) and next_start_did:
|
||||||
|
|||||||
@ -1394,19 +1394,9 @@ class MipsLocalClient(_MipsClient):
|
|||||||
continue
|
continue
|
||||||
device_list[did] = {
|
device_list[did] = {
|
||||||
'did': did,
|
'did': did,
|
||||||
'name': name,
|
|
||||||
'urn': urn,
|
|
||||||
'model': model,
|
|
||||||
'online': info.get('online', False),
|
'online': info.get('online', False),
|
||||||
'icon': info.get('icon', None),
|
|
||||||
'fw_version': None,
|
|
||||||
'home_id': '',
|
|
||||||
'home_name': '',
|
|
||||||
'room_id': info.get('roomId', ''),
|
|
||||||
'room_name': info.get('roomName', ''),
|
|
||||||
'specv2_access': info.get('specV2Access', False),
|
'specv2_access': info.get('specV2Access', False),
|
||||||
'push_available': info.get('pushAvailable', False),
|
'push_available': info.get('pushAvailable', False)
|
||||||
'manufacturer': model.split('.')[0],
|
|
||||||
}
|
}
|
||||||
return device_list
|
return device_list
|
||||||
|
|
||||||
|
|||||||
@ -502,6 +502,11 @@ urn:miot-spec-v2:device:safe-box:0000A042:loock-v1:1:
|
|||||||
prop.5.1:
|
prop.5.1:
|
||||||
name: contact-state
|
name: contact-state
|
||||||
expr: (src_value!=1)
|
expr: (src_value!=1)
|
||||||
|
urn:miot-spec-v2:device:speaker:0000A015:xiaomi-l04m:2:
|
||||||
|
prop.3.1:
|
||||||
|
access:
|
||||||
|
- read
|
||||||
|
- notify
|
||||||
urn:miot-spec-v2:device:speaker:0000A015:xiaomi-lx04:2:
|
urn:miot-spec-v2:device:speaker:0000A015:xiaomi-lx04:2:
|
||||||
prop.3.1:
|
prop.3.1:
|
||||||
access:
|
access:
|
||||||
@ -577,6 +582,9 @@ urn:miot-spec-v2:device:thermostat:0000A031:suittc-wk168:1:
|
|||||||
description: '15'
|
description: '15'
|
||||||
- value: 16
|
- value: 16
|
||||||
description: '16'
|
description: '16'
|
||||||
|
urn:miot-spec-v2:device:toothbrush:0000A07E:xiaomi-p001:1:
|
||||||
|
prop.4.1041:
|
||||||
|
unit: days
|
||||||
urn:miot-spec-v2:device:water-purifier:0000A013:roswan-lte01:1:0000D05A:
|
urn:miot-spec-v2:device:water-purifier:0000A013:roswan-lte01:1:0000D05A:
|
||||||
prop.4.1:
|
prop.4.1:
|
||||||
unit: ppm
|
unit: ppm
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user