Implement percentage step sizes for fans (#46512)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
5df46b60e8
commit
f2b303d509
24 changed files with 447 additions and 3 deletions
|
@ -215,6 +215,11 @@ class DemoPercentageFan(BaseDemoFan, FanEntity):
|
|||
"""Return the current speed."""
|
||||
return self._percentage
|
||||
|
||||
@property
|
||||
def speed_count(self) -> Optional[float]:
|
||||
"""Return the number of speeds the fan supports."""
|
||||
return 3
|
||||
|
||||
def set_percentage(self, percentage: int) -> None:
|
||||
"""Set the speed of the fan, as a percentage."""
|
||||
self._percentage = percentage
|
||||
|
@ -270,6 +275,11 @@ class AsyncDemoPercentageFan(BaseDemoFan, FanEntity):
|
|||
"""Return the current speed."""
|
||||
return self._percentage
|
||||
|
||||
@property
|
||||
def speed_count(self) -> Optional[float]:
|
||||
"""Return the number of speeds the fan supports."""
|
||||
return 3
|
||||
|
||||
async def async_set_percentage(self, percentage: int) -> None:
|
||||
"""Set the speed of the fan, as a percentage."""
|
||||
self._percentage = percentage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue