Implement percentage step sizes for fans (#46512)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
J. Nick Koston 2021-02-18 21:05:09 -10:00 committed by GitHub
parent 5df46b60e8
commit f2b303d509
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 447 additions and 3 deletions

View file

@ -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