Implement capability attributes (#30545)

* Implement capability attributes

* Fix HeOS update order

* Fix test
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2020-01-08 21:22:56 +01:00
1 parent 4cd83e71dd
commit ed6aef2fd7
6 files changed
+58 -14

No files matched your search

+12 -1
View File
@@ -246,6 +246,12 @@ class VacuumDevice(_BaseVacuum, ToggleEntity):
battery_level=self.battery_level, charging=charging
)
@property
def capability_attributes(self):
"""Return capabilitiy attributes."""
if self.fan_speed is not None:
return {ATTR_FAN_SPEED_LIST: self.fan_speed_list}
@property
def state_attributes(self):
"""Return the state attributes of the vacuum cleaner."""
@@ -260,7 +266,6 @@ class VacuumDevice(_BaseVacuum, ToggleEntity):
if self.fan_speed is not None:
data[ATTR_FAN_SPEED] = self.fan_speed
data[ATTR_FAN_SPEED_LIST] = self.fan_speed_list
return data
@@ -323,6 +328,12 @@ class StateVacuumDevice(_BaseVacuum):
battery_level=self.battery_level, charging=charging
)
@property
def capability_attributes(self):
"""Return capabilitiy attributes."""
if self.fan_speed is not None:
return {ATTR_FAN_SPEED_LIST: self.fan_speed_list}
@property
def state_attributes(self):
"""Return the state attributes of the vacuum cleaner."""