Освещение¶
LightEntity¶
Управление освещением: яркость, цвет (HSV), цветовая температура.
Sber Light entity — maps HA light to Sber light category.
Supports brightness, color temperature, RGB color (HSV), and light mode. Uses LinearConverter for value range mapping and ColorConverter for HSV.
LIGHT_ENTITY_CATEGORY
module-attribute
¶
Sber device category for light entities.
COLOR_MODES
module-attribute
¶
HA color modes that map to Sber colour features.
NON_DIMMABLE_MODES
module-attribute
¶
HA color modes that do NOT imply brightness support.
Per HA light architecture, every color mode except onoff and
unknown supports brightness — including color_temp and white
(issue #44: CCT-only lamps must expose light_brightness).
LightEntity
¶
Bases: BaseEntity
Sber light entity with brightness, color, and color temperature support.
Maps HA light entities to the Sber 'light' category with support for: - On/off control - Brightness (scaled 0-255 HA ↔ 100-900 Sber) - Color temperature (mireds ↔ 0-1000 Sber, reversed) - RGB color via HSV conversion - Light mode (white / colour)
Accepts battery / battery_low / signal_strength linked sensors via
:attr:LINKABLE_ROLES (Zigbee lights commonly report these).
Command handlers address the entity in its own HA domain
(:meth:get_entity_domain) rather than a hard-coded light, so an
entity forced into light / led_strip by a user type override
is driven through services that actually exist for it. For a
light.* entity — the only domain these categories map to — the
emitted calls are unchanged.
Initialize light entity from HA entity data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha_entity_data
|
dict
|
HA entity registry dict. |
required |
Source code in custom_components/sber_mqtt_bridge/devices/light.py
fill_by_ha_state
¶
Parse HA state and update all light attributes.
Simple attribute extraction is handled declaratively via
:attr:ATTR_SPECS. Instance-specific LinearConverter transforms
and state derivation remain here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha_state
|
dict
|
HA state dict with 'state' and 'attributes' keys. |
required |
Source code in custom_components/sber_mqtt_bridge/devices/light.py
create_allowed_values_list
¶
Build allowed values map for light features.
Built from the final features list (with user overrides
applied) rather than from capability heuristics, so a feature
added via extra_features always gets its limits — without
them Sber renders a dead slider (issue #44).
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dict mapping feature key to its allowed values descriptor. |
Source code in custom_components/sber_mqtt_bridge/devices/light.py
create_dependencies
¶
Return light_colour → light_mode dependency when both features exist.
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dependencies dict for Sber model descriptor. |
Source code in custom_components/sber_mqtt_bridge/devices/light.py
LedStripEntity¶
Светодиодная лента с поддержкой цвета и эффектов.
Sber LED Strip entity -- maps HA light entities to Sber led_strip category.
Identical to light in features and behavior, but uses the led_strip
Sber category for LED strip devices.
LED_STRIP_CATEGORY
module-attribute
¶
Sber device category for LED strip entities.
LedStripEntity
¶
Bases: LightEntity
Sber LED strip entity.
Inherits all light behavior (on/off, brightness, color, color temperature) but registers under the Sber 'led_strip' category.
Initialize LED strip entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_data
|
dict
|
HA entity registry dict containing entity metadata. |
required |