Климат¶
ClimateEntity (HVAC AC)¶
Кондиционер: температура, режим, скорость вентилятора, свинг.
Sber Climate (AC) entity -- maps HA climate entities to Sber hvac_ac category.
CLIMATE_CATEGORY
module-attribute
¶
Sber device category for air conditioner / HVAC entities.
HA_TO_SBER_WORK_MODE
module-attribute
¶
HA_TO_SBER_WORK_MODE = {'cool': 'cooling', 'heat': 'heating', 'dry': 'dehumidification', 'fan_only': 'ventilation', 'heat_cool': 'auto', 'auto': 'auto', 'eco': 'eco'}
Map HA HVAC modes to Sber work mode enum values.
'off' is excluded — use on_off. Sber also supports 'turbo' and 'quiet' work modes; these are mapped from HA preset_modes (boost→turbo, sleep→quiet) in to_sber_current_state.
SBER_TO_HA_WORK_MODE
module-attribute
¶
SBER_TO_HA_WORK_MODE = {'cooling': 'cool', 'heating': 'heat', 'dehumidification': 'dry', 'ventilation': 'fan_only', 'auto': 'auto', 'eco': 'eco'}
Reverse mapping: Sber work mode → HA hvac_mode.
HA_TO_SBER_SWING
module-attribute
¶
HA_TO_SBER_SWING = {'off': 'no', 'vertical': 'vertical', 'horizontal': 'horizontal', 'both': 'rotation', 'swing': 'swing', 'auto': 'auto'}
Map HA swing modes to Sber air flow direction values.
SBER_TO_HA_SWING
module-attribute
¶
Reverse mapping: Sber swing → HA swing_mode.
HA_TO_SBER_THERMOSTAT_MODE
module-attribute
¶
Map HA HVAC modes to Sber thermostat mode enum values (simpler devices).
SBER_TO_HA_THERMOSTAT_MODE
module-attribute
¶
Reverse mapping: Sber thermostat mode → HA hvac_mode.
HA_TO_SBER_FAN_MODE
module-attribute
¶
HA_TO_SBER_FAN_MODE = {'auto': 'auto', 'low': 'low', 'medium': 'medium', 'mid': 'medium', 'high': 'high', 'turbo': 'turbo', 'quiet': 'quiet', 'silent': 'quiet', 'sleep': 'quiet', 'strong': 'turbo', 'boost': 'turbo', 'max': 'turbo', 'min': 'low', '1': 'quiet', '2': 'low', '3': 'medium', '4': 'high', '5': 'turbo'}
Map HA fan modes to Sber air flow power enum values.
ClimateEntity
¶
ClimateEntity(entity_data, category=CLIMATE_CATEGORY, min_temp=16.0, max_temp=32.0, temp_step=1)
Bases: BaseEntity
Sber climate entity for air conditioner control.
Maps HA climate entities to the Sber 'hvac_ac' category with support for: - On/off control - Temperature reading and target temperature setting - Fan mode, swing mode, and HVAC work mode selection - Allowed values for dynamic enum features
Subclasses override class-level flags to restrict features per Sber spec:
- _supports_fan: include hvac_air_flow_power (default True for AC)
- _supports_swing: include hvac_air_flow_direction (default True for AC)
- _supports_work_mode: include hvac_work_mode (default True for AC)
- _supports_thermostat_mode: include hvac_thermostat_mode (default False)
Initialize climate 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). |
CLIMATE_CATEGORY
|
min_temp
|
float
|
Minimum temperature default. |
16.0
|
max_temp
|
float
|
Maximum temperature default. |
32.0
|
temp_step
|
int
|
Temperature step for allowed_values (Sber spec varies by category). |
1
|
Source code in custom_components/sber_mqtt_bridge/devices/climate.py
fill_by_ha_state
¶
Parse HA state and update all climate attributes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha_state
|
dict
|
HA state dict with 'state' and 'attributes' keys. Attributes may include current_temperature, temperature, fan_modes, swing_modes, hvac_modes, target_humidity, preset_mode, preset_modes, etc. |
required |
Source code in custom_components/sber_mqtt_bridge/devices/climate.py
create_features_list
¶
Return Sber feature list based on available climate capabilities.
Dynamically includes fan, swing, HVAC mode, humidity, and night mode features only when the HA entity supports them.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of Sber feature strings supported by this entity. |
Source code in custom_components/sber_mqtt_bridge/devices/climate.py
create_allowed_values_list
¶
Build allowed values map for enum-based and integer-based 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/climate.py
to_sber_current_state
¶
Build Sber current state payload with all climate attributes.
Includes online, on_off, temperature, target temperature, fan mode, swing mode, HVAC work mode, target humidity, and night mode when values are available.
Per Sber specification:
- temperature uses x10 encoding (e.g. 22.0C -> 220)
- hvac_temp_set uses whole degrees (e.g. 22.0C -> 22)
- All integer_value fields are serialized as strings.
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dict mapping entity_id to its Sber state representation. |
Source code in custom_components/sber_mqtt_bridge/devices/climate.py
process_cmd
¶
Process Sber climate commands and produce HA service calls.
Handles the following Sber keys:
- on_off: turn_on / turn_off
- hvac_temp_set: set_temperature (whole degrees, no scaling)
- hvac_air_flow_power: set_fan_mode
- hvac_air_flow_direction: set_swing_mode
- hvac_work_mode: set_hvac_mode
- hvac_humidity_set: set_humidity (INTEGER 0-100)
- hvac_night_mode: set_preset_mode (sleep/none)
State is NOT mutated here -- it will be updated when HA fires a
state_changed event that is handled by fill_by_ha_state.
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/climate.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | |
HvacRadiatorEntity¶
Радиатор отопления.
Sber HVAC Radiator entity -- maps HA radiator climate entities to Sber hvac_radiator.
HVAC_RADIATOR_CATEGORY
module-attribute
¶
Sber device category for radiator/heater climate entities.
HvacRadiatorEntity
¶
Bases: ClimateEntity
Sber HVAC radiator entity for heating devices.
Inherits climate behavior but registers under the Sber 'hvac_radiator' category with radiator-appropriate temperature defaults (25-40 C).
Per Sber spec, radiators only support: on_off, online, temperature, hvac_temp_set. Fan, swing, and work mode features are disabled.
Initialize HVAC radiator 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/hvac_radiator.py
HvacBoilerEntity¶
Бойлер/котёл.
Sber HVAC Boiler entity -- maps HA water heater climate entities to Sber hvac_boiler.
HVAC_BOILER_CATEGORY
module-attribute
¶
Sber device category for boiler/water heater entities.
HvacBoilerEntity
¶
Bases: ClimateEntity
Sber HVAC boiler entity for water heater devices.
Inherits climate behavior but registers under the Sber 'hvac_boiler' category with boiler-appropriate temperature defaults (25-80 C).
Per Sber spec, boilers use hvac_thermostat_mode (NOT hvac_work_mode).
Fan and swing features are disabled.
Initialize HVAC boiler 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/hvac_boiler.py
HvacFanEntity¶
Вентилятор.
Sber HVAC Fan entity -- maps HA fan entities to Sber hvac_fan category.
Supports on/off control and fan speed via the hvac_air_flow_power feature.
HVAC_FAN_CATEGORY
module-attribute
¶
Sber device category for fan entities.
SBER_SPEED_VALUES
module-attribute
¶
Allowed Sber ENUM values for hvac_air_flow_power (per Sber C2C spec).
HvacFanEntity
¶
Bases: BaseEntity
Sber fan entity for ventilator control.
Maps HA fan entities to the Sber 'hvac_fan' category with support for: - On/off control - Fan speed via preset_mode or percentage-based speed mapping
Initialize fan 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/hvac_fan.py
fill_by_ha_state
¶
Parse HA state and update fan 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/hvac_fan.py
create_features_list
¶
Return Sber feature list for fan capabilities.
Only includes hvac_air_flow_power when the HA entity supports speed control. Simple on/off fans (e.g. relay overridden as fan) get only on_off.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of Sber feature strings supported by this entity. |
Source code in custom_components/sber_mqtt_bridge/devices/hvac_fan.py
create_allowed_values_list
¶
Build allowed values map for fan speed feature.
Returns empty dict when the fan has no speed support.
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dict mapping feature key to its allowed ENUM values descriptor. |
Source code in custom_components/sber_mqtt_bridge/devices/hvac_fan.py
to_sber_current_state
¶
Build Sber current state payload with fan 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/hvac_fan.py
process_cmd
¶
Process Sber fan commands and produce HA service calls.
Handles the following Sber keys:
- on_off: fan.turn_on / fan.turn_off
- hvac_air_flow_power: fan.set_preset_mode (if mode matches)
or fan.set_percentage (converted from speed ENUM)
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/hvac_fan.py
HvacHeaterEntity¶
Обогреватель.
Sber HVAC Heater entity -- maps HA heater climate entities to Sber hvac_heater.
HVAC_HEATER_CATEGORY
module-attribute
¶
Sber device category for heater climate entities.
HvacHeaterEntity
¶
Bases: ClimateEntity
Sber HVAC heater entity for space heater devices.
Inherits climate behavior but registers under the Sber 'hvac_heater' category with heater-appropriate temperature defaults (5-40 C).
Per Sber spec, heaters support: hvac_air_flow_power, hvac_temp_set, hvac_thermostat_mode, on_off, online, temperature. No swing, no work mode.
Initialize HVAC heater 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/hvac_heater.py
HvacUnderfloorHeatingEntity¶
Тёплый пол.
Sber HVAC Underfloor Heating entity -- maps HA underfloor heating climate entities.
HVAC_UNDERFLOOR_CATEGORY
module-attribute
¶
Sber device category for underfloor heating entities.
HvacUnderfloorEntity
¶
Bases: ClimateEntity
Sber HVAC underfloor heating entity.
Inherits climate behavior but registers under the Sber 'hvac_underfloor_heating' category with underfloor-appropriate temperature defaults (25-50 C).
Per Sber spec, underfloor heating uses hvac_thermostat_mode (NOT hvac_work_mode).
Fan and swing features are disabled.
Initialize HVAC underfloor heating 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/hvac_underfloor_heating.py
HvacAirPurifierEntity¶
Очиститель воздуха.
Sber HVAC Air Purifier entity -- maps HA fan entities to Sber hvac_air_purifier category.
Supports on/off control, fan speed via hvac_air_flow_power, and
read-only features: ionization, night mode, aromatization, filter/ionizer replacement.
HVAC_AIR_PURIFIER_CATEGORY
module-attribute
¶
Sber device category for air purifier entities.
HvacAirPurifierEntity
¶
Bases: BaseEntity
Sber air purifier entity for purifier fan devices.
Maps HA fan entities (with device_class purifier/air_purifier) to the Sber 'hvac_air_purifier' category with support for: - On/off control - Fan speed via preset_mode or percentage - Read-only flags: ionization, night mode, aromatization, filter replacement, ionizer replacement, decontamination
Initialize air purifier 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/hvac_air_purifier.py
fill_by_ha_state
¶
Parse HA state and update air purifier 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/hvac_air_purifier.py
create_features_list
¶
Return Sber feature list for air purifier capabilities.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of Sber feature strings supported by this entity. |
Source code in custom_components/sber_mqtt_bridge/devices/hvac_air_purifier.py
create_allowed_values_list
¶
Build allowed values map for air flow power feature.
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dict mapping feature key to its allowed ENUM values descriptor. |
Source code in custom_components/sber_mqtt_bridge/devices/hvac_air_purifier.py
to_sber_current_state
¶
Build Sber current state payload with air purifier 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/hvac_air_purifier.py
process_cmd
¶
Process Sber air purifier commands and produce HA service calls.
Handles the following Sber keys:
- on_off: fan.turn_on / fan.turn_off
- hvac_air_flow_power: fan.set_preset_mode (if mode matches)
or fan.set_percentage (converted from speed ENUM)
Other features (ionization, night_mode, etc.) 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. |