mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-06-21 14:20:17 +08:00
feat: add device with motor-control service as cover entity (#688)
This commit is contained in:
@ -1198,6 +1198,13 @@ class _SpecModify:
|
||||
return None
|
||||
return access
|
||||
|
||||
def get_prop_value_range(self, siid: int, piid: int) -> Optional[list]:
|
||||
value_range = self.__get_prop_item(siid=siid, piid=piid,
|
||||
key='value-range')
|
||||
if not isinstance(value_range, list):
|
||||
return None
|
||||
return value_range
|
||||
|
||||
def __get_prop_item(self, siid: int, piid: int, key: str) -> Optional[str]:
|
||||
if not self._selected:
|
||||
return None
|
||||
@ -1474,6 +1481,10 @@ class MIoTSpecParser:
|
||||
siid=service['iid'], piid=property_['iid'])
|
||||
if custom_access:
|
||||
spec_prop.access = custom_access
|
||||
custom_range = self._spec_modify.get_prop_value_range(
|
||||
siid=service['iid'], piid=property_['iid'])
|
||||
if custom_range:
|
||||
spec_prop.value_range = custom_range
|
||||
# Parse service event
|
||||
for event in service.get('events', []):
|
||||
if (
|
||||
|
@ -42,3 +42,10 @@ urn:miot-spec-v2:device:router:0000A036:xiaomi-rd08:1:
|
||||
name: upload-speed
|
||||
icon: mdi:upload
|
||||
unit: B/s
|
||||
urn:miot-spec-v2:device:airer:0000A00D:hyd-znlyj5:1:
|
||||
prop.2.3:
|
||||
value-range:
|
||||
- 0
|
||||
- 1
|
||||
- 1
|
||||
urn:miot-spec-v2:device:airer:0000A00D:hyd-znlyj5:2: urn:miot-spec-v2:device:airer:0000A00D:hyd-znlyj5:1
|
||||
|
@ -373,7 +373,9 @@ SPEC_SERVICE_TRANS_MAP: dict = {
|
||||
},
|
||||
'entity': 'cover'
|
||||
},
|
||||
'window-opener': 'curtain'
|
||||
'window-opener': 'curtain',
|
||||
'motor-controller': 'curtain',
|
||||
'airer': 'curtain'
|
||||
}
|
||||
|
||||
"""SPEC_PROP_TRANS_MAP
|
||||
|
Reference in New Issue
Block a user