1 """Select platform for the jvc_projector integration."""
3 from __future__
import annotations
5 from collections.abc
import Awaitable, Callable
6 from dataclasses
import dataclass
7 from typing
import Final
9 from jvcprojector
import JvcProjector, const
15 from .
import JVCConfigEntry, JvcProjectorDataUpdateCoordinator
16 from .entity
import JvcProjectorEntity
19 @dataclass(frozen=True, kw_only=True)
21 """Describes JVC Projector select entities."""
23 command: Callable[[JvcProjector, str], Awaitable[
None]]
26 OPTIONS: Final[dict[str, dict[str, str]]] = {
27 "input": {const.HDMI1: const.REMOTE_HDMI_1, const.HDMI2: const.REMOTE_HDMI_2}
30 SELECTS: Final[list[JvcProjectorSelectDescription]] = [
33 translation_key=
"input",
34 options=
list(OPTIONS[
"input"]),
35 command=
lambda device, option: device.remote(OPTIONS[
"input"][option]),
42 entry: JVCConfigEntry,
43 async_add_entities: AddEntitiesCallback,
45 """Set up the JVC Projector platform from a config entry."""
46 coordinator = entry.runtime_data
54 """Representation of a JVC Projector select entity."""
56 entity_description: JvcProjectorSelectDescription
60 coordinator: JvcProjectorDataUpdateCoordinator,
61 description: JvcProjectorSelectDescription,
63 """Initialize the entity."""
70 """Return the selected entity option to represent the entity state."""
74 """Change the selected option."""
75 await self.
entity_descriptionentity_description.command(self.coordinator.device, option)
str|None current_option(self)
None __init__(self, JvcProjectorDataUpdateCoordinator coordinator, JvcProjectorSelectDescription description)
None async_select_option(self, str option)
None async_setup_entry(HomeAssistant hass, JVCConfigEntry entry, AddEntitiesCallback async_add_entities)