mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2026-01-16 06:30:44 +08:00
Merge remote-tracking branch 'upstream/main' into add-command-sending-mode-for-lights
This commit is contained in:
commit
e5a5bb5777
@ -1281,9 +1281,17 @@ class MIoTClient:
|
|||||||
@final
|
@final
|
||||||
async def __on_gw_device_list_changed(self, mips: MipsLocalClient,
|
async def __on_gw_device_list_changed(self, mips: MipsLocalClient,
|
||||||
did_list: list[str]) -> None:
|
did_list: list[str]) -> None:
|
||||||
_LOGGER.info("gateway devices list changed, %s, %s", mips.group_id,
|
_LOGGER.info('gateway devices list changed, %s, %s', mips.group_id,
|
||||||
did_list)
|
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(payload=json.dumps(payload))
|
gw_list = await mips.get_dev_list_async(payload=json.dumps(payload))
|
||||||
if gw_list is None:
|
if gw_list is None:
|
||||||
_LOGGER.error("local mips get_dev_list_async failed, %s", did_list)
|
_LOGGER.error("local mips get_dev_list_async failed, %s", did_list)
|
||||||
@ -1631,7 +1639,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("refresh gw devices with group_id failed, %s, %s",
|
_LOGGER.error("refresh gw devices with group_id failed, %s, %s",
|
||||||
self._uid, group_id)
|
self._uid, group_id)
|
||||||
|
|||||||
@ -578,55 +578,28 @@ class MIoTHttpClient:
|
|||||||
did)
|
did)
|
||||||
continue
|
continue
|
||||||
device_infos[did] = {
|
device_infos[did] = {
|
||||||
"did":
|
"did": did,
|
||||||
did,
|
"uid": device.get("uid", None),
|
||||||
"uid":
|
"name": name,
|
||||||
device.get("uid", None),
|
"urn": urn,
|
||||||
"name":
|
"model": model,
|
||||||
name,
|
"connect_type": device.get("pid", -1),
|
||||||
"urn":
|
"token": device.get("token", None),
|
||||||
urn,
|
"online": device.get("isOnline", False),
|
||||||
"model":
|
"icon": device.get("icon", None),
|
||||||
model,
|
"parent_id": device.get("parent_id", None),
|
||||||
"connect_type":
|
"manufacturer": model.split(".")[0],
|
||||||
device.get("pid", -1),
|
|
||||||
"token":
|
|
||||||
device.get("token", None),
|
|
||||||
"online":
|
|
||||||
device.get("isOnline", False),
|
|
||||||
"icon":
|
|
||||||
device.get("icon", None),
|
|
||||||
"parent_id":
|
|
||||||
device.get("parent_id", None),
|
|
||||||
"manufacturer":
|
|
||||||
model.split(".")[0],
|
|
||||||
# 2: xiao-ai, 1: general speaker
|
# 2: xiao-ai, 1: general speaker
|
||||||
"voice_ctrl":
|
'voice_ctrl': device.get('voice_ctrl', 0),
|
||||||
device.get("voice_ctrl", 0),
|
'rssi': device.get('rssi', None),
|
||||||
"rssi":
|
'owner': device.get('owner', None),
|
||||||
device.get("rssi", None),
|
'pid': device.get('pid', None),
|
||||||
"owner":
|
'local_ip': device.get('local_ip', None),
|
||||||
device.get("owner", None),
|
'ssid': device.get('ssid', None),
|
||||||
"pid":
|
'bssid': device.get('bssid', None),
|
||||||
device.get("pid", None),
|
'order_time': device.get('orderTime', 0),
|
||||||
"local_ip":
|
'fw_version': device.get('extra', {}).get('fw_version', None)
|
||||||
device.get("local_ip", None),
|
|
||||||
"ssid":
|
|
||||||
device.get("ssid", None),
|
|
||||||
"bssid":
|
|
||||||
device.get("bssid", None),
|
|
||||||
"order_time":
|
|
||||||
device.get("orderTime", 0),
|
|
||||||
"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)
|
|
||||||
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:
|
||||||
|
|||||||
@ -1461,20 +1461,10 @@ class MipsLocalClient(_MipsClient):
|
|||||||
self.log_info(f'unsupported model, {model}, {did}')
|
self.log_info(f'unsupported model, {model}, {did}')
|
||||||
continue
|
continue
|
||||||
device_list[did] = {
|
device_list[did] = {
|
||||||
"did": did,
|
'did': did,
|
||||||
"name": name,
|
'online': info.get('online', False),
|
||||||
"urn": urn,
|
'specv2_access': info.get('specV2Access', False),
|
||||||
"model": model,
|
'push_available': info.get('pushAvailable', 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),
|
|
||||||
"push_available": info.get("pushAvailable", False),
|
|
||||||
"manufacturer": model.split(".")[0],
|
|
||||||
}
|
}
|
||||||
return device_list
|
return device_list
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user