1 """Lutron fan platform."""
3 from __future__
import annotations
8 from pylutron
import Output
15 from .
import DOMAIN, LutronData
16 from .entity
import LutronDevice
18 _LOGGER = logging.getLogger(__name__)
23 config_entry: ConfigEntry,
24 async_add_entities: AddEntitiesCallback,
26 """Set up the Lutron fan platform.
28 Adds fan controls from the Main Repeater associated with the config_entry as
31 entry_data: LutronData = hass.data[DOMAIN][config_entry.entry_id]
34 LutronFan(area_name, device, entry_data.client)
35 for area_name, device
in entry_data.fans
42 """Representation of a Lutron fan."""
45 _attr_should_poll =
False
47 _attr_supported_features = (
48 FanEntityFeature.SET_SPEED
49 | FanEntityFeature.TURN_OFF
50 | FanEntityFeature.TURN_ON
52 _lutron_device: Output
53 _prev_percentage: int |
None =
None
54 _enable_turn_on_off_backwards_compatibility =
False
57 """Set the speed of the fan, as a percentage."""
65 percentage: int |
None =
None,
66 preset_mode: str |
None =
None,
69 """Turn the fan on."""
70 new_percentage: int |
None =
None
72 if percentage
is not None:
73 new_percentage = percentage
82 """Turn the fan off."""
86 """Request the state from the device."""
90 """Update the state attributes."""
None set_percentage(self, int percentage)
None turn_off(self, **Any kwargs)
None set_percentage(self, int percentage)
None turn_on(self, int|None percentage=None, str|None preset_mode=None, **Any kwargs)
None _request_state(self)
None schedule_update_ha_state(self, bool force_refresh=False)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)