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
|
@ -13,6 +13,7 @@ from pycomfoconnect import (
|
|||
from homeassistant.components.fan import SUPPORT_SET_SPEED, FanEntity
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.util.percentage import (
|
||||
int_states_in_range,
|
||||
percentage_to_ranged_value,
|
||||
ranged_value_to_percentage,
|
||||
)
|
||||
|
@ -101,6 +102,11 @@ class ComfoConnectFan(FanEntity):
|
|||
return None
|
||||
return ranged_value_to_percentage(SPEED_RANGE, speed)
|
||||
|
||||
@property
|
||||
def speed_count(self) -> int:
|
||||
"""Return the number of speeds the fan supports."""
|
||||
return int_states_in_range(SPEED_RANGE)
|
||||
|
||||
def turn_on(
|
||||
self, speed: str = None, percentage=None, preset_mode=None, **kwargs
|
||||
) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue