mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 00:07:10 +00:00
Use shorthand attributes in xiaomi_miio vacuum (#70848)
This commit is contained in:
parent
e6b8843423
commit
052c3fcb6a
@ -227,12 +227,12 @@ class MiroboVacuum(
|
||||
return self._state
|
||||
|
||||
@property
|
||||
def battery_level(self):
|
||||
def battery_level(self) -> int:
|
||||
"""Return the battery level of the vacuum cleaner."""
|
||||
return self.coordinator.data.status.battery
|
||||
|
||||
@property
|
||||
def fan_speed(self):
|
||||
def fan_speed(self) -> str:
|
||||
"""Return the fan speed of the vacuum cleaner."""
|
||||
speed = self.coordinator.data.status.fanspeed
|
||||
if speed in self.coordinator.data.fan_speeds_reverse:
|
||||
@ -240,16 +240,14 @@ class MiroboVacuum(
|
||||
|
||||
_LOGGER.debug("Unable to find reverse for %s", speed)
|
||||
|
||||
return speed
|
||||
return str(speed)
|
||||
|
||||
@property
|
||||
def fan_speed_list(self):
|
||||
def fan_speed_list(self) -> list[str]:
|
||||
"""Get the list of available fan speed steps of the vacuum cleaner."""
|
||||
return (
|
||||
list(self.coordinator.data.fan_speeds)
|
||||
if self.coordinator.data.fan_speeds
|
||||
else []
|
||||
)
|
||||
if speed_list := self.coordinator.data.fan_speeds:
|
||||
return list(speed_list)
|
||||
return []
|
||||
|
||||
@property
|
||||
def timers(self):
|
||||
@ -276,11 +274,6 @@ class MiroboVacuum(
|
||||
attrs[ATTR_TIMERS] = self.timers
|
||||
return attrs
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Flag vacuum cleaner robot features that are supported."""
|
||||
return self._attr_supported_features
|
||||
|
||||
async def _try_command(self, mask_error, func, *args, **kwargs):
|
||||
"""Call a vacuum command handling error messages."""
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user