Освещение¶
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.
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).
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.
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
to_sber_current_state
¶
Build Sber current state payload with all light attributes.
Includes online, on_off, brightness, color/color_temp, and light_mode depending on the current state and color mode.
Per Sber C2C specification, integer_value is serialized as a string.
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dict mapping entity_id to its Sber state representation. |
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 |