feat: add motor-controller as cover shutter

This commit is contained in:
LiShuzhen 2025-01-22 14:53:59 +08:00
parent 3a5b641ec7
commit 057b7a4ffb
2 changed files with 5 additions and 2 deletions

View File

@ -82,6 +82,8 @@ async def async_setup_entry(
data.spec.device_class = CoverDeviceClass.CURTAIN
elif data.spec.name == 'window-opener':
data.spec.device_class = CoverDeviceClass.WINDOW
elif data.spec.name == 'motor-controller':
data.spec.device_class = CoverDeviceClass.SHUTTER
new_entities.append(
Cover(miot_device=miot_device, entity_data=data))
@ -145,7 +147,7 @@ class Cover(MIoTServiceEntity, CoverEntity):
self._attr_supported_features |= (
CoverEntityFeature.CLOSE)
self._prop_motor_value_close = item.value
elif item.name in {'pause'}:
elif item.name in {'pause', 'stop'}:
self._attr_supported_features |= (
CoverEntityFeature.STOP)
self._prop_motor_value_pause = item.value

View File

@ -319,7 +319,8 @@ SPEC_SERVICE_TRANS_MAP: dict[str, dict | str] = {
},
'entity': 'cover'
},
'window-opener': 'curtain'
'window-opener': 'curtain',
'motor-controller': 'curtain'
}
"""SPEC_PROP_TRANS_MAP