mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-07-08 06:44:43 +08:00
Compare commits
1 Commits
v0.3.2
...
zhimi.fan.
Author | SHA1 | Date | |
---|---|---|---|
4d01ab055a |
21
CHANGELOG.md
21
CHANGELOG.md
@ -1,24 +1,4 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
## v0.3.2
|
|
||||||
> Xiaomi Home has been added to the Home Assistant Community Store (HACS) as a default since May 8, 2025.
|
|
||||||
### Added
|
|
||||||
- Modify MIoT-Spec-V2 property format by spec_modify.yaml. [#1111](https://github.com/XiaoMi/ha_xiaomi_home/pull/1111)
|
|
||||||
### Changed
|
|
||||||
- Update the instructions of Xiaomi Home integration installation from HACS. [#102](https://github.com/XiaoMi/ha_xiaomi_home/pull/102) [#1088](https://github.com/XiaoMi/ha_xiaomi_home/pull/1088)
|
|
||||||
- Add an alongside switch entity for zimi.waterheater.h03 and xiaomi.waterheater.yms2. [#1115](https://github.com/XiaoMi/ha_xiaomi_home/pull/1115)
|
|
||||||
### Fixed
|
|
||||||
- Fix Chinese encoding in LAN Control. [#1114](https://github.com/XiaoMi/ha_xiaomi_home/pull/1114)
|
|
||||||
- Fix the MIoT-Spec-V2 of lxzn.switch.jcbcsm power consumption, voltage and current, shhf.light.sfla10 fan direction, zhimi.fan.za4 fan-level, zhimi.fan.sa1 fan-level. [#1110](https://github.com/XiaoMi/ha_xiaomi_home/pull/1110)
|
|
||||||
- Revise the Chinese descriptions of loock.lock.t2pv1 door state value-list. [#1110](https://github.com/XiaoMi/ha_xiaomi_home/pull/1110)
|
|
||||||
|
|
||||||
## v0.3.1
|
|
||||||
### Changed
|
|
||||||
- Setting the fan speed level when the fan is off will turning the fan on first. [#1031](https://github.com/XiaoMi/ha_xiaomi_home/pull/1031)
|
|
||||||
### Fixed
|
|
||||||
- Fix update device list error when there is no shared devices. [#1024](https://github.com/XiaoMi/ha_xiaomi_home/pull/1024)
|
|
||||||
- Fix the humidifier get_prop_value error when the property is None. [#1035](https://github.com/XiaoMi/ha_xiaomi_home/pull/1035)
|
|
||||||
- Fix the MIoT-Spec-V2 of zhimi.fan.v3 fan-level, cuco.plug.cp1md voltage and current, zimi.plug.zncz01 electric-power, giot.plug.v8icm power-consumption unit, yunmi.kettle.r3 tds unit, and dmaker.fan.p5 fan-level. [#1037](https://github.com/XiaoMi/ha_xiaomi_home/pull/1037)
|
|
||||||
|
|
||||||
## v0.3.0
|
## v0.3.0
|
||||||
注意:v0.3.0 变更了部分实体 unique_id 的生成规则,如果勾选 xiaomi_home > 配置 > 更新实体转换规则,会导致部分实体已配置的自动化失效。如果想要避免重新配置大量自动化,可使用这个[补丁](https://github.com/XiaoMi/ha_xiaomi_home/pull/972)。
|
注意:v0.3.0 变更了部分实体 unique_id 的生成规则,如果勾选 xiaomi_home > 配置 > 更新实体转换规则,会导致部分实体已配置的自动化失效。如果想要避免重新配置大量自动化,可使用这个[补丁](https://github.com/XiaoMi/ha_xiaomi_home/pull/972)。
|
||||||
|
|
||||||
@ -27,6 +7,7 @@ CAUTION: v0.3.0 changes the unique_id of some entities. If you check the option
|
|||||||
- Import the devices in the shared homes and the separated shared devices. [#1021](https://github.com/XiaoMi/ha_xiaomi_home/pull/1021)
|
- 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)
|
- 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)
|
- Add custom defined MIoT-Spec-V2 instance via spec_add.json. [#953](https://github.com/XiaoMi/ha_xiaomi_home/pull/953)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Ignore 'Event loop is closed' when unsub a closed event loop. [#991](https://github.com/XiaoMi/ha_xiaomi_home/pull/991)
|
- 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 contact-state for linp.magnet.m1 and loock.safe.v1. [#977](https://github.com/XiaoMi/ha_xiaomi_home/pull/977)
|
||||||
|
10
README.md
10
README.md
@ -33,11 +33,9 @@ git checkout v1.0.0
|
|||||||
|
|
||||||
### Method 2: [HACS](https://hacs.xyz/)
|
### Method 2: [HACS](https://hacs.xyz/)
|
||||||
|
|
||||||
One-click installation from HACS:
|
HACS > Overflow Menu > Custom repositories > Repository: https://github.com/XiaoMi/ha_xiaomi_home.git & Category or Type: Integration > ADD > Xiaomi Home in New or Available for download section of HACS > DOWNLOAD
|
||||||
|
|
||||||
[](https://my.home-assistant.io/redirect/hacs_repository/?owner=XiaoMi&repository=ha_xiaomi_home&category=integration)
|
> Xiaomi Home has not been added to the HACS store as a default yet. It's coming soon.
|
||||||
|
|
||||||
Or, HACS > In the search box, type **Xiaomi Home** > Click **Xiaomi Home**, getting into the detail page > DOWNLOAD
|
|
||||||
|
|
||||||
### Method 3: Manually installation via [Samba](https://github.com/home-assistant/addons/tree/master/samba) / [FTPS](https://github.com/hassio-addons/addon-ftp)
|
### Method 3: Manually installation via [Samba](https://github.com/home-assistant/addons/tree/master/samba) / [FTPS](https://github.com/hassio-addons/addon-ftp)
|
||||||
|
|
||||||
@ -49,7 +47,7 @@ Download and copy `custom_components/xiaomi_home` folder to `config/custom_compo
|
|||||||
|
|
||||||
[Settings > Devices & services > ADD INTEGRATION](https://my.home-assistant.io/redirect/brand/?brand=xiaomi_home) > Search `Xiaomi Home` > NEXT > Click here to login > Sign in with Xiaomi account
|
[Settings > Devices & services > ADD INTEGRATION](https://my.home-assistant.io/redirect/brand/?brand=xiaomi_home) > Search `Xiaomi Home` > NEXT > Click here to login > Sign in with Xiaomi account
|
||||||
|
|
||||||
[](https://my.home-assistant.io/redirect/config_flow_start/?domain=xiaomi_home)
|
[](https://my.home-assistant.io/redirect/config_flow_start/?domain=xiaomi_home)
|
||||||
|
|
||||||
### Add MIoT Devices
|
### Add MIoT Devices
|
||||||
|
|
||||||
@ -61,7 +59,7 @@ After a Xiaomi account login and its user configuration are completed, you can c
|
|||||||
|
|
||||||
Method: [Settings > Devices & services > Configured > Xiaomi Home](https://my.home-assistant.io/redirect/integration/?domain=xiaomi_home) > ADD HUB > NEXT > Click here to login > Sign in with Xiaomi account
|
Method: [Settings > Devices & services > Configured > Xiaomi Home](https://my.home-assistant.io/redirect/integration/?domain=xiaomi_home) > ADD HUB > NEXT > Click here to login > Sign in with Xiaomi account
|
||||||
|
|
||||||
[](https://my.home-assistant.io/redirect/integration/?domain=xiaomi_home)
|
[](https://my.home-assistant.io/redirect/integration/?domain=xiaomi_home)
|
||||||
|
|
||||||
### Update Configurations
|
### Update Configurations
|
||||||
|
|
||||||
|
@ -236,9 +236,6 @@ class Fan(MIoTServiceEntity, FanEntity):
|
|||||||
async def async_set_percentage(self, percentage: int) -> None:
|
async def async_set_percentage(self, percentage: int) -> None:
|
||||||
"""Set the percentage of the fan speed."""
|
"""Set the percentage of the fan speed."""
|
||||||
if percentage > 0:
|
if percentage > 0:
|
||||||
if not self.is_on:
|
|
||||||
# If the fan is off, turn it on.
|
|
||||||
await self.set_property_async(prop=self._prop_on, value=True)
|
|
||||||
if self._speed_names:
|
if self._speed_names:
|
||||||
await self.set_property_async(
|
await self.set_property_async(
|
||||||
prop=self._prop_fan_level,
|
prop=self._prop_fan_level,
|
||||||
@ -252,6 +249,9 @@ class Fan(MIoTServiceEntity, FanEntity):
|
|||||||
value=int(percentage_to_ranged_value(
|
value=int(percentage_to_ranged_value(
|
||||||
low_high_range=(self._speed_min, self._speed_max),
|
low_high_range=(self._speed_min, self._speed_max),
|
||||||
percentage=percentage)))
|
percentage=percentage)))
|
||||||
|
if not self.is_on:
|
||||||
|
# If the fan is off, turn it on.
|
||||||
|
await self.set_property_async(prop=self._prop_on, value=True)
|
||||||
else:
|
else:
|
||||||
await self.set_property_async(prop=self._prop_on, value=False)
|
await self.set_property_async(prop=self._prop_on, value=False)
|
||||||
|
|
||||||
|
@ -52,22 +52,23 @@ from typing import Any, Optional
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.components.humidifier import (HumidifierEntity,
|
from homeassistant.components.humidifier import (
|
||||||
HumidifierDeviceClass,
|
HumidifierEntity,
|
||||||
HumidifierEntityFeature,
|
HumidifierDeviceClass,
|
||||||
HumidifierAction)
|
HumidifierEntityFeature
|
||||||
|
)
|
||||||
|
|
||||||
from .miot.miot_spec import MIoTSpecProperty
|
from .miot.miot_spec import MIoTSpecProperty
|
||||||
from .miot.miot_device import MIoTDevice, MIoTEntityData, MIoTServiceEntity
|
from .miot.miot_device import MIoTDevice, MIoTEntityData, MIoTServiceEntity
|
||||||
from .miot.const import DOMAIN
|
from .miot.const import DOMAIN
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up a config entry."""
|
"""Set up a config entry."""
|
||||||
device_list: list[MIoTDevice] = hass.data[DOMAIN]['devices'][
|
device_list: list[MIoTDevice] = hass.data[DOMAIN]['devices'][
|
||||||
@ -81,8 +82,8 @@ async def async_setup_entry(
|
|||||||
Humidifier(miot_device=miot_device, entity_data=data))
|
Humidifier(miot_device=miot_device, entity_data=data))
|
||||||
for data in miot_device.entity_list.get('dehumidifier', []):
|
for data in miot_device.entity_list.get('dehumidifier', []):
|
||||||
data.device_class = HumidifierDeviceClass.DEHUMIDIFIER
|
data.device_class = HumidifierDeviceClass.DEHUMIDIFIER
|
||||||
new_entities.append(
|
new_entities.append(Humidifier(
|
||||||
Humidifier(miot_device=miot_device, entity_data=data))
|
miot_device=miot_device, entity_data=data))
|
||||||
|
|
||||||
if new_entities:
|
if new_entities:
|
||||||
async_add_entities(new_entities)
|
async_add_entities(new_entities)
|
||||||
@ -98,8 +99,9 @@ class Humidifier(MIoTServiceEntity, HumidifierEntity):
|
|||||||
|
|
||||||
_mode_map: dict[Any, Any]
|
_mode_map: dict[Any, Any]
|
||||||
|
|
||||||
def __init__(self, miot_device: MIoTDevice,
|
def __init__(
|
||||||
entity_data: MIoTEntityData) -> None:
|
self, miot_device: MIoTDevice, entity_data: MIoTEntityData
|
||||||
|
) -> None:
|
||||||
"""Initialize the Humidifier."""
|
"""Initialize the Humidifier."""
|
||||||
super().__init__(miot_device=miot_device, entity_data=entity_data)
|
super().__init__(miot_device=miot_device, entity_data=entity_data)
|
||||||
self._attr_device_class = entity_data.device_class
|
self._attr_device_class = entity_data.device_class
|
||||||
@ -128,10 +130,12 @@ class Humidifier(MIoTServiceEntity, HumidifierEntity):
|
|||||||
# mode
|
# mode
|
||||||
elif prop.name == 'mode':
|
elif prop.name == 'mode':
|
||||||
if not prop.value_list:
|
if not prop.value_list:
|
||||||
_LOGGER.error('mode value_list is None, %s', self.entity_id)
|
_LOGGER.error(
|
||||||
|
'mode value_list is None, %s', self.entity_id)
|
||||||
continue
|
continue
|
||||||
self._mode_map = prop.value_list.to_map()
|
self._mode_map = prop.value_list.to_map()
|
||||||
self._attr_available_modes = list(self._mode_map.values())
|
self._attr_available_modes = list(
|
||||||
|
self._mode_map.values())
|
||||||
self._attr_supported_features |= HumidifierEntityFeature.MODES
|
self._attr_supported_features |= HumidifierEntityFeature.MODES
|
||||||
self._prop_mode = prop
|
self._prop_mode = prop
|
||||||
# relative-humidity
|
# relative-humidity
|
||||||
@ -148,45 +152,33 @@ class Humidifier(MIoTServiceEntity, HumidifierEntity):
|
|||||||
|
|
||||||
async def async_set_humidity(self, humidity: int) -> None:
|
async def async_set_humidity(self, humidity: int) -> None:
|
||||||
"""Set new target humidity."""
|
"""Set new target humidity."""
|
||||||
if self._prop_target_humidity is None:
|
await self.set_property_async(
|
||||||
return
|
prop=self._prop_target_humidity, value=humidity)
|
||||||
await self.set_property_async(prop=self._prop_target_humidity,
|
|
||||||
value=humidity)
|
|
||||||
|
|
||||||
async def async_set_mode(self, mode: str) -> None:
|
async def async_set_mode(self, mode: str) -> None:
|
||||||
"""Set new target preset mode."""
|
"""Set new target preset mode."""
|
||||||
await self.set_property_async(prop=self._prop_mode,
|
await self.set_property_async(
|
||||||
value=self.get_map_key(
|
prop=self._prop_mode,
|
||||||
map_=self._mode_map, value=mode))
|
value=self.get_map_key(map_=self._mode_map, value=mode))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> Optional[bool]:
|
def is_on(self) -> Optional[bool]:
|
||||||
"""Return if the humidifier is on."""
|
"""Return if the humidifier is on."""
|
||||||
return self.get_prop_value(prop=self._prop_on)
|
return self.get_prop_value(prop=self._prop_on)
|
||||||
|
|
||||||
@property
|
|
||||||
def action(self) -> Optional[HumidifierAction]:
|
|
||||||
"""Return the current status of the device."""
|
|
||||||
if not self.is_on:
|
|
||||||
return HumidifierAction.OFF
|
|
||||||
if self._attr_device_class == HumidifierDeviceClass.HUMIDIFIER:
|
|
||||||
return HumidifierAction.HUMIDIFYING
|
|
||||||
return HumidifierAction.DRYING
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_humidity(self) -> Optional[int]:
|
def current_humidity(self) -> Optional[int]:
|
||||||
"""Return the current humidity."""
|
"""Return the current humidity."""
|
||||||
return (self.get_prop_value(
|
return self.get_prop_value(prop=self._prop_humidity)
|
||||||
prop=self._prop_humidity) if self._prop_humidity else None)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def target_humidity(self) -> Optional[int]:
|
def target_humidity(self) -> Optional[int]:
|
||||||
"""Return the target humidity."""
|
"""Return the target humidity."""
|
||||||
return (self.get_prop_value(prop=self._prop_target_humidity)
|
return self.get_prop_value(prop=self._prop_target_humidity)
|
||||||
if self._prop_target_humidity else None)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mode(self) -> Optional[str]:
|
def mode(self) -> Optional[str]:
|
||||||
"""Return the current preset mode."""
|
"""Return the current preset mode."""
|
||||||
return self.get_map_value(map_=self._mode_map,
|
return self.get_map_value(
|
||||||
key=self.get_prop_value(prop=self._prop_mode))
|
map_=self._mode_map,
|
||||||
|
key=self.get_prop_value(prop=self._prop_mode))
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
"cryptography",
|
"cryptography",
|
||||||
"psutil"
|
"psutil"
|
||||||
],
|
],
|
||||||
"version": "v0.3.2",
|
"version": "v0.3.0",
|
||||||
"zeroconf": [
|
"zeroconf": [
|
||||||
"_miot-central._tcp.local."
|
"_miot-central._tcp.local."
|
||||||
]
|
]
|
||||||
|
@ -646,8 +646,7 @@ class MIoTClient:
|
|||||||
result = await self._miot_lan.set_prop_async(
|
result = await self._miot_lan.set_prop_async(
|
||||||
did=did, siid=siid, piid=piid, value=value)
|
did=did, siid=siid, piid=piid, value=value)
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
'lan set prop, %s.%d.%d, %s -> %s',
|
'lan set prop, %s, %s, %s -> %s', did, siid, piid, result)
|
||||||
did, siid, piid, value, result)
|
|
||||||
rc = (result or {}).get(
|
rc = (result or {}).get(
|
||||||
'code', MIoTErrorCode.CODE_MIPS_INVALID_RESULT.value)
|
'code', MIoTErrorCode.CODE_MIPS_INVALID_RESULT.value)
|
||||||
if rc in [0, 1]:
|
if rc in [0, 1]:
|
||||||
|
@ -779,10 +779,8 @@ class MIoTDevice:
|
|||||||
# pylint: disable=import-outside-toplevel
|
# pylint: disable=import-outside-toplevel
|
||||||
from homeassistant.const import UnitOfConductivity # type: ignore
|
from homeassistant.const import UnitOfConductivity # type: ignore
|
||||||
unit_map['μS/cm'] = UnitOfConductivity.MICROSIEMENS_PER_CM
|
unit_map['μS/cm'] = UnitOfConductivity.MICROSIEMENS_PER_CM
|
||||||
unit_map['mWh'] = UnitOfEnergy.MILLIWATT_HOUR
|
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
unit_map['μS/cm'] = 'μS/cm'
|
unit_map['μS/cm'] = 'μS/cm'
|
||||||
unit_map['mWh'] = 'mWh'
|
|
||||||
|
|
||||||
return unit_map.get(spec_unit, None)
|
return unit_map.get(spec_unit, None)
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ class _MIoTLanDevice:
|
|||||||
def gen_packet(
|
def gen_packet(
|
||||||
self, out_buffer: bytearray, clear_data: dict, did: str, offset: int
|
self, out_buffer: bytearray, clear_data: dict, did: str, offset: int
|
||||||
) -> int:
|
) -> int:
|
||||||
clear_bytes = json.dumps(clear_data, ensure_ascii=False).encode('utf-8')
|
clear_bytes = json.dumps(clear_data).encode('utf-8')
|
||||||
padder = padding.PKCS7(algorithms.AES128.block_size).padder()
|
padder = padding.PKCS7(algorithms.AES128.block_size).padder()
|
||||||
padded_data = padder.update(clear_bytes) + padder.finalize()
|
padded_data = padder.update(clear_bytes) + padder.finalize()
|
||||||
if len(padded_data) + self.OT_HEADER_LEN > len(out_buffer):
|
if len(padded_data) + self.OT_HEADER_LEN > len(out_buffer):
|
||||||
|
@ -601,7 +601,7 @@ class MIoTSpecProperty(_MIoTSpecBase):
|
|||||||
if value is None:
|
if value is None:
|
||||||
return None
|
return None
|
||||||
if self.format_ == int:
|
if self.format_ == int:
|
||||||
return int(round(value))
|
return int(value)
|
||||||
if self.format_ == float:
|
if self.format_ == float:
|
||||||
return round(value, self.precision)
|
return round(value, self.precision)
|
||||||
if self.format_ == bool:
|
if self.format_ == bool:
|
||||||
@ -1195,9 +1195,6 @@ class _SpecModify:
|
|||||||
def get_prop_unit(self, siid: int, piid: int) -> Optional[str]:
|
def get_prop_unit(self, siid: int, piid: int) -> Optional[str]:
|
||||||
return self.__get_prop_item(siid=siid, piid=piid, key='unit')
|
return self.__get_prop_item(siid=siid, piid=piid, key='unit')
|
||||||
|
|
||||||
def get_prop_format(self, siid: int, piid: int) -> Optional[str]:
|
|
||||||
return self.__get_prop_item(siid=siid, piid=piid, key='format')
|
|
||||||
|
|
||||||
def get_prop_expr(self, siid: int, piid: int) -> Optional[str]:
|
def get_prop_expr(self, siid: int, piid: int) -> Optional[str]:
|
||||||
return self.__get_prop_item(siid=siid, piid=piid, key='expr')
|
return self.__get_prop_item(siid=siid, piid=piid, key='expr')
|
||||||
|
|
||||||
@ -1521,10 +1518,6 @@ class MIoTSpecParser:
|
|||||||
siid=service['iid'], piid=property_['iid'])
|
siid=service['iid'], piid=property_['iid'])
|
||||||
if custom_access:
|
if custom_access:
|
||||||
spec_prop.access = custom_access
|
spec_prop.access = custom_access
|
||||||
custom_format = self._spec_modify.get_prop_format(
|
|
||||||
siid=service['iid'], piid=property_['iid'])
|
|
||||||
if custom_format:
|
|
||||||
spec_prop.format_ = custom_format
|
|
||||||
custom_range = self._spec_modify.get_prop_value_range(
|
custom_range = self._spec_modify.get_prop_value_range(
|
||||||
siid=service['iid'], piid=property_['iid'])
|
siid=service['iid'], piid=property_['iid'])
|
||||||
if custom_range:
|
if custom_range:
|
||||||
|
@ -1,198 +1,187 @@
|
|||||||
{
|
{
|
||||||
"urn:miot-spec-v2:device:bath-heater:0000A028:yeelink-v10": {
|
"urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1": {
|
||||||
"en": {
|
"de": {
|
||||||
"service:003:property:001:valuelist:000": "Idle",
|
"service:001": "Geräteinformationen",
|
||||||
"service:003:property:001:valuelist:001": "Dry"
|
"service:001:property:003": "Geräte-ID",
|
||||||
|
"service:001:property:005": "Seriennummer (SN)",
|
||||||
|
"service:002": "Gateway",
|
||||||
|
"service:002:event:001": "Netzwerk geändert",
|
||||||
|
"service:002:event:002": "Netzwerk geändert",
|
||||||
|
"service:002:property:001": "Zugriffsmethode",
|
||||||
|
"service:002:property:001:valuelist:000": "Kabelgebunden",
|
||||||
|
"service:002:property:001:valuelist:001": "5G Drahtlos",
|
||||||
|
"service:002:property:001:valuelist:002": "2.4G Drahtlos",
|
||||||
|
"service:002:property:002": "IP-Adresse",
|
||||||
|
"service:002:property:003": "WiFi-Netzwerkname",
|
||||||
|
"service:002:property:004": "Aktuelle Zeit",
|
||||||
|
"service:002:property:005": "DHCP-Server-MAC-Adresse",
|
||||||
|
"service:003": "Anzeigelampe",
|
||||||
|
"service:003:property:001": "Schalter",
|
||||||
|
"service:004": "Virtueller Dienst",
|
||||||
|
"service:004:action:001": "Virtuelles Ereignis erzeugen",
|
||||||
|
"service:004:event:001": "Virtuelles Ereignis aufgetreten",
|
||||||
|
"service:004:property:001": "Ereignisname"
|
||||||
|
},
|
||||||
|
"en": {
|
||||||
|
"service:001": "Device Information",
|
||||||
|
"service:001:property:003": "Device ID",
|
||||||
|
"service:001:property:005": "Serial Number (SN)",
|
||||||
|
"service:002": "Gateway",
|
||||||
|
"service:002:event:001": "Network Changed",
|
||||||
|
"service:002:event:002": "Network Changed",
|
||||||
|
"service:002:property:001": "Access Method",
|
||||||
|
"service:002:property:001:valuelist:000": "Wired",
|
||||||
|
"service:002:property:001:valuelist:001": "5G Wireless",
|
||||||
|
"service:002:property:001:valuelist:002": "2.4G Wireless",
|
||||||
|
"service:002:property:002": "IP Address",
|
||||||
|
"service:002:property:003": "WiFi Network Name",
|
||||||
|
"service:002:property:004": "Current Time",
|
||||||
|
"service:002:property:005": "DHCP Server MAC Address",
|
||||||
|
"service:003": "Indicator Light",
|
||||||
|
"service:003:property:001": "Switch",
|
||||||
|
"service:004": "Virtual Service",
|
||||||
|
"service:004:action:001": "Generate Virtual Event",
|
||||||
|
"service:004:event:001": "Virtual Event Occurred",
|
||||||
|
"service:004:property:001": "Event Name"
|
||||||
|
},
|
||||||
|
"es": {
|
||||||
|
"service:001": "Información del dispositivo",
|
||||||
|
"service:001:property:003": "ID del dispositivo",
|
||||||
|
"service:001:property:005": "Número de serie (SN)",
|
||||||
|
"service:002": "Puerta de enlace",
|
||||||
|
"service:002:event:001": "Cambio de red",
|
||||||
|
"service:002:event:002": "Cambio de red",
|
||||||
|
"service:002:property:001": "Método de acceso",
|
||||||
|
"service:002:property:001:valuelist:000": "Cableado",
|
||||||
|
"service:002:property:001:valuelist:001": "5G inalámbrico",
|
||||||
|
"service:002:property:001:valuelist:002": "2.4G inalámbrico",
|
||||||
|
"service:002:property:002": "Dirección IP",
|
||||||
|
"service:002:property:003": "Nombre de red WiFi",
|
||||||
|
"service:002:property:004": "Hora actual",
|
||||||
|
"service:002:property:005": "Dirección MAC del servidor DHCP",
|
||||||
|
"service:003": "Luz indicadora",
|
||||||
|
"service:003:property:001": "Interruptor",
|
||||||
|
"service:004": "Servicio virtual",
|
||||||
|
"service:004:action:001": "Generar evento virtual",
|
||||||
|
"service:004:event:001": "Ocurrió un evento virtual",
|
||||||
|
"service:004:property:001": "Nombre del evento"
|
||||||
|
},
|
||||||
|
"fr": {
|
||||||
|
"service:001": "Informations sur l'appareil",
|
||||||
|
"service:001:property:003": "ID de l'appareil",
|
||||||
|
"service:001:property:005": "Numéro de série (SN)",
|
||||||
|
"service:002": "Passerelle",
|
||||||
|
"service:002:event:001": "Changement de réseau",
|
||||||
|
"service:002:event:002": "Changement de réseau",
|
||||||
|
"service:002:property:001": "Méthode d'accès",
|
||||||
|
"service:002:property:001:valuelist:000": "Câblé",
|
||||||
|
"service:002:property:001:valuelist:001": "Sans fil 5G",
|
||||||
|
"service:002:property:001:valuelist:002": "Sans fil 2.4G",
|
||||||
|
"service:002:property:002": "Adresse IP",
|
||||||
|
"service:002:property:003": "Nom du réseau WiFi",
|
||||||
|
"service:002:property:004": "Heure actuelle",
|
||||||
|
"service:002:property:005": "Adresse MAC du serveur DHCP",
|
||||||
|
"service:003": "Voyant lumineux",
|
||||||
|
"service:003:property:001": "Interrupteur",
|
||||||
|
"service:004": "Service virtuel",
|
||||||
|
"service:004:action:001": "Générer un événement virtuel",
|
||||||
|
"service:004:event:001": "Événement virtuel survenu",
|
||||||
|
"service:004:property:001": "Nom de l'événement"
|
||||||
|
},
|
||||||
|
"ja": {
|
||||||
|
"service:001": "デバイス情報",
|
||||||
|
"service:001:property:003": "デバイスID",
|
||||||
|
"service:001:property:005": "シリアル番号 (SN)",
|
||||||
|
"service:002": "ゲートウェイ",
|
||||||
|
"service:002:event:001": "ネットワークが変更されました",
|
||||||
|
"service:002:event:002": "ネットワークが変更されました",
|
||||||
|
"service:002:property:001": "アクセス方法",
|
||||||
|
"service:002:property:001:valuelist:000": "有線",
|
||||||
|
"service:002:property:001:valuelist:001": "5G ワイヤレス",
|
||||||
|
"service:002:property:001:valuelist:002": "2.4G ワイヤレス",
|
||||||
|
"service:002:property:002": "IPアドレス",
|
||||||
|
"service:002:property:003": "WiFiネットワーク名",
|
||||||
|
"service:002:property:004": "現在の時間",
|
||||||
|
"service:002:property:005": "DHCPサーバーMACアドレス",
|
||||||
|
"service:003": "インジケータライト",
|
||||||
|
"service:003:property:001": "スイッチ",
|
||||||
|
"service:004": "バーチャルサービス",
|
||||||
|
"service:004:action:001": "バーチャルイベントを生成",
|
||||||
|
"service:004:event:001": "バーチャルイベントが発生しました",
|
||||||
|
"service:004:property:001": "イベント名"
|
||||||
|
},
|
||||||
|
"ru": {
|
||||||
|
"service:001": "Информация об устройстве",
|
||||||
|
"service:001:property:003": "ID устройства",
|
||||||
|
"service:001:property:005": "Серийный номер (SN)",
|
||||||
|
"service:002": "Шлюз",
|
||||||
|
"service:002:event:001": "Сеть изменена",
|
||||||
|
"service:002:event:002": "Сеть изменена",
|
||||||
|
"service:002:property:001": "Метод доступа",
|
||||||
|
"service:002:property:001:valuelist:000": "Проводной",
|
||||||
|
"service:002:property:001:valuelist:001": "5G Беспроводной",
|
||||||
|
"service:002:property:001:valuelist:002": "2.4G Беспроводной",
|
||||||
|
"service:002:property:002": "IP Адрес",
|
||||||
|
"service:002:property:003": "Название WiFi сети",
|
||||||
|
"service:002:property:004": "Текущее время",
|
||||||
|
"service:002:property:005": "MAC адрес DHCP сервера",
|
||||||
|
"service:003": "Световой индикатор",
|
||||||
|
"service:003:property:001": "Переключатель",
|
||||||
|
"service:004": "Виртуальная служба",
|
||||||
|
"service:004:action:001": "Создать виртуальное событие",
|
||||||
|
"service:004:event:001": "Произошло виртуальное событие",
|
||||||
|
"service:004:property:001": "Название события"
|
||||||
|
},
|
||||||
|
"zh-Hant": {
|
||||||
|
"service:001": "設備信息",
|
||||||
|
"service:001:property:003": "設備ID",
|
||||||
|
"service:001:property:005": "序號 (SN)",
|
||||||
|
"service:002": "網關",
|
||||||
|
"service:002:event:001": "網路發生變化",
|
||||||
|
"service:002:event:002": "網路發生變化",
|
||||||
|
"service:002:property:001": "接入方式",
|
||||||
|
"service:002:property:001:valuelist:000": "有線",
|
||||||
|
"service:002:property:001:valuelist:001": "5G 無線",
|
||||||
|
"service:002:property:001:valuelist:002": "2.4G 無線",
|
||||||
|
"service:002:property:002": "IP地址",
|
||||||
|
"service:002:property:003": "WiFi網路名稱",
|
||||||
|
"service:002:property:004": "當前時間",
|
||||||
|
"service:002:property:005": "DHCP伺服器MAC地址",
|
||||||
|
"service:003": "指示燈",
|
||||||
|
"service:003:property:001": "開關",
|
||||||
|
"service:004": "虛擬服務",
|
||||||
|
"service:004:action:001": "產生虛擬事件",
|
||||||
|
"service:004:event:001": "虛擬事件發生",
|
||||||
|
"service:004:property:001": "事件名稱"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"urn:miot-spec-v2:device:switch:0000A003:lumi-acn040": {
|
||||||
|
"en": {
|
||||||
|
"service:011": "Right Button On and Off",
|
||||||
|
"service:011:property:001": "Right Button On and Off",
|
||||||
|
"service:015:action:001": "Left Button Identify",
|
||||||
|
"service:016:action:001": "Middle Button Identify",
|
||||||
|
"service:017:action:001": "Right Button Identify"
|
||||||
|
},
|
||||||
|
"zh-Hans": {
|
||||||
|
"service:015:action:001": "左键确认",
|
||||||
|
"service:016:action:001": "中键确认",
|
||||||
|
"service:017:action:001": "右键确认"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"urn:miot-spec-v2:device:bath-heater:0000A028:yeelink-v10": {
|
||||||
|
"en": {
|
||||||
|
"service:003:property:001:valuelist:000": "Idle",
|
||||||
|
"service:003:property:001:valuelist:001": "Dry"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"urn:miot-spec-v2:device:plant-monitor:0000A030:hhcc-v1": {
|
||||||
|
"en": {
|
||||||
|
"service:002:property:001": "Soil Moisture"
|
||||||
|
},
|
||||||
|
"zh-Hans": {
|
||||||
|
"service:002:property:001": "土壤湿度",
|
||||||
|
"service:002:property:003": "光照强度"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1": {
|
|
||||||
"de": {
|
|
||||||
"service:001": "Geräteinformationen",
|
|
||||||
"service:001:property:003": "Geräte-ID",
|
|
||||||
"service:001:property:005": "Seriennummer (SN)",
|
|
||||||
"service:002": "Gateway",
|
|
||||||
"service:002:event:001": "Netzwerk geändert",
|
|
||||||
"service:002:event:002": "Netzwerk geändert",
|
|
||||||
"service:002:property:001": "Zugriffsmethode",
|
|
||||||
"service:002:property:001:valuelist:000": "Kabelgebunden",
|
|
||||||
"service:002:property:001:valuelist:001": "5G Drahtlos",
|
|
||||||
"service:002:property:001:valuelist:002": "2.4G Drahtlos",
|
|
||||||
"service:002:property:002": "IP-Adresse",
|
|
||||||
"service:002:property:003": "WiFi-Netzwerkname",
|
|
||||||
"service:002:property:004": "Aktuelle Zeit",
|
|
||||||
"service:002:property:005": "DHCP-Server-MAC-Adresse",
|
|
||||||
"service:003": "Anzeigelampe",
|
|
||||||
"service:003:property:001": "Schalter",
|
|
||||||
"service:004": "Virtueller Dienst",
|
|
||||||
"service:004:action:001": "Virtuelles Ereignis erzeugen",
|
|
||||||
"service:004:event:001": "Virtuelles Ereignis aufgetreten",
|
|
||||||
"service:004:property:001": "Ereignisname"
|
|
||||||
},
|
|
||||||
"en": {
|
|
||||||
"service:001": "Device Information",
|
|
||||||
"service:001:property:003": "Device ID",
|
|
||||||
"service:001:property:005": "Serial Number (SN)",
|
|
||||||
"service:002": "Gateway",
|
|
||||||
"service:002:event:001": "Network Changed",
|
|
||||||
"service:002:event:002": "Network Changed",
|
|
||||||
"service:002:property:001": "Access Method",
|
|
||||||
"service:002:property:001:valuelist:000": "Wired",
|
|
||||||
"service:002:property:001:valuelist:001": "5G Wireless",
|
|
||||||
"service:002:property:001:valuelist:002": "2.4G Wireless",
|
|
||||||
"service:002:property:002": "IP Address",
|
|
||||||
"service:002:property:003": "WiFi Network Name",
|
|
||||||
"service:002:property:004": "Current Time",
|
|
||||||
"service:002:property:005": "DHCP Server MAC Address",
|
|
||||||
"service:003": "Indicator Light",
|
|
||||||
"service:003:property:001": "Switch",
|
|
||||||
"service:004": "Virtual Service",
|
|
||||||
"service:004:action:001": "Generate Virtual Event",
|
|
||||||
"service:004:event:001": "Virtual Event Occurred",
|
|
||||||
"service:004:property:001": "Event Name"
|
|
||||||
},
|
|
||||||
"es": {
|
|
||||||
"service:001": "Información del dispositivo",
|
|
||||||
"service:001:property:003": "ID del dispositivo",
|
|
||||||
"service:001:property:005": "Número de serie (SN)",
|
|
||||||
"service:002": "Puerta de enlace",
|
|
||||||
"service:002:event:001": "Cambio de red",
|
|
||||||
"service:002:event:002": "Cambio de red",
|
|
||||||
"service:002:property:001": "Método de acceso",
|
|
||||||
"service:002:property:001:valuelist:000": "Cableado",
|
|
||||||
"service:002:property:001:valuelist:001": "5G inalámbrico",
|
|
||||||
"service:002:property:001:valuelist:002": "2.4G inalámbrico",
|
|
||||||
"service:002:property:002": "Dirección IP",
|
|
||||||
"service:002:property:003": "Nombre de red WiFi",
|
|
||||||
"service:002:property:004": "Hora actual",
|
|
||||||
"service:002:property:005": "Dirección MAC del servidor DHCP",
|
|
||||||
"service:003": "Luz indicadora",
|
|
||||||
"service:003:property:001": "Interruptor",
|
|
||||||
"service:004": "Servicio virtual",
|
|
||||||
"service:004:action:001": "Generar evento virtual",
|
|
||||||
"service:004:event:001": "Ocurrió un evento virtual",
|
|
||||||
"service:004:property:001": "Nombre del evento"
|
|
||||||
},
|
|
||||||
"fr": {
|
|
||||||
"service:001": "Informations sur l'appareil",
|
|
||||||
"service:001:property:003": "ID de l'appareil",
|
|
||||||
"service:001:property:005": "Numéro de série (SN)",
|
|
||||||
"service:002": "Passerelle",
|
|
||||||
"service:002:event:001": "Changement de réseau",
|
|
||||||
"service:002:event:002": "Changement de réseau",
|
|
||||||
"service:002:property:001": "Méthode d'accès",
|
|
||||||
"service:002:property:001:valuelist:000": "Câblé",
|
|
||||||
"service:002:property:001:valuelist:001": "Sans fil 5G",
|
|
||||||
"service:002:property:001:valuelist:002": "Sans fil 2.4G",
|
|
||||||
"service:002:property:002": "Adresse IP",
|
|
||||||
"service:002:property:003": "Nom du réseau WiFi",
|
|
||||||
"service:002:property:004": "Heure actuelle",
|
|
||||||
"service:002:property:005": "Adresse MAC du serveur DHCP",
|
|
||||||
"service:003": "Voyant lumineux",
|
|
||||||
"service:003:property:001": "Interrupteur",
|
|
||||||
"service:004": "Service virtuel",
|
|
||||||
"service:004:action:001": "Générer un événement virtuel",
|
|
||||||
"service:004:event:001": "Événement virtuel survenu",
|
|
||||||
"service:004:property:001": "Nom de l'événement"
|
|
||||||
},
|
|
||||||
"ja": {
|
|
||||||
"service:001": "デバイス情報",
|
|
||||||
"service:001:property:003": "デバイスID",
|
|
||||||
"service:001:property:005": "シリアル番号 (SN)",
|
|
||||||
"service:002": "ゲートウェイ",
|
|
||||||
"service:002:event:001": "ネットワークが変更されました",
|
|
||||||
"service:002:event:002": "ネットワークが変更されました",
|
|
||||||
"service:002:property:001": "アクセス方法",
|
|
||||||
"service:002:property:001:valuelist:000": "有線",
|
|
||||||
"service:002:property:001:valuelist:001": "5G ワイヤレス",
|
|
||||||
"service:002:property:001:valuelist:002": "2.4G ワイヤレス",
|
|
||||||
"service:002:property:002": "IPアドレス",
|
|
||||||
"service:002:property:003": "WiFiネットワーク名",
|
|
||||||
"service:002:property:004": "現在の時間",
|
|
||||||
"service:002:property:005": "DHCPサーバーMACアドレス",
|
|
||||||
"service:003": "インジケータライト",
|
|
||||||
"service:003:property:001": "スイッチ",
|
|
||||||
"service:004": "バーチャルサービス",
|
|
||||||
"service:004:action:001": "バーチャルイベントを生成",
|
|
||||||
"service:004:event:001": "バーチャルイベントが発生しました",
|
|
||||||
"service:004:property:001": "イベント名"
|
|
||||||
},
|
|
||||||
"ru": {
|
|
||||||
"service:001": "Информация об устройстве",
|
|
||||||
"service:001:property:003": "ID устройства",
|
|
||||||
"service:001:property:005": "Серийный номер (SN)",
|
|
||||||
"service:002": "Шлюз",
|
|
||||||
"service:002:event:001": "Сеть изменена",
|
|
||||||
"service:002:event:002": "Сеть изменена",
|
|
||||||
"service:002:property:001": "Метод доступа",
|
|
||||||
"service:002:property:001:valuelist:000": "Проводной",
|
|
||||||
"service:002:property:001:valuelist:001": "5G Беспроводной",
|
|
||||||
"service:002:property:001:valuelist:002": "2.4G Беспроводной",
|
|
||||||
"service:002:property:002": "IP Адрес",
|
|
||||||
"service:002:property:003": "Название WiFi сети",
|
|
||||||
"service:002:property:004": "Текущее время",
|
|
||||||
"service:002:property:005": "MAC адрес DHCP сервера",
|
|
||||||
"service:003": "Световой индикатор",
|
|
||||||
"service:003:property:001": "Переключатель",
|
|
||||||
"service:004": "Виртуальная служба",
|
|
||||||
"service:004:action:001": "Создать виртуальное событие",
|
|
||||||
"service:004:event:001": "Произошло виртуальное событие",
|
|
||||||
"service:004:property:001": "Название события"
|
|
||||||
},
|
|
||||||
"zh-Hant": {
|
|
||||||
"service:001": "設備信息",
|
|
||||||
"service:001:property:003": "設備ID",
|
|
||||||
"service:001:property:005": "序號 (SN)",
|
|
||||||
"service:002": "網關",
|
|
||||||
"service:002:event:001": "網路發生變化",
|
|
||||||
"service:002:event:002": "網路發生變化",
|
|
||||||
"service:002:property:001": "接入方式",
|
|
||||||
"service:002:property:001:valuelist:000": "有線",
|
|
||||||
"service:002:property:001:valuelist:001": "5G 無線",
|
|
||||||
"service:002:property:001:valuelist:002": "2.4G 無線",
|
|
||||||
"service:002:property:002": "IP地址",
|
|
||||||
"service:002:property:003": "WiFi網路名稱",
|
|
||||||
"service:002:property:004": "當前時間",
|
|
||||||
"service:002:property:005": "DHCP伺服器MAC地址",
|
|
||||||
"service:003": "指示燈",
|
|
||||||
"service:003:property:001": "開關",
|
|
||||||
"service:004": "虛擬服務",
|
|
||||||
"service:004:action:001": "產生虛擬事件",
|
|
||||||
"service:004:event:001": "虛擬事件發生",
|
|
||||||
"service:004:property:001": "事件名稱"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"urn:miot-spec-v2:device:lock:0000A038:loock-t2pv1": {
|
|
||||||
"zh-Hans": {
|
|
||||||
"service:003:property:1021:valuelist:000": "已上锁",
|
|
||||||
"service:003:property:1021:valuelist:001": "已上锁(童锁)",
|
|
||||||
"service:003:property:1021:valuelist:002": "已上锁(反锁)",
|
|
||||||
"service:003:property:1021:valuelist:003": "已上锁(反锁+童锁)",
|
|
||||||
"service:003:property:1021:valuelist:004": "已开锁",
|
|
||||||
"service:003:property:1021:valuelist:008": "门未关(门超时未关)",
|
|
||||||
"service:003:property:1021:valuelist:012": "门虚掩"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"urn:miot-spec-v2:device:plant-monitor:0000A030:hhcc-v1": {
|
|
||||||
"en": {
|
|
||||||
"service:002:property:001": "Soil Moisture"
|
|
||||||
},
|
|
||||||
"zh-Hans": {
|
|
||||||
"service:002:property:001": "土壤湿度",
|
|
||||||
"service:002:property:003": "光照强度"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"urn:miot-spec-v2:device:switch:0000A003:lumi-acn040": {
|
|
||||||
"en": {
|
|
||||||
"service:011": "Right Button On and Off",
|
|
||||||
"service:011:property:001": "Right Button On and Off",
|
|
||||||
"service:015:action:001": "Left Button Identify",
|
|
||||||
"service:016:action:001": "Middle Button Identify",
|
|
||||||
"service:017:action:001": "Right Button Identify"
|
|
||||||
},
|
|
||||||
"zh-Hans": {
|
|
||||||
"service:015:action:001": "左键确认",
|
|
||||||
"service:016:action:001": "中键确认",
|
|
||||||
"service:017:action:001": "右键确认"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,45 +18,5 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"urn:miot-spec-v2:device:water-heater:0000A02A:xiaomi-yms2:1": [
|
|
||||||
{
|
|
||||||
"iid": 2,
|
|
||||||
"type": "urn:miot-spec-v2:service:switch:0000780C:xiaomi-yms2:1",
|
|
||||||
"description": "Switch",
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"iid": 6,
|
|
||||||
"type": "urn:miot-spec-v2:property:on:00000006:xiaomi-yms2:1",
|
|
||||||
"description": "Switch Status",
|
|
||||||
"format": "bool",
|
|
||||||
"access": [
|
|
||||||
"read",
|
|
||||||
"write",
|
|
||||||
"notify"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"urn:miot-spec-v2:device:water-heater:0000A02A:zimi-h03:1": [
|
|
||||||
{
|
|
||||||
"iid": 2,
|
|
||||||
"type": "urn:miot-spec-v2:service:switch:0000780C:zimi-h03:1",
|
|
||||||
"description": "Switch",
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"iid": 6,
|
|
||||||
"type": "urn:miot-spec-v2:property:on:00000006:zimi-h03:1",
|
|
||||||
"description": "Switch Status",
|
|
||||||
"format": "bool",
|
|
||||||
"access": [
|
|
||||||
"read",
|
|
||||||
"write",
|
|
||||||
"notify"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1,6 +1,3 @@
|
|||||||
urn:miot-spec-v2:device:air-condition-outlet:0000A045:lumi-mcn04:1:
|
|
||||||
prop.3.4:
|
|
||||||
format: uint8
|
|
||||||
urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-m9:1: urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-m9:6
|
urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-m9:1: urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-m9:6
|
||||||
urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-m9:2: urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-m9:6
|
urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-m9:2: urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-m9:6
|
||||||
urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-m9:3: urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-m9:6
|
urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-m9:3: urn:miot-spec-v2:device:air-conditioner:0000A004:xiaomi-m9:6
|
||||||
@ -50,20 +47,11 @@ urn:miot-spec-v2:device:bath-heater:0000A028:opple-acmoto:1:
|
|||||||
urn:miot-spec-v2:device:bath-heater:0000A028:xiaomi-s1:1:
|
urn:miot-spec-v2:device:bath-heater:0000A028:xiaomi-s1:1:
|
||||||
prop.4.4:
|
prop.4.4:
|
||||||
name: fan-level-ventilation
|
name: fan-level-ventilation
|
||||||
urn:miot-spec-v2:device:fan:0000A005:dmaker-p5:1:
|
|
||||||
prop.2.4:
|
|
||||||
name: fan-level-a
|
|
||||||
urn:miot-spec-v2:device:fan:0000A005:xiaomi-p51:1:
|
urn:miot-spec-v2:device:fan:0000A005:xiaomi-p51:1:
|
||||||
prop.2.2:
|
prop.2.2:
|
||||||
name: fan-level-a
|
name: fan-level-a
|
||||||
urn:miot-spec-v2:device:fan:0000A005:zhimi-sa1:3:
|
|
||||||
prop.2.2:
|
|
||||||
name: fan-level-a
|
|
||||||
urn:miot-spec-v2:device:fan:0000A005:zhimi-v3:3:
|
urn:miot-spec-v2:device:fan:0000A005:zhimi-v3:3:
|
||||||
prop.2.2:
|
prop.2.6:
|
||||||
name: fan-level-a
|
|
||||||
urn:miot-spec-v2:device:fan:0000A005:zhimi-za4:3:
|
|
||||||
prop.2.2:
|
|
||||||
name: fan-level-a
|
name: fan-level-a
|
||||||
urn:miot-spec-v2:device:gateway:0000A019:lumi-mcn001:1:
|
urn:miot-spec-v2:device:gateway:0000A019:lumi-mcn001:1:
|
||||||
prop.2.1:
|
prop.2.1:
|
||||||
@ -96,16 +84,10 @@ urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:1:
|
|||||||
- notify
|
- notify
|
||||||
urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:2: urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:1
|
urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:2: urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:1
|
||||||
urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:3: urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:1
|
urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:3: urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1:1
|
||||||
urn:miot-spec-v2:device:kettle:0000A009:yunmi-r3:1:
|
|
||||||
prop.3.1:
|
|
||||||
unit: ppm
|
|
||||||
urn:miot-spec-v2:device:light:0000A001:shhf-sfla10:1:
|
|
||||||
prop.8.9:
|
|
||||||
name: wind-reverse
|
|
||||||
urn:miot-spec-v2:device:light:0000A001:shhf-sfla12:1:
|
urn:miot-spec-v2:device:light:0000A001:shhf-sfla12:1:
|
||||||
prop.8.11:
|
prop.8.11:
|
||||||
name: on-a
|
name: on-a
|
||||||
urn:miot-spec-v2:device:magnet-sensor:0000A016:linp-m1:1:
|
urn:miot-spec-v2:device:magnet-sensor:0000A016:linp-m1:1: # linp.magnet.m1
|
||||||
prop.2.1004:
|
prop.2.1004:
|
||||||
name: contact-state
|
name: contact-state
|
||||||
expr: src_value!=1
|
expr: src_value!=1
|
||||||
@ -130,10 +112,6 @@ urn:miot-spec-v2:device:outlet:0000A002:cuco-cp1md:1:
|
|||||||
prop.2.2:
|
prop.2.2:
|
||||||
name: power-consumption
|
name: power-consumption
|
||||||
expr: round(src_value/1000, 3)
|
expr: round(src_value/1000, 3)
|
||||||
prop.2.3:
|
|
||||||
expr: round(src_value/10, 1)
|
|
||||||
prop.2.4:
|
|
||||||
unit: mA
|
|
||||||
urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:1: urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:2
|
urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:1: urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:2
|
||||||
urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:2:
|
urn:miot-spec-v2:device:outlet:0000A002:cuco-cp2:2:
|
||||||
prop.2.3:
|
prop.2.3:
|
||||||
@ -147,15 +125,11 @@ urn:miot-spec-v2:device:outlet:0000A002:cuco-v3:1:
|
|||||||
name: power-consumption
|
name: power-consumption
|
||||||
expr: round(src_value/100, 2)
|
expr: round(src_value/100, 2)
|
||||||
urn:miot-spec-v2:device:outlet:0000A002:cuco-v3:2: urn:miot-spec-v2:device:outlet:0000A002:cuco-v3:1
|
urn:miot-spec-v2:device:outlet:0000A002:cuco-v3:2: urn:miot-spec-v2:device:outlet:0000A002:cuco-v3:1
|
||||||
urn:miot-spec-v2:device:outlet:0000A002:giot-v8icm:1:0000C816:
|
|
||||||
prop.4.1:
|
|
||||||
unit: mWh
|
|
||||||
urn:miot-spec-v2:device:outlet:0000A002:qmi-psv3:1:0000C816:
|
urn:miot-spec-v2:device:outlet:0000A002:qmi-psv3:1:0000C816:
|
||||||
prop.3.3:
|
prop.3.3:
|
||||||
unit: mV
|
unit: mV
|
||||||
prop.3.4:
|
prop.3.4:
|
||||||
unit: mA
|
unit: mA
|
||||||
urn:miot-spec-v2:device:outlet:0000A002:zimi-zncz01:1:0000C816: urn:miot-spec-v2:device:outlet:0000A002:zimi-zncz01:2:0000C816
|
|
||||||
urn:miot-spec-v2:device:outlet:0000A002:zimi-zncz01:2:0000C816:
|
urn:miot-spec-v2:device:outlet:0000A002:zimi-zncz01:2:0000C816:
|
||||||
prop.3.1:
|
prop.3.1:
|
||||||
name: electric-power
|
name: electric-power
|
||||||
@ -180,17 +154,10 @@ urn:miot-spec-v2:device:router:0000A036:xiaomi-rd08:1:
|
|||||||
name: upload-speed
|
name: upload-speed
|
||||||
icon: mdi:upload
|
icon: mdi:upload
|
||||||
unit: B/s
|
unit: B/s
|
||||||
urn:miot-spec-v2:device:safe-box:0000A042:loock-v1:1:
|
urn:miot-spec-v2:device:safe-box:0000A042:loock-v1:1: # loock.safe.v1
|
||||||
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:switch:0000A003:lxzn-cbcsmj:1:0000D00D:
|
|
||||||
prop.3.1:
|
|
||||||
expr: round(src_value/100, 2)
|
|
||||||
prop.3.2:
|
|
||||||
expr: round(src_value/1000, 2)
|
|
||||||
prop.3.3:
|
|
||||||
expr: round(src_value/10, 1)
|
|
||||||
urn:miot-spec-v2:device:thermostat:0000A031:suittc-wk168:1:
|
urn:miot-spec-v2:device:thermostat:0000A031:suittc-wk168:1:
|
||||||
prop.2.3:
|
prop.2.3:
|
||||||
value-list:
|
value-list:
|
||||||
|
@ -389,7 +389,6 @@ SPEC_SERVICE_TRANS_MAP: dict = {
|
|||||||
'fan-control': 'fan',
|
'fan-control': 'fan',
|
||||||
'ceiling-fan': 'fan',
|
'ceiling-fan': 'fan',
|
||||||
'air-fresh': 'fan',
|
'air-fresh': 'fan',
|
||||||
'air-purifier': 'fan',
|
|
||||||
'water-heater': {
|
'water-heater': {
|
||||||
'required': {
|
'required': {
|
||||||
'properties': {
|
'properties': {
|
||||||
@ -397,7 +396,7 @@ SPEC_SERVICE_TRANS_MAP: dict = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'optional': {
|
'optional': {
|
||||||
'properties': {'temperature', 'target-temperature', 'mode'}
|
'properties': {'on', 'temperature', 'target-temperature', 'mode'}
|
||||||
},
|
},
|
||||||
'entity': 'water_heater'
|
'entity': 'water_heater'
|
||||||
},
|
},
|
||||||
|
@ -52,22 +52,25 @@ from typing import Any, Optional
|
|||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.components.water_heater import (STATE_ON, STATE_OFF,
|
from homeassistant.components.water_heater import (
|
||||||
ATTR_TEMPERATURE,
|
STATE_ON,
|
||||||
WaterHeaterEntity,
|
STATE_OFF,
|
||||||
WaterHeaterEntityFeature)
|
ATTR_TEMPERATURE,
|
||||||
|
WaterHeaterEntity,
|
||||||
|
WaterHeaterEntityFeature
|
||||||
|
)
|
||||||
|
|
||||||
from .miot.const import DOMAIN
|
from .miot.const import DOMAIN
|
||||||
from .miot.miot_device import MIoTDevice, MIoTEntityData, MIoTServiceEntity
|
from .miot.miot_device import MIoTDevice, MIoTEntityData, MIoTServiceEntity
|
||||||
from .miot.miot_spec import MIoTSpecProperty
|
from .miot.miot_spec import MIoTSpecProperty
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
config_entry: ConfigEntry,
|
config_entry: ConfigEntry,
|
||||||
async_add_entities: AddEntitiesCallback,
|
async_add_entities: AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up a config entry."""
|
"""Set up a config entry."""
|
||||||
device_list: list[MIoTDevice] = hass.data[DOMAIN]['devices'][
|
device_list: list[MIoTDevice] = hass.data[DOMAIN]['devices'][
|
||||||
@ -76,8 +79,8 @@ async def async_setup_entry(
|
|||||||
new_entities = []
|
new_entities = []
|
||||||
for miot_device in device_list:
|
for miot_device in device_list:
|
||||||
for data in miot_device.entity_list.get('water_heater', []):
|
for data in miot_device.entity_list.get('water_heater', []):
|
||||||
new_entities.append(
|
new_entities.append(WaterHeater(
|
||||||
WaterHeater(miot_device=miot_device, entity_data=data))
|
miot_device=miot_device, entity_data=data))
|
||||||
|
|
||||||
if new_entities:
|
if new_entities:
|
||||||
async_add_entities(new_entities)
|
async_add_entities(new_entities)
|
||||||
@ -92,11 +95,12 @@ class WaterHeater(MIoTServiceEntity, WaterHeaterEntity):
|
|||||||
|
|
||||||
_mode_map: Optional[dict[Any, Any]]
|
_mode_map: Optional[dict[Any, Any]]
|
||||||
|
|
||||||
def __init__(self, miot_device: MIoTDevice,
|
def __init__(
|
||||||
entity_data: MIoTEntityData) -> None:
|
self, miot_device: MIoTDevice, entity_data: MIoTEntityData
|
||||||
|
) -> None:
|
||||||
"""Initialize the Water heater."""
|
"""Initialize the Water heater."""
|
||||||
super().__init__(miot_device=miot_device, entity_data=entity_data)
|
super().__init__(miot_device=miot_device, entity_data=entity_data)
|
||||||
self._attr_temperature_unit = None
|
self._attr_temperature_unit = None # type: ignore
|
||||||
self._attr_supported_features = WaterHeaterEntityFeature(0)
|
self._attr_supported_features = WaterHeaterEntityFeature(0)
|
||||||
self._prop_on = None
|
self._prop_on = None
|
||||||
self._prop_temp = None
|
self._prop_temp = None
|
||||||
@ -113,11 +117,14 @@ class WaterHeater(MIoTServiceEntity, WaterHeaterEntity):
|
|||||||
# temperature
|
# temperature
|
||||||
if prop.name == 'temperature':
|
if prop.name == 'temperature':
|
||||||
if not prop.value_range:
|
if not prop.value_range:
|
||||||
_LOGGER.error('invalid temperature value_range format, %s',
|
_LOGGER.error(
|
||||||
self.entity_id)
|
'invalid temperature value_range format, %s',
|
||||||
|
self.entity_id)
|
||||||
continue
|
continue
|
||||||
if prop.external_unit:
|
if prop.external_unit:
|
||||||
self._attr_temperature_unit = prop.external_unit
|
self._attr_temperature_unit = prop.external_unit
|
||||||
|
self._attr_min_temp = prop.value_range.min_
|
||||||
|
self._attr_max_temp = prop.value_range.max_
|
||||||
self._prop_temp = prop
|
self._prop_temp = prop
|
||||||
# target-temperature
|
# target-temperature
|
||||||
if prop.name == 'target-temperature':
|
if prop.name == 'target-temperature':
|
||||||
@ -126,9 +133,9 @@ class WaterHeater(MIoTServiceEntity, WaterHeaterEntity):
|
|||||||
'invalid target-temperature value_range format, %s',
|
'invalid target-temperature value_range format, %s',
|
||||||
self.entity_id)
|
self.entity_id)
|
||||||
continue
|
continue
|
||||||
self._attr_min_temp = prop.value_range.min_
|
self._attr_target_temperature_low = prop.value_range.min_
|
||||||
self._attr_max_temp = prop.value_range.max_
|
self._attr_target_temperature_high = prop.value_range.max_
|
||||||
self._attr_target_temperature_step = prop.value_range.step
|
self._attr_precision = prop.value_range.step
|
||||||
if self._attr_temperature_unit is None and prop.external_unit:
|
if self._attr_temperature_unit is None and prop.external_unit:
|
||||||
self._attr_temperature_unit = prop.external_unit
|
self._attr_temperature_unit = prop.external_unit
|
||||||
self._attr_supported_features |= (
|
self._attr_supported_features |= (
|
||||||
@ -137,7 +144,8 @@ class WaterHeater(MIoTServiceEntity, WaterHeaterEntity):
|
|||||||
# mode
|
# mode
|
||||||
if prop.name == 'mode':
|
if prop.name == 'mode':
|
||||||
if not prop.value_list:
|
if not prop.value_list:
|
||||||
_LOGGER.error('mode value_list is None, %s', self.entity_id)
|
_LOGGER.error(
|
||||||
|
'mode value_list is None, %s', self.entity_id)
|
||||||
continue
|
continue
|
||||||
self._mode_map = prop.value_list.to_map()
|
self._mode_map = prop.value_list.to_map()
|
||||||
self._attr_operation_list = list(self._mode_map.values())
|
self._attr_operation_list = list(self._mode_map.values())
|
||||||
@ -157,12 +165,16 @@ class WaterHeater(MIoTServiceEntity, WaterHeaterEntity):
|
|||||||
await self.set_property_async(prop=self._prop_on, value=False)
|
await self.set_property_async(prop=self._prop_on, value=False)
|
||||||
|
|
||||||
async def async_set_temperature(self, **kwargs: Any) -> None:
|
async def async_set_temperature(self, **kwargs: Any) -> None:
|
||||||
"""Set the target temperature."""
|
"""Set the temperature the water heater should heat water to."""
|
||||||
await self.set_property_async(prop=self._prop_target_temp,
|
if not self._prop_target_temp:
|
||||||
value=kwargs[ATTR_TEMPERATURE])
|
return
|
||||||
|
await self.set_property_async(
|
||||||
|
prop=self._prop_target_temp, value=kwargs[ATTR_TEMPERATURE])
|
||||||
|
|
||||||
async def async_set_operation_mode(self, operation_mode: str) -> None:
|
async def async_set_operation_mode(self, operation_mode: str) -> None:
|
||||||
"""Set the operation mode of the water heater."""
|
"""Set the operation mode of the water heater.
|
||||||
|
Must be in the operation_list.
|
||||||
|
"""
|
||||||
if operation_mode == STATE_OFF:
|
if operation_mode == STATE_OFF:
|
||||||
await self.set_property_async(prop=self._prop_on, value=False)
|
await self.set_property_async(prop=self._prop_on, value=False)
|
||||||
return
|
return
|
||||||
@ -170,32 +182,32 @@ class WaterHeater(MIoTServiceEntity, WaterHeaterEntity):
|
|||||||
await self.set_property_async(prop=self._prop_on, value=True)
|
await self.set_property_async(prop=self._prop_on, value=True)
|
||||||
return
|
return
|
||||||
if self.get_prop_value(prop=self._prop_on) is False:
|
if self.get_prop_value(prop=self._prop_on) is False:
|
||||||
await self.set_property_async(prop=self._prop_on,
|
await self.set_property_async(
|
||||||
value=True,
|
prop=self._prop_on, value=True, write_ha_state=False)
|
||||||
write_ha_state=False)
|
await self.set_property_async(
|
||||||
await self.set_property_async(prop=self._prop_mode,
|
prop=self._prop_mode,
|
||||||
value=self.get_map_key(
|
value=self.get_map_key(
|
||||||
map_=self._mode_map,
|
map_=self._mode_map, value=operation_mode))
|
||||||
value=operation_mode))
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_temperature(self) -> Optional[float]:
|
def current_temperature(self) -> Optional[float]:
|
||||||
"""The current temperature."""
|
"""Return the current temperature."""
|
||||||
return (None if self._prop_temp is None else self.get_prop_value(
|
return self.get_prop_value(prop=self._prop_temp)
|
||||||
prop=self._prop_temp))
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def target_temperature(self) -> Optional[float]:
|
def target_temperature(self) -> Optional[float]:
|
||||||
"""The target temperature."""
|
"""Return the target temperature."""
|
||||||
return (None if self._prop_target_temp is None else self.get_prop_value(
|
if not self._prop_target_temp:
|
||||||
prop=self._prop_target_temp))
|
return None
|
||||||
|
return self.get_prop_value(prop=self._prop_target_temp)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_operation(self) -> Optional[str]:
|
def current_operation(self) -> Optional[str]:
|
||||||
"""The current mode."""
|
"""Return the current mode."""
|
||||||
if self.get_prop_value(prop=self._prop_on) is False:
|
if self.get_prop_value(prop=self._prop_on) is False:
|
||||||
return STATE_OFF
|
return STATE_OFF
|
||||||
if not self._prop_mode and self.get_prop_value(prop=self._prop_on):
|
if not self._prop_mode and self.get_prop_value(prop=self._prop_on):
|
||||||
return STATE_ON
|
return STATE_ON
|
||||||
return self.get_map_value(map_=self._mode_map,
|
return self.get_map_value(
|
||||||
key=self.get_prop_value(prop=self._prop_mode))
|
map_=self._mode_map,
|
||||||
|
key=self.get_prop_value(prop=self._prop_mode))
|
||||||
|
@ -33,11 +33,9 @@ git checkout v1.0.0
|
|||||||
|
|
||||||
### 方法 2: [HACS](https://hacs.xyz/)
|
### 方法 2: [HACS](https://hacs.xyz/)
|
||||||
|
|
||||||
一键从 HACS 安装米家集成:
|
HACS > 右上角三个点 > Custom repositories > Repository: https://github.com/XiaoMi/ha_xiaomi_home.git & Category or Type: Integration > ADD > 点击 HACS 的 New 或 Available for download 分类下的 Xiaomi Home ,进入集成详情页 > DOWNLOAD
|
||||||
|
|
||||||
[](https://my.home-assistant.io/redirect/hacs_repository/?owner=XiaoMi&repository=ha_xiaomi_home&category=integration)
|
> 米家集成暂未添加到 HACS 商店,敬请期待。
|
||||||
|
|
||||||
或者,HACS > 在搜索框中输入 **Xiaomi Home** > 点击 **Xiaomi Home** ,进入集成详情页 > DOWNLOAD
|
|
||||||
|
|
||||||
### 方法 3:通过 [Samba](https://github.com/home-assistant/addons/tree/master/samba) 或 [FTPS](https://github.com/hassio-addons/addon-ftp) 手动安装
|
### 方法 3:通过 [Samba](https://github.com/home-assistant/addons/tree/master/samba) 或 [FTPS](https://github.com/hassio-addons/addon-ftp) 手动安装
|
||||||
|
|
||||||
@ -49,7 +47,7 @@ git checkout v1.0.0
|
|||||||
|
|
||||||
[设置 > 设备与服务 > 添加集成](https://my.home-assistant.io/redirect/brand/?brand=xiaomi_home) > 搜索“`Xiaomi Home`” > 下一步 > 请点击此处进行登录 > 使用小米账号登录
|
[设置 > 设备与服务 > 添加集成](https://my.home-assistant.io/redirect/brand/?brand=xiaomi_home) > 搜索“`Xiaomi Home`” > 下一步 > 请点击此处进行登录 > 使用小米账号登录
|
||||||
|
|
||||||
[](https://my.home-assistant.io/redirect/config_flow_start/?domain=xiaomi_home)
|
[](https://my.home-assistant.io/redirect/config_flow_start/?domain=xiaomi_home)
|
||||||
|
|
||||||
### 添加 MIoT 设备
|
### 添加 MIoT 设备
|
||||||
|
|
||||||
@ -61,7 +59,7 @@ git checkout v1.0.0
|
|||||||
|
|
||||||
方法:[设置 > 设备与服务 > 已配置 > Xiaomi Home](https://my.home-assistant.io/redirect/integration/?domain=xiaomi_home) > 添加中枢 > 下一步 > 请点击此处进行登录 > 使用小米账号登录
|
方法:[设置 > 设备与服务 > 已配置 > Xiaomi Home](https://my.home-assistant.io/redirect/integration/?domain=xiaomi_home) > 添加中枢 > 下一步 > 请点击此处进行登录 > 使用小米账号登录
|
||||||
|
|
||||||
[](https://my.home-assistant.io/redirect/integration/?domain=xiaomi_home)
|
[](https://my.home-assistant.io/redirect/integration/?domain=xiaomi_home)
|
||||||
|
|
||||||
### 修改配置项
|
### 修改配置项
|
||||||
|
|
||||||
@ -355,7 +353,7 @@ instance code 为 MIoT-Spec-V2 实例代码,格式如下:
|
|||||||
```
|
```
|
||||||
service:<siid> # 服务
|
service:<siid> # 服务
|
||||||
service:<siid>:property:<piid> # 属性
|
service:<siid>:property:<piid> # 属性
|
||||||
service:<siid>:property:<piid>:valuelist:<value> # 属性取值列表的索引值
|
service:<siid>:property:<piid>:valuelist:<value> # 属性取值列表的值
|
||||||
service:<siid>:event:<eiid> # 事件
|
service:<siid>:event:<eiid> # 事件
|
||||||
service:<siid>:action:<aiid> # 方法
|
service:<siid>:action:<aiid> # 方法
|
||||||
```
|
```
|
||||||
|
@ -18,8 +18,6 @@ SPEC_BOOL_TRANS_FILE = path.join(
|
|||||||
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/bool_trans.yaml')
|
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/bool_trans.yaml')
|
||||||
SPEC_FILTER_FILE = path.join(
|
SPEC_FILTER_FILE = path.join(
|
||||||
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/spec_filter.yaml')
|
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/spec_filter.yaml')
|
||||||
SPEC_MULTI_LANG_FILE = path.join(
|
|
||||||
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/multi_lang.json')
|
|
||||||
SPEC_ADD_FILE = path.join(
|
SPEC_ADD_FILE = path.join(
|
||||||
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/spec_add.json')
|
ROOT_PATH, '../custom_components/xiaomi_home/miot/specs/spec_add.json')
|
||||||
SPEC_MODIFY_FILE = path.join(
|
SPEC_MODIFY_FILE = path.join(
|
||||||
@ -40,7 +38,7 @@ def load_json_file(file_path: str) -> Optional[dict]:
|
|||||||
|
|
||||||
def save_json_file(file_path: str, data: dict) -> None:
|
def save_json_file(file_path: str, data: dict) -> None:
|
||||||
with open(file_path, 'w', encoding='utf-8') as file:
|
with open(file_path, 'w', encoding='utf-8') as file:
|
||||||
json.dump(data, file, ensure_ascii=False, indent=2)
|
json.dump(data, file, ensure_ascii=False, indent=4)
|
||||||
|
|
||||||
|
|
||||||
def load_yaml_file(file_path: str) -> Optional[dict]:
|
def load_yaml_file(file_path: str) -> Optional[dict]:
|
||||||
@ -142,14 +140,6 @@ def bool_trans(d: dict) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def multi_lang(data: dict) -> bool:
|
|
||||||
"""dict[str, dict[str, dict[str, str]]]"""
|
|
||||||
for key in data.keys():
|
|
||||||
if key.count(':') != 5:
|
|
||||||
return False
|
|
||||||
return nested_3_dict_str_str(data)
|
|
||||||
|
|
||||||
|
|
||||||
def spec_add(data: dict) -> bool:
|
def spec_add(data: dict) -> bool:
|
||||||
"""dict[str, list[dict[str, int| str | list]]]"""
|
"""dict[str, list[dict[str, int| str | list]]]"""
|
||||||
if not isinstance(data, dict):
|
if not isinstance(data, dict):
|
||||||
@ -314,10 +304,6 @@ def sort_spec_add(file_path: str):
|
|||||||
return dict(sorted(filter_data.items()))
|
return dict(sorted(filter_data.items()))
|
||||||
|
|
||||||
|
|
||||||
def sort_multi_lang(file_path: str):
|
|
||||||
return sort_spec_add(file_path)
|
|
||||||
|
|
||||||
|
|
||||||
def sort_spec_modify(file_path: str):
|
def sort_spec_modify(file_path: str):
|
||||||
filter_data = load_yaml_file(file_path=file_path)
|
filter_data = load_yaml_file(file_path=file_path)
|
||||||
assert isinstance(filter_data, dict), f'{file_path} format error'
|
assert isinstance(filter_data, dict), f'{file_path} format error'
|
||||||
@ -340,14 +326,6 @@ def test_spec_filter():
|
|||||||
assert spec_filter(data), f'{SPEC_FILTER_FILE} format error'
|
assert spec_filter(data), f'{SPEC_FILTER_FILE} format error'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.github
|
|
||||||
def test_multi_lang():
|
|
||||||
data = load_json_file(SPEC_MULTI_LANG_FILE)
|
|
||||||
assert isinstance(data, dict)
|
|
||||||
assert data, f'load {SPEC_MULTI_LANG_FILE} failed'
|
|
||||||
assert multi_lang(data), f'{SPEC_MULTI_LANG_FILE} format error'
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.github
|
@pytest.mark.github
|
||||||
def test_spec_add():
|
def test_spec_add():
|
||||||
data = load_json_file(SPEC_ADD_FILE)
|
data = load_json_file(SPEC_ADD_FILE)
|
||||||
@ -440,12 +418,6 @@ def test_miot_data_sort():
|
|||||||
f'{SPEC_FILTER_FILE} not sorted, goto project root path'
|
f'{SPEC_FILTER_FILE} not sorted, goto project root path'
|
||||||
' and run the following command sorting, ',
|
' and run the following command sorting, ',
|
||||||
'pytest -s -v -m update ./test/check_rule_format.py')
|
'pytest -s -v -m update ./test/check_rule_format.py')
|
||||||
assert json.dumps(
|
|
||||||
load_json_file(file_path=SPEC_MULTI_LANG_FILE)) == json.dumps(
|
|
||||||
sort_multi_lang(file_path=SPEC_MULTI_LANG_FILE)), (
|
|
||||||
f'{SPEC_MULTI_LANG_FILE} not sorted, goto project root path'
|
|
||||||
' and run the following command sorting, ',
|
|
||||||
'pytest -s -v -m update ./test/check_rule_format.py')
|
|
||||||
assert json.dumps(load_json_file(file_path=SPEC_ADD_FILE)) == json.dumps(
|
assert json.dumps(load_json_file(file_path=SPEC_ADD_FILE)) == json.dumps(
|
||||||
sort_spec_add(file_path=SPEC_ADD_FILE)), (
|
sort_spec_add(file_path=SPEC_ADD_FILE)), (
|
||||||
f'{SPEC_ADD_FILE} not sorted, goto project root path'
|
f'{SPEC_ADD_FILE} not sorted, goto project root path'
|
||||||
@ -466,8 +438,6 @@ def test_sort_spec_data():
|
|||||||
sort_data = sort_spec_filter(file_path=SPEC_FILTER_FILE)
|
sort_data = sort_spec_filter(file_path=SPEC_FILTER_FILE)
|
||||||
save_yaml_file(file_path=SPEC_FILTER_FILE, data=sort_data)
|
save_yaml_file(file_path=SPEC_FILTER_FILE, data=sort_data)
|
||||||
_LOGGER.info('%s formatted.', SPEC_FILTER_FILE)
|
_LOGGER.info('%s formatted.', SPEC_FILTER_FILE)
|
||||||
sort_data = sort_multi_lang(file_path=SPEC_MULTI_LANG_FILE)
|
|
||||||
save_json_file(file_path=SPEC_MULTI_LANG_FILE, data=sort_data)
|
|
||||||
sort_data = sort_spec_add(file_path=SPEC_ADD_FILE)
|
sort_data = sort_spec_add(file_path=SPEC_ADD_FILE)
|
||||||
save_json_file(file_path=SPEC_ADD_FILE, data=sort_data)
|
save_json_file(file_path=SPEC_ADD_FILE, data=sort_data)
|
||||||
_LOGGER.info('%s formatted.', SPEC_ADD_FILE)
|
_LOGGER.info('%s formatted.', SPEC_ADD_FILE)
|
||||||
|
Reference in New Issue
Block a user