1 """Support for LiteJet scenes."""
6 from pylitejet
import LiteJet, LiteJetError
15 from .const
import DOMAIN
17 _LOGGER = logging.getLogger(__name__)
19 ATTR_NUMBER =
"number"
24 config_entry: ConfigEntry,
25 async_add_entities: AddEntitiesCallback,
29 system: LiteJet = hass.data[DOMAIN]
32 for i
in system.scenes():
33 name = await system.get_scene_name(i)
34 entities.append(
LiteJetScene(config_entry.entry_id, system, i, name))
40 """Representation of a single LiteJet scene."""
42 _attr_has_entity_name =
True
43 _attr_entity_registry_enabled_default =
False
45 def __init__(self, entry_id: str, system: LiteJet, i: int, name: str) ->
None:
46 """Initialize the scene."""
52 identifiers={(DOMAIN, f
"{entry_id}_mcp")},
54 manufacturer=
"Centralite",
55 model=system.model_name,
59 """Run when this Entity has been added to HA."""
63 """Entity being removed from hass."""
72 """Return the device-specific state attributes."""
73 return {ATTR_NUMBER: self.
_index_index}
76 """Activate the scene."""
78 await self.
_lj_lj.activate_scene(self.
_index_index)
79 except LiteJetError
as exc:
80 raise HomeAssistantError
from exc
None __init__(self, str entry_id, LiteJet system, int i, str name)
dict[str, Any] extra_state_attributes(self)
None async_activate(self, **Any kwargs)
None async_added_to_hass(self)
None async_will_remove_from_hass(self)
None _on_connected_changed(self, bool connected, str reason)
None async_write_ha_state(self)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)