3 from __future__
import annotations
5 from dataclasses
import dataclass
6 from typing
import TYPE_CHECKING, Final
8 from aioshelly.const
import RPC_GENERATIONS
11 DOMAIN
as TEXT_PLATFORM,
13 TextEntityDescription,
18 from .coordinator
import ShellyConfigEntry
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 text entity."""
36 RPC_TEXT_ENTITIES: Final = {
47 config_entry: ShellyConfigEntry,
48 async_add_entities: AddEntitiesCallback,
50 """Set up sensors for device."""
52 coordinator = config_entry.runtime_data.rpc
56 hass, config_entry, async_add_entities, RPC_TEXT_ENTITIES, RpcText
62 coordinator.device.config, TEXT_PLATFORM
66 config_entry.entry_id,
75 """Represent a RPC text entity."""
77 entity_description: RpcTextDescription
81 """Return value of sensor."""
88 """Change the value."""
89 await self.
call_rpccall_rpc(
"Text.Set", {
"id": self.
_id_id,
"value": value})
StateType attribute_value(self)
Any call_rpc(self, str method, Any params)
str|None native_value(self)
None async_set_value(self, str value)
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)