1 """Support for INSTEON fans via PowerLinc Modem."""
3 from __future__
import annotations
15 percentage_to_ranged_value,
16 ranged_value_to_percentage,
19 from .const
import SIGNAL_ADD_ENTITIES
20 from .entity
import InsteonEntity
21 from .utils
import async_add_insteon_devices, async_add_insteon_entities
23 SPEED_RANGE = (1, 255)
28 config_entry: ConfigEntry,
29 async_add_entities: AddEntitiesCallback,
31 """Set up the Insteon fans from a config entry."""
34 def async_add_insteon_fan_entities(discovery_info=None):
35 """Add the Insteon entities for the platform."""
37 hass, Platform.FAN, InsteonFanEntity, async_add_entities, discovery_info
40 signal = f
"{SIGNAL_ADD_ENTITIES}_{Platform.FAN}"
51 """An INSTEON fan entity."""
53 _attr_supported_features = (
54 FanEntityFeature.SET_SPEED
55 | FanEntityFeature.TURN_OFF
56 | FanEntityFeature.TURN_ON
59 _enable_turn_on_off_backwards_compatibility =
False
63 """Return the current speed percentage."""
70 percentage: int |
None =
None,
71 preset_mode: str |
None =
None,
74 """Turn on the fan."""
78 """Turn off the fan."""
82 """Set the speed percentage of the fan."""
87 await self.
_insteon_device_insteon_device.async_on(group=2, on_level=on_level)
None async_set_percentage(self, int percentage)
int|None percentage(self)
None async_set_percentage(self, int percentage)
None async_turn_off(self, **Any kwargs)
None async_turn_on(self, int|None percentage=None, str|None preset_mode=None, **Any kwargs)
None async_turn_off(self, **Any kwargs)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
None async_add_insteon_devices(HomeAssistant hass, Platform platform, type[InsteonEntity] entity_type, AddEntitiesCallback async_add_entities)
None async_add_insteon_entities(HomeAssistant hass, Platform platform, type[InsteonEntity] entity_type, AddEntitiesCallback async_add_entities, dict[str, Any] discovery_info)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)
float percentage_to_ranged_value(tuple[float, float] low_high_range, float percentage)
int ranged_value_to_percentage(tuple[float, float] low_high_range, float value)