Медиа¶
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.
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 - Channel switching (+/-) - Navigation direction (up/down/left/right/ok)
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_features_list
¶
Return Sber feature list for TV capabilities.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of Sber feature strings supported by this entity. |
Source code in custom_components/sber_mqtt_bridge/devices/tv.py
create_allowed_values_list
¶
Build allowed values map for volume and source 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/tv.py
to_sber_current_state
¶
Build Sber current state payload with TV attributes.
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dict mapping entity_id to its Sber state representation. |
Source code in custom_components/sber_mqtt_bridge/devices/tv.py
process_cmd
¶
Process Sber TV commands and produce HA service calls.
Handles the following Sber keys:
- on_off: media_player.turn_on / media_player.turn_off
- volume_int: media_player.volume_set (Sber 0-100 → HA 0.0-1.0)
- mute: media_player.volume_mute
- source: media_player.select_source
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cmd_data
|
dict
|
Sber command dict with 'states' list. |
required |
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of HA service call dicts to execute. |
Source code in custom_components/sber_mqtt_bridge/devices/tv.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | |
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 |
Source code in custom_components/sber_mqtt_bridge/devices/intercom.py
create_features_list
¶
Return Sber feature list for intercom capabilities.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of Sber feature strings supported by this entity. |
Source code in custom_components/sber_mqtt_bridge/devices/intercom.py
to_sber_current_state
¶
Build Sber current state payload with intercom attributes.
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dict mapping entity_id to its Sber state representation. |
Source code in custom_components/sber_mqtt_bridge/devices/intercom.py
process_cmd
¶
Process Sber intercom commands and produce HA service calls.
Handles on_off key for turn_on/turn_off. Other features
(incoming_call, reject_call, unlock) are read-only.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cmd_data
|
dict
|
Sber command dict with 'states' list. |
required |
Returns:
| Type | Description |
|---|---|
list[dict]
|
List of HA service call dicts to execute. |