Add short-hand attributes to vacuum (#69417)

This commit is contained in:
epenet 2022-04-26 18:30:20 +02:00 committed by GitHub
parent 90ef6e209c
commit 173a11893a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -176,30 +176,36 @@ class _BaseVacuum(Entity):
Contains common properties and functions for all vacuum devices. Contains common properties and functions for all vacuum devices.
""" """
_attr_battery_icon: str
_attr_battery_level: int | None = None
_attr_fan_speed: str | None = None
_attr_fan_speed_list: list[str]
_attr_supported_features: int
@property @property
def supported_features(self) -> int: def supported_features(self) -> int:
"""Flag vacuum cleaner features that are supported.""" """Flag vacuum cleaner features that are supported."""
raise NotImplementedError() return self._attr_supported_features
@property @property
def battery_level(self) -> int | None: def battery_level(self) -> int | None:
"""Return the battery level of the vacuum cleaner.""" """Return the battery level of the vacuum cleaner."""
return None return self._attr_battery_level
@property @property
def battery_icon(self) -> str: def battery_icon(self) -> str:
"""Return the battery icon for the vacuum cleaner.""" """Return the battery icon for the vacuum cleaner."""
raise NotImplementedError() return self._attr_battery_icon
@property @property
def fan_speed(self) -> str | None: def fan_speed(self) -> str | None:
"""Return the fan speed of the vacuum cleaner.""" """Return the fan speed of the vacuum cleaner."""
return None return self._attr_fan_speed
@property @property
def fan_speed_list(self) -> list[str]: def fan_speed_list(self) -> list[str]:
"""Get the list of available fan speed steps of the vacuum cleaner.""" """Get the list of available fan speed steps of the vacuum cleaner."""
raise NotImplementedError() return self._attr_fan_speed_list
@property @property
def capability_attributes(self) -> Mapping[str, Any] | None: def capability_attributes(self) -> Mapping[str, Any] | None: