Реле и розетки¶
RelayEntity¶
Реле: switch, script, button (on/off управление).
Sber Relay entity -- maps HA switch/script/button to Sber relay category.
RELAY_CATEGORY
module-attribute
¶
Sber device category for relay/switch entities.
RelayEntity
¶
RelayEntity(entity_data, category=RELAY_CATEGORY)
Bases: OnOffEntity
Sber relay entity for on/off control devices.
Maps HA switch, script, and button entities to the Sber 'relay' category.
Supports basic on/off toggling via the on_off Sber feature.
Initialize relay entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_data
|
dict
|
HA entity registry dict containing entity metadata. |
required |
category
|
str
|
Sber device category (override in subclasses). |
RELAY_CATEGORY
|
Source code in custom_components/sber_mqtt_bridge/devices/relay.py
SocketEntity¶
Умная розетка.
Sber Socket entity -- maps HA outlet switches to Sber socket category.
SOCKET_CATEGORY
module-attribute
¶
Sber device category for smart socket/outlet entities.
SocketEntity
¶
Bases: RelayEntity
Sber socket entity for smart outlet/plug devices.
Inherits all relay behavior (on/off control) but registers under the Sber 'socket' category instead of 'relay'.
Initialize socket entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_data
|
dict
|
HA entity registry dict containing entity metadata. |
required |
Source code in custom_components/sber_mqtt_bridge/devices/socket_entity.py
ValveEntity¶
Клапан (водоснабжение, газ).
Sber Valve entity -- maps HA valve entities to Sber valve category.
Uses open_set/open_state features (NOT on_off).
Per Sber specification, valve is controlled via ENUM open/close/stop commands.
Supports optional battery and signal strength reporting.
ValveEntity
¶
Bases: BatteryAndSignalLinkMixin, BaseEntity
Sber valve entity for open/close valve control.
Maps HA valve entities to the Sber 'valve' category.
Uses open_set (command) and open_state (state) features
per Sber specification. Does NOT use on_off.
Optionally reports battery_percentage, battery_low_power,
and signal_strength when the HA entity provides these attributes.
Initialize valve entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_data
|
dict
|
HA entity registry dict containing entity metadata. |
required |
Source code in custom_components/sber_mqtt_bridge/devices/valve.py
fill_by_ha_state
¶
Parse HA state and update open/close status, battery, and signal.
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/valve.py
create_allowed_values_list
¶
Return allowed values for the open_set feature.
to_sber_current_state
¶
Build Sber current state payload with online, open_state, battery, and signal.
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dict mapping entity_id to its Sber state representation. |
Source code in custom_components/sber_mqtt_bridge/devices/valve.py
ScenarioButtonEntity¶
Кнопка сценария (input_boolean).
Sber Scenario Button entity -- maps HA input_boolean to Sber scenario_button.
SCENARIO_BUTTON_CATEGORY
module-attribute
¶
Sber device category for scenario button entities.
ScenarioButtonEntity
¶
Bases: BaseEntity
Sber scenario button entity.
Maps HA input_boolean entities to the Sber 'scenario_button' category.
Reports button events (click / double_click) based on the boolean state.
Initialize scenario button entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_data
|
dict
|
HA entity registry dict containing entity metadata. |
required |
Source code in custom_components/sber_mqtt_bridge/devices/scenario_button.py
fill_by_ha_state
¶
Parse HA state and update button event type.
Maps 'on' to 'click' and anything else to 'double_click'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha_state
|
dict
|
HA state dict with 'state' key. |
required |
Source code in custom_components/sber_mqtt_bridge/devices/scenario_button.py
create_allowed_values_list
¶
Return allowed values for button_event feature.
Source code in custom_components/sber_mqtt_bridge/devices/scenario_button.py
to_sber_current_state
¶
Build Sber current state payload with online and button_event keys.
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dict mapping entity_id to its Sber state representation. |