Compare commits

...

5 Commits

Author SHA1 Message Date
lifetimr
f48c622062
Merge 30a78c7689 into ae047758de 2026-01-04 14:37:46 +08:00
Necroneco
ae047758de
feat: add unit days to xiaomi.toothbrush.p001 (#1588)
Some checks failed
Tests / check-rule-format (push) Has been cancelled
Validate / validate-hassfest (push) Has been cancelled
Validate / validate-hacs (push) Has been cancelled
Validate / validate-lint (push) Has been cancelled
Validate / validate-setup (push) Has been cancelled
2026-01-04 14:08:02 +08:00
lifetimr
30a78c7689
Merge pull request #1 from lifetimr/lifetimr-patch-1
Update cover.py
2025-11-25 22:10:27 +08:00
lifetimr
eec13826d2
Update cover.py 2025-11-25 22:09:41 +08:00
lifetimr
bf1caf50e1
修改cover模块下OPEN/STOP/PAUSE无法正常暴露的问题 2025-11-24 20:52:23 +08:00
2 changed files with 15 additions and 0 deletions

View File

@ -107,6 +107,7 @@ class Cover(MIoTServiceEntity, CoverEntity):
_prop_position_value_range: Optional[int]
_prop_pos_closing: bool
_prop_pos_opening: bool
_reverse_position: bool
def __init__(self, miot_device: MIoTDevice,
entity_data: MIoTEntityData) -> None:
@ -134,6 +135,8 @@ class Cover(MIoTServiceEntity, CoverEntity):
self._prop_position_value_range = None
self._prop_pos_closing = False
self._prop_pos_opening = False
# 新增针对airer类型设备反转位置
self._reverse_position = (entity_data.spec.device_class == CoverDeviceClass.BLIND)
# properties
for prop in entity_data.props:
@ -143,6 +146,8 @@ class Cover(MIoTServiceEntity, CoverEntity):
self.entity_id)
continue
for item in prop.value_list.items:
item_str: str = item.name
item_name: str = re.sub(r'[^a-z]', '', item_str)
if item.name in {'open', 'up'}:
self._attr_supported_features |= (
CoverEntityFeature.OPEN)
@ -255,6 +260,10 @@ class Cover(MIoTServiceEntity, CoverEntity):
if current is not None:
self._prop_pos_opening = pos > current
self._prop_pos_closing = pos < current
# 针对airer类型设备反转位置
if self._reverse_position:
pos = 100 - pos
pos = round(pos * self._prop_position_value_range / 100)
await self.set_property_async(prop=self._prop_target_position,
value=pos)
@ -282,6 +291,9 @@ class Cover(MIoTServiceEntity, CoverEntity):
pos = 0
elif pos >= (100 - self._cover_dead_zone_width):
pos = 100
# 针对airer类型设备反转位置
if self._reverse_position:
pos = 100 - pos
return pos
@property

View File

@ -559,6 +559,9 @@ urn:miot-spec-v2:device:thermostat:0000A031:suittc-wk168:1:
description: '15'
- value: 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:
prop.4.1:
unit: ppm