1 """Support for EnOcean light sources."""
3 from __future__
import annotations
8 from enocean.utils
import combine_hex
9 import voluptuous
as vol
13 PLATFORM_SCHEMA
as LIGHT_PLATFORM_SCHEMA,
23 from .entity
import EnOceanEntity
25 CONF_SENDER_ID =
"sender_id"
27 DEFAULT_NAME =
"EnOcean Light"
29 PLATFORM_SCHEMA = LIGHT_PLATFORM_SCHEMA.extend(
31 vol.Optional(CONF_ID, default=[]): vol.All(cv.ensure_list, [vol.Coerce(int)]),
32 vol.Required(CONF_SENDER_ID): vol.All(cv.ensure_list, [vol.Coerce(int)]),
33 vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
41 add_entities: AddEntitiesCallback,
42 discovery_info: DiscoveryInfoType |
None =
None,
44 """Set up the EnOcean light platform."""
45 sender_id: list[int] = config[CONF_SENDER_ID]
46 dev_name: str = config[CONF_NAME]
47 dev_id: list[int] = config[CONF_ID]
53 """Representation of an EnOcean light source."""
55 _attr_color_mode = ColorMode.BRIGHTNESS
56 _attr_supported_color_modes = {ColorMode.BRIGHTNESS}
60 def __init__(self, sender_id: list[int], dev_id: list[int], dev_name: str) ->
None:
61 """Initialize the EnOcean light source."""
68 """Turn the light source on or sets a specific dimmer value."""
69 if (brightness := kwargs.get(ATTR_BRIGHTNESS))
is not None:
75 command = [0xA5, 0x02, bval, 0x01, 0x09]
77 command.extend([0x00])
82 """Turn the light source off."""
83 command = [0xA5, 0x02, 0x00, 0x01, 0x09]
85 command.extend([0x00])
90 """Update the internal state of this device.
92 Dimmer devices like Eltako FUD61 send telegram in different RORGs.
93 We only care about the 4BS (0xA5).
95 if packet.data[0] == 0xA5
and packet.data[1] == 0x02:
def send_command(self, data, optional, packet_type)
None turn_off(self, **Any kwargs)
None __init__(self, list[int] sender_id, list[int] dev_id, str dev_name)
def value_changed(self, packet)
None turn_on(self, **Any kwargs)
None schedule_update_ha_state(self, bool force_refresh=False)
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)