1 """Support for Lutron switches."""
3 from __future__
import annotations
5 from collections.abc
import Mapping
8 from pylutron
import Button, Keypad, Led, Lutron, Output
15 from .
import DOMAIN, LutronData
16 from .entity
import LutronDevice, LutronKeypad
21 config_entry: ConfigEntry,
22 async_add_entities: AddEntitiesCallback,
24 """Set up the Lutron switch platform.
26 Adds switches from the Main Repeater associated with the config_entry as
29 entry_data: LutronData = hass.data[DOMAIN][config_entry.entry_id]
30 entities: list[SwitchEntity] = []
33 for area_name, device
in entry_data.switches:
34 entities.append(
LutronSwitch(area_name, device, entry_data.client))
37 for area_name, keypad, scene, led
in entry_data.scenes:
39 entities.append(
LutronLed(area_name, keypad, scene, led, entry_data.client))
44 """Representation of a Lutron Switch."""
46 _lutron_device: Output
50 """Turn the switch on."""
54 """Turn the switch off."""
59 """Return the state attributes."""
60 return {
"lutron_integration_id": self.
_lutron_device_lutron_device.id}
63 """Request the state from the device."""
67 """Update the state attributes."""
72 """Representation of a Lutron Keypad LED."""
84 """Initialize the switch."""
85 super().
__init__(area_name, led_device, controller, keypad)
90 """Turn the LED on."""
94 """Turn the LED off."""
99 """Return the state attributes."""
107 """Request the state from the device."""
111 """Update the state attributes."""
None _request_state(self)
Mapping[str, Any]|None extra_state_attributes(self)
None turn_off(self, **Any kwargs)
None __init__(self, str area_name, Keypad keypad, Button scene_device, Led led_device, Lutron controller)
None turn_on(self, **Any kwargs)
None turn_off(self, **Any kwargs)
Mapping[str, Any]|None extra_state_attributes(self)
None _request_state(self)
None turn_on(self, **Any kwargs)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)