1 """Support for Dynalite channels as lights."""
10 from .entity
import DynaliteBase, async_setup_entry_base
15 config_entry: ConfigEntry,
16 async_add_entities: AddEntitiesCallback,
18 """Record the async_add_entities function to add them later when received from Dynalite."""
20 hass, config_entry, async_add_entities,
"light", DynaliteLight
25 """Representation of a Dynalite Channel as a Home Assistant Light."""
27 _attr_color_mode = ColorMode.BRIGHTNESS
28 _attr_supported_color_modes = {ColorMode.BRIGHTNESS}
32 """Return the brightness of this light between 0..255."""
33 return self.
_device_device.brightness
37 """Return true if device is on."""
38 return self.
_device_device.is_on
41 """Turn the light on."""
45 """Turn the light off."""
49 """Initialize the state from cache."""
50 target_level = state.attributes.get(ATTR_BRIGHTNESS)
51 if target_level
is not None:
52 self.
_device_device.init_level(target_level)
None async_turn_on(self, **Any kwargs)
None async_turn_off(self, **Any kwargs)
def initialize_state(self, state)
None async_setup_entry_base(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities, str platform, Callable entity_from_device)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)