mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-10-19 03:15:42 +08:00
feat: remove VacuumEntityFeature.BATTERY from the vacuum entity (#1433)
Some checks failed
Some checks failed
This commit is contained in:
@@ -167,11 +167,6 @@ SPEC_DEVICE_TRANS_MAP: dict = {
|
||||
},
|
||||
'battery': {
|
||||
'required': {
|
||||
'properties': {
|
||||
'battery-level': {'read'}
|
||||
}
|
||||
},
|
||||
'optional': {
|
||||
'actions': {
|
||||
'start-charge'
|
||||
}
|
||||
|
@@ -90,7 +90,6 @@ 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]]
|
||||
@@ -117,7 +116,6 @@ 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 = []
|
||||
@@ -180,9 +178,6 @@ 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':
|
||||
@@ -251,11 +246,6 @@ 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."""
|
||||
|
Reference in New Issue
Block a user