1 """Support for the Dynalite channels and presets as switches."""
11 from .entity
import DynaliteBase, async_setup_entry_base
16 config_entry: ConfigEntry,
17 async_add_entities: AddEntitiesCallback,
19 """Record the async_add_entities function to add them later when received from Dynalite."""
21 hass, config_entry, async_add_entities,
"switch", DynaliteSwitch
26 """Representation of a Dynalite Channel as a Home Assistant Switch."""
30 """Return true if switch is on."""
31 return self.
_device_device.is_on
34 """Turn the switch on."""
38 """Turn the switch off."""
42 """Initialize the state from cache."""
43 target_level = 1
if state.state == STATE_ON
else 0
44 self.
_device_device.init_level(target_level)
None async_turn_off(self, **Any kwargs)
def initialize_state(self, state)
None async_turn_on(self, **Any kwargs)
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)