Медиа¶
TVEntity¶
Телевизор: управление питанием, громкостью, каналами, источником.
Sber TV entity -- maps HA media_player entities to Sber tv category.
Supports on/off, volume, mute, source selection, channel switching, navigation direction, and custom key commands.
SOURCE_VALUES
module-attribute
¶
Every input Sber's source function documents.
hdmi1…hdmi3, tv, av, content, screencast plus the
relative + / -. Home Assistant names the same inputs in prose
("HDMI 1", "Станция"), so the two are reconciled through
:mod:.utils.enum_matcher rather than published as-is.
TvEntity
¶
Bases: BaseEntity
Sber TV entity for television and media player devices.
Maps HA media_player entities to the Sber 'tv' category with support for:
- On/off control
- Volume level (Sber 0-100 integer, HA 0.0-1.0 float)
- Mute toggle
- Source (input) selection, translated between HA's prose input
names and Sber's closed source vocabulary (:data:SOURCE_VALUES)
- Channel switching (+/-)
- Navigation direction (up/down/left/right/ok)
Command handlers address the entity in its own HA domain
(:meth:get_entity_domain) rather than a hard-coded media_player:
tv is an overridable category, so a switch.tv_power promoted
to tv by a user type override would otherwise be driven with
media_player.turn_on — a call HA cannot route, silently dropping
every Sber command. For a media_player.* entity — the only domain
the category maps to by itself — the emitted calls are unchanged.
Initialize TV 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/tv.py
fill_by_ha_state
¶
Parse HA state and update TV attributes.
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/tv.py
create_allowed_values_list
¶
Build allowed values map for TV features.
Per Sber TV reference, only source needs explicit allowed_values
(instance-specific source list). All other TV features (volume_int,
channel, direction, etc.) use Sber cloud defaults and MUST NOT be
overridden — sending extra keys causes silent device rejection.
The declared values are the Sber ones this TV can actually reach
(hdmi1, tv, …), never the HA input names: the app renders
exactly what is declared and then sends it back as a command, so a
label outside :data:SOURCE_VALUES would be a control that cannot
work.
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dict mapping feature key to its allowed values descriptor. |
Source code in custom_components/sber_mqtt_bridge/devices/tv.py
IntercomEntity¶
Домофон.
Sber Intercom entity -- minimal implementation for intercom devices.
Available only via type override (sber_category: intercom). Supports on/off control and read-only call/unlock features from HA attributes.
INTERCOM_CATEGORY
module-attribute
¶
Sber device category for intercom entities.
IntercomEntity
¶
Bases: OnOffEntity
Sber intercom entity for door intercom devices.
Maps to the Sber 'intercom' category. Available only via type override since there is no standard HA intercom domain.
Supports: - On/off control (inherited from OnOffEntity) - Read-only features from HA attributes: incoming_call, reject_call, unlock
Initialize intercom 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/intercom.py
fill_by_ha_state
¶
Parse HA state and update intercom attributes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha_state
|
dict
|
HA state dict with 'state' and 'attributes' keys. |
required |