Compare commits

..

1 Commits

Author SHA1 Message Date
ohyeah521
0a6831a257
Merge 1258d3f3d3 into ec833b6539 2025-09-10 06:05:49 +00:00
2 changed files with 15 additions and 0 deletions

View File

@ -167,6 +167,11 @@ SPEC_DEVICE_TRANS_MAP: dict = {
},
'battery': {
'required': {
'properties': {
'battery-level': {'read'}
}
},
'optional': {
'actions': {
'start-charge'
}

View File

@ -90,6 +90,7 @@ class Vacuum(MIoTServiceEntity, StateVacuumEntity):
# pylint: disable=unused-argument
_prop_status: Optional[MIoTSpecProperty]
_prop_fan_level: Optional[MIoTSpecProperty]
_prop_battery_level: Optional[MIoTSpecProperty]
_prop_status_cleaning: Optional[list[int]]
_prop_status_docked: Optional[list[int]]
_prop_status_paused: Optional[list[int]]
@ -116,6 +117,7 @@ class Vacuum(MIoTServiceEntity, StateVacuumEntity):
self._prop_status = None
self._prop_fan_level = None
self._prop_battery_level = None
self._prop_status_cleaning = []
self._prop_status_docked = []
self._prop_status_paused = []
@ -178,6 +180,9 @@ class Vacuum(MIoTServiceEntity, StateVacuumEntity):
self._attr_fan_speed_list = list(self._fan_level_map.values())
self._attr_supported_features |= VacuumEntityFeature.FAN_SPEED
self._prop_fan_level = prop
elif prop.name == 'battery-level':
self._attr_supported_features |= VacuumEntityFeature.BATTERY
self._prop_battery_level = prop
# action
for action in entity_data.actions:
if action.name == 'start-sweep':
@ -246,6 +251,11 @@ class Vacuum(MIoTServiceEntity, StateVacuumEntity):
"""Name of the vacuum entity."""
return self._device_name
@property
def battery_level(self) -> Optional[int]:
"""The current battery level of the vacuum cleaner."""
return self.get_prop_value(prop=self._prop_battery_level)
@property
def fan_speed(self) -> Optional[str]:
"""The current fan speed of the vacuum cleaner."""