mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2026-01-19 16:59:36 +08:00
Compare commits
No commits in common. "eacc0d02da519f7232cb1e206f5d7d8243328aa9" and "7a459de76641ebfee12a18217d6d9f58add03b8c" have entirely different histories.
eacc0d02da
...
7a459de766
16
CHANGELOG.md
16
CHANGELOG.md
@ -1,22 +1,8 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
## v0.3.0
|
|
||||||
注意:v0.3.0 变更了部分实体 unique_id 的生成规则,如果勾选 xiaomi_home > 配置 > 更新实体转换规则,会导致部分实体已配置的自动化失效。如果想要避免重新配置大量自动化,可使用这个[补丁](https://github.com/XiaoMi/ha_xiaomi_home/pull/972)。
|
|
||||||
|
|
||||||
CAUTION: v0.3.0 changes the unique_id of some entities. If you check the option `xiaomi_home > CONFIGURE > Update entity conversion rules`, it may cause the automation settings for these entities to fail. To avoid having to reconfigure a large number of automation settings, you can use this [patch](https://github.com/XiaoMi/ha_xiaomi_home/pull/972).
|
|
||||||
### Added
|
|
||||||
- Import the devices in the shared homes and the separated shared devices. [#1021](https://github.com/XiaoMi/ha_xiaomi_home/pull/1021)
|
|
||||||
- Support _attr_hvac_action of the climate entity. [#956](https://github.com/XiaoMi/ha_xiaomi_home/pull/956)
|
|
||||||
- Add custom defined MIoT-Spec-V2 instance via spec_add.json. [#953](https://github.com/XiaoMi/ha_xiaomi_home/pull/953)
|
|
||||||
|
|
||||||
### Fixed
|
|
||||||
- Ignore 'Event loop is closed' when unsub a closed event loop. [#991](https://github.com/XiaoMi/ha_xiaomi_home/pull/991)
|
|
||||||
- Fix contact-state for linp.magnet.m1 and loock.safe.v1. [#977](https://github.com/XiaoMi/ha_xiaomi_home/pull/977)
|
|
||||||
- Fix the mode initialization error of aupu.bhf_light.s368m. [#955](https://github.com/XiaoMi/ha_xiaomi_home/pull/955)
|
|
||||||
- Fix the MIoT-Spec-V2 of lumi.gateway.mcn001, qmi.plug.psv3, lumi.motion.acn001, izq.sensor_occupy.24, linp.sensor_occupy.hb01 and yunmi.waterpuri.s20. [#949](https://github.com/XiaoMi/ha_xiaomi_home/pull/949)
|
|
||||||
|
|
||||||
## v0.2.4
|
## v0.2.4
|
||||||
### Added
|
### Added
|
||||||
- Convert the submersion-state, the contact-state and the occupancy-status property to the binary_sensor entity. [#905](https://github.com/XiaoMi/ha_xiaomi_home/pull/905)
|
- Convert the submersion-state, the contact-state and the occupancy-status property to the binary_sensor entity. [#905](https://github.com/XiaoMi/ha_xiaomi_home/pull/905)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- suittc.airrtc.wk168 mode descriptions are set to strings of numbers from 1 to 16. [#921](https://github.com/XiaoMi/ha_xiaomi_home/pull/921)
|
- suittc.airrtc.wk168 mode descriptions are set to strings of numbers from 1 to 16. [#921](https://github.com/XiaoMi/ha_xiaomi_home/pull/921)
|
||||||
- Do not set _attr_suggested_display_precision when the spec.expr is set in spec_modify.yaml [#929](https://github.com/XiaoMi/ha_xiaomi_home/pull/929)
|
- Do not set _attr_suggested_display_precision when the spec.expr is set in spec_modify.yaml [#929](https://github.com/XiaoMi/ha_xiaomi_home/pull/929)
|
||||||
|
|||||||
@ -565,32 +565,27 @@ class XiaomiMihomeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
home_list = {}
|
home_list = {}
|
||||||
tip_devices = self._miot_i18n.translate(key='config.other.devices')
|
tip_devices = self._miot_i18n.translate(key='config.other.devices')
|
||||||
# home list
|
# home list
|
||||||
for device_source in ['home_list','share_home_list',
|
for home_id, home_info in self._cc_home_info[
|
||||||
'separated_shared_list']:
|
'homes']['home_list'].items():
|
||||||
if device_source not in self._cc_home_info['homes']:
|
# i18n
|
||||||
continue
|
tip_central = ''
|
||||||
for home_id, home_info in self._cc_home_info[
|
group_id = home_info.get('group_id', None)
|
||||||
'homes'][device_source].items():
|
dev_list = {
|
||||||
|
device['did']: device
|
||||||
|
for device in list(self._cc_home_info['devices'].values())
|
||||||
|
if device.get('home_id', None) == home_id}
|
||||||
|
if (
|
||||||
|
mips_list
|
||||||
|
and group_id in mips_list
|
||||||
|
and mips_list[group_id].get('did', None) in dev_list
|
||||||
|
):
|
||||||
# i18n
|
# i18n
|
||||||
tip_central = ''
|
tip_central = self._miot_i18n.translate(
|
||||||
group_id = home_info.get('group_id', None)
|
key='config.other.found_central_gateway')
|
||||||
dev_list = {
|
home_info['central_did'] = mips_list[group_id].get('did', None)
|
||||||
device['did']: device
|
home_list[home_id] = (
|
||||||
for device in list(self._cc_home_info['devices'].values())
|
f'{home_info["home_name"]} '
|
||||||
if device.get('home_id', None) == home_id}
|
f'[ {len(dev_list)} {tip_devices} {tip_central} ]')
|
||||||
if (
|
|
||||||
mips_list
|
|
||||||
and group_id in mips_list
|
|
||||||
and mips_list[group_id].get('did', None) in dev_list
|
|
||||||
):
|
|
||||||
# i18n
|
|
||||||
tip_central = self._miot_i18n.translate(
|
|
||||||
key='config.other.found_central_gateway')
|
|
||||||
home_info['central_did'] = mips_list[group_id].get(
|
|
||||||
'did', None)
|
|
||||||
home_list[home_id] = (
|
|
||||||
f'{home_info["home_name"]} '
|
|
||||||
f'[ {len(dev_list)} {tip_devices} {tip_central} ]')
|
|
||||||
|
|
||||||
self._cc_home_list_show = dict(sorted(home_list.items()))
|
self._cc_home_list_show = dict(sorted(home_list.items()))
|
||||||
|
|
||||||
@ -665,14 +660,10 @@ class XiaomiMihomeConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
if not home_selected:
|
if not home_selected:
|
||||||
return await self.__show_homes_select_form(
|
return await self.__show_homes_select_form(
|
||||||
'no_family_selected')
|
'no_family_selected')
|
||||||
for device_source in ['home_list','share_home_list',
|
for home_id, home_info in self._cc_home_info[
|
||||||
'separated_shared_list']:
|
'homes']['home_list'].items():
|
||||||
if device_source not in self._cc_home_info['homes']:
|
if home_id in home_selected:
|
||||||
continue
|
self._home_selected[home_id] = home_info
|
||||||
for home_id, home_info in self._cc_home_info[
|
|
||||||
'homes'][device_source].items():
|
|
||||||
if home_id in home_selected:
|
|
||||||
self._home_selected[home_id] = home_info
|
|
||||||
self._area_name_rule = user_input.get(
|
self._area_name_rule = user_input.get(
|
||||||
'area_name_rule', self._area_name_rule)
|
'area_name_rule', self._area_name_rule)
|
||||||
# Storage device list
|
# Storage device list
|
||||||
@ -1429,31 +1420,27 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
home_list = {}
|
home_list = {}
|
||||||
tip_devices = self._miot_i18n.translate(key='config.other.devices')
|
tip_devices = self._miot_i18n.translate(key='config.other.devices')
|
||||||
# home list
|
# home list
|
||||||
for device_source in ['home_list','share_home_list',
|
for home_id, home_info in self._cc_home_info[
|
||||||
'separated_shared_list']:
|
'homes']['home_list'].items():
|
||||||
if device_source not in self._cc_home_info['homes']:
|
# i18n
|
||||||
continue
|
tip_central = ''
|
||||||
for home_id, home_info in self._cc_home_info[
|
group_id = home_info.get('group_id', None)
|
||||||
'homes'][device_source].items():
|
did_list = {
|
||||||
|
device['did']: device for device in list(
|
||||||
|
self._cc_home_info['devices'].values())
|
||||||
|
if device.get('home_id', None) == home_id}
|
||||||
|
if (
|
||||||
|
group_id in mips_list
|
||||||
|
and mips_list[group_id].get('did', None) in did_list
|
||||||
|
):
|
||||||
# i18n
|
# i18n
|
||||||
tip_central = ''
|
tip_central = self._miot_i18n.translate(
|
||||||
group_id = home_info.get('group_id', None)
|
key='config.other.found_central_gateway')
|
||||||
did_list = {
|
home_info['central_did'] = mips_list[group_id].get(
|
||||||
device['did']: device for device in list(
|
'did', None)
|
||||||
self._cc_home_info['devices'].values())
|
home_list[home_id] = (
|
||||||
if device.get('home_id', None) == home_id}
|
f'{home_info["home_name"]} '
|
||||||
if (
|
f'[ {len(did_list)} {tip_devices} {tip_central} ]')
|
||||||
group_id in mips_list
|
|
||||||
and mips_list[group_id].get('did', None) in did_list
|
|
||||||
):
|
|
||||||
# i18n
|
|
||||||
tip_central = self._miot_i18n.translate(
|
|
||||||
key='config.other.found_central_gateway')
|
|
||||||
home_info['central_did'] = mips_list[group_id].get(
|
|
||||||
'did', None)
|
|
||||||
home_list[home_id] = (
|
|
||||||
f'{home_info["home_name"]} '
|
|
||||||
f'[ {len(did_list)} {tip_devices} {tip_central} ]')
|
|
||||||
# Remove deleted item
|
# Remove deleted item
|
||||||
self._home_selected_list = [
|
self._home_selected_list = [
|
||||||
home_id for home_id in self._home_selected_list
|
home_id for home_id in self._home_selected_list
|
||||||
@ -1473,14 +1460,10 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
return await self.__show_homes_select_form('no_family_selected')
|
return await self.__show_homes_select_form('no_family_selected')
|
||||||
self._ctrl_mode = user_input.get('ctrl_mode', self._ctrl_mode)
|
self._ctrl_mode = user_input.get('ctrl_mode', self._ctrl_mode)
|
||||||
self._home_selected = {}
|
self._home_selected = {}
|
||||||
for device_source in ['home_list','share_home_list',
|
for home_id, home_info in self._cc_home_info[
|
||||||
'separated_shared_list']:
|
'homes']['home_list'].items():
|
||||||
if device_source not in self._cc_home_info['homes']:
|
if home_id in self._home_selected_list:
|
||||||
continue
|
self._home_selected[home_id] = home_info
|
||||||
for home_id, home_info in self._cc_home_info[
|
|
||||||
'homes'][device_source].items():
|
|
||||||
if home_id in self._home_selected_list:
|
|
||||||
self._home_selected[home_id] = home_info
|
|
||||||
# Get device list
|
# Get device list
|
||||||
device_list: dict = {
|
device_list: dict = {
|
||||||
did: dev_info
|
did: dev_info
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
"cryptography",
|
"cryptography",
|
||||||
"psutil"
|
"psutil"
|
||||||
],
|
],
|
||||||
"version": "v0.3.0",
|
"version": "v0.2.4",
|
||||||
"zeroconf": [
|
"zeroconf": [
|
||||||
"_miot-central._tcp.local."
|
"_miot-central._tcp.local."
|
||||||
]
|
]
|
||||||
|
|||||||
@ -444,17 +444,6 @@ class MIoTHttpClient:
|
|||||||
|
|
||||||
return home_list
|
return home_list
|
||||||
|
|
||||||
async def get_separated_shared_devices_async(self) -> dict[str, dict]:
|
|
||||||
separated_shared_devices: dict = {}
|
|
||||||
device_list: dict[str, dict] = await self.__get_device_list_page_async(
|
|
||||||
dids=[], start_did=None)
|
|
||||||
for did, value in device_list.items():
|
|
||||||
if value['owner'] is not None and ('userid' in value['owner']) and (
|
|
||||||
'nickname' in value['owner']
|
|
||||||
):
|
|
||||||
separated_shared_devices.setdefault(did, value['owner'])
|
|
||||||
return separated_shared_devices
|
|
||||||
|
|
||||||
async def get_homeinfos_async(self) -> dict:
|
async def get_homeinfos_async(self) -> dict:
|
||||||
res_obj = await self.__mihome_api_post_async(
|
res_obj = await self.__mihome_api_post_async(
|
||||||
url_path='/app/v2/homeroom/gethome',
|
url_path='/app/v2/homeroom/gethome',
|
||||||
@ -510,22 +499,19 @@ class MIoTHttpClient:
|
|||||||
):
|
):
|
||||||
more_list = await self.__get_dev_room_page_async(
|
more_list = await self.__get_dev_room_page_async(
|
||||||
max_id=res_obj['result']['max_id'])
|
max_id=res_obj['result']['max_id'])
|
||||||
for device_source in ['homelist', 'share_home_list']:
|
for home_id, info in more_list.items():
|
||||||
for home_id, info in more_list.items():
|
if home_id not in home_infos['homelist']:
|
||||||
if home_id not in home_infos[device_source]:
|
_LOGGER.info('unknown home, %s, %s', home_id, info)
|
||||||
_LOGGER.info('unknown home, %s, %s', home_id, info)
|
continue
|
||||||
continue
|
home_infos['homelist'][home_id]['dids'].extend(info['dids'])
|
||||||
home_infos[device_source][home_id]['dids'].extend(
|
for room_id, info in info['room_info'].items():
|
||||||
info['dids'])
|
home_infos['homelist'][home_id]['room_info'].setdefault(
|
||||||
for room_id, info in info['room_info'].items():
|
room_id, {
|
||||||
home_infos[device_source][home_id][
|
'room_id': room_id,
|
||||||
'room_info'].setdefault(
|
'room_name': '',
|
||||||
room_id, {
|
'dids': []})
|
||||||
'room_id': room_id,
|
home_infos['homelist'][home_id]['room_info'][
|
||||||
'room_name': '',
|
room_id]['dids'].extend(info['dids'])
|
||||||
'dids': []})
|
|
||||||
home_infos[device_source][home_id]['room_info'][
|
|
||||||
room_id]['dids'].extend(info['dids'])
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'uid': uid,
|
'uid': uid,
|
||||||
@ -665,25 +651,6 @@ class MIoTHttpClient:
|
|||||||
'room_name': room_name,
|
'room_name': room_name,
|
||||||
'group_id': group_id
|
'group_id': group_id
|
||||||
} for did in room_info.get('dids', [])})
|
} for did in room_info.get('dids', [])})
|
||||||
separated_shared_devices: dict = (
|
|
||||||
await self.get_separated_shared_devices_async())
|
|
||||||
if separated_shared_devices:
|
|
||||||
homes.setdefault('separated_shared_list', {})
|
|
||||||
for did, owner in separated_shared_devices.items():
|
|
||||||
owner_id = str(owner['userid'])
|
|
||||||
homes['separated_shared_list'].setdefault(owner_id,{
|
|
||||||
'home_name': owner['nickname'],
|
|
||||||
'uid': owner_id,
|
|
||||||
'group_id': 'NotSupport',
|
|
||||||
'room_info': {'shared_device': 'shared_device'}
|
|
||||||
})
|
|
||||||
devices.update({did: {
|
|
||||||
'home_id': owner_id,
|
|
||||||
'home_name': owner['nickname'],
|
|
||||||
'room_id': 'shared_device',
|
|
||||||
'room_name': 'shared_device',
|
|
||||||
'group_id': 'NotSupport'
|
|
||||||
}})
|
|
||||||
dids = sorted(list(devices.keys()))
|
dids = sorted(list(devices.keys()))
|
||||||
results = await self.get_devices_with_dids_async(dids=dids)
|
results = await self.get_devices_with_dids_async(dids=dids)
|
||||||
if results is None:
|
if results is None:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user