1 """Support for Tellstick lights."""
3 from __future__
import annotations
12 ATTR_DISCOVER_DEVICES,
14 DEFAULT_SIGNAL_REPETITIONS,
16 from .entity
import TellstickDevice
22 add_entities: AddEntitiesCallback,
23 discovery_info: DiscoveryInfoType |
None =
None,
25 """Set up the Tellstick lights."""
26 if discovery_info
is None or discovery_info[ATTR_DISCOVER_DEVICES]
is None:
29 signal_repetitions = discovery_info.get(
30 ATTR_DISCOVER_CONFIG, DEFAULT_SIGNAL_REPETITIONS
35 TellstickLight(hass.data[DATA_TELLSTICK][tellcore_id], signal_repetitions)
36 for tellcore_id
in discovery_info[ATTR_DISCOVER_DEVICES]
43 """Representation of a Tellstick light."""
45 _attr_color_mode = ColorMode.BRIGHTNESS
46 _attr_supported_color_modes = {ColorMode.BRIGHTNESS}
48 def __init__(self, tellcore_device, signal_repetitions):
49 """Initialize the Tellstick light."""
50 super().
__init__(tellcore_device, signal_repetitions)
56 """Return the brightness of this light between 0..255."""
60 """Turn the value from HA into something useful."""
61 return kwargs.get(ATTR_BRIGHTNESS)
64 """Turn the value received from tellcore into something useful."""
66 return int(tellcore_data)
70 """Update the device entity state to match the arguments."""
72 if (brightness := data)
is not None:
78 except AttributeError:
84 """Let tellcore update the actual device to the requested state."""
86 if requested_data
is not None:
def turn_off(self, **kwargs)
def _parse_ha_data(self, kwargs)
def __init__(self, tellcore_device, signal_repetitions)
def _parse_tellcore_data(self, tellcore_data)
def _update_model(self, new_state, data)
def _send_device_command(self, requested_state, requested_data)
None add_entities(AsusWrtRouter router, AddEntitiesCallback async_add_entities, set[str] tracked)
None setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)