1 """Select for Shelly."""
3 from __future__
import annotations
5 from dataclasses
import dataclass
6 from typing
import Final
8 from aioshelly.const
import RPC_GENERATIONS
11 DOMAIN
as SELECT_PLATFORM,
13 SelectEntityDescription,
18 from .coordinator
import ShellyConfigEntry, ShellyRpcCoordinator
21 ShellyRpcAttributeEntity,
22 async_setup_entry_rpc,
25 async_remove_orphaned_entities,
27 get_virtual_component_ids,
31 @dataclass(frozen=True, kw_only=True)
33 """Class to describe a RPC select entity."""
36 RPC_SELECT_ENTITIES: Final = {
47 config_entry: ShellyConfigEntry,
48 async_add_entities: AddEntitiesCallback,
50 """Set up selectors for device."""
52 coordinator = config_entry.runtime_data.rpc
56 hass, config_entry, async_add_entities, RPC_SELECT_ENTITIES, RpcSelect
62 coordinator.device.config, SELECT_PLATFORM
66 config_entry.entry_id,
75 """Represent a RPC select entity."""
77 entity_description: RpcSelectDescription
81 coordinator: ShellyRpcCoordinator,
84 description: RpcSelectDescription,
86 """Initialize select."""
87 super().
__init__(coordinator, key, attribute, description)
93 """Return the selected entity option to represent the entity state."""
100 """Change the value."""
StateType attribute_value(self)
Any call_rpc(self, str method, Any params)
None async_select_option(self, str option)
None __init__(self, ShellyRpcCoordinator coordinator, str key, str attribute, RpcSelectDescription description)
str|None current_option(self)
None async_setup_entry_rpc(HomeAssistant hass, ShellyConfigEntry config_entry, AddEntitiesCallback async_add_entities, Mapping[str, RpcEntityDescription] sensors, Callable sensor_class)
None async_setup_entry(HomeAssistant hass, ShellyConfigEntry config_entry, AddEntitiesCallback async_add_entities)
list[str] get_virtual_component_ids(dict[str, Any] config, str platform)
None async_remove_orphaned_entities(HomeAssistant hass, str config_entry_id, str mac, str platform, Iterable[str] keys, str|None key_suffix=None)
int get_device_entry_gen(ConfigEntry entry)