Климат¶
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.
Note: kept as a separate literal (not auto-generated) because
HA_TO_SBER_WORK_MODE has heat_cool and auto both mapping to
auto — a naive reverse would lose heat_cool. The reverse here
prefers the canonical HA mode for each Sber value.
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.
Kept as explicit literal for the same reason as SBER_TO_HA_WORK_MODE:
heat_cool and auto both forward-map to auto.
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.
Simple attribute extraction is handled declaratively via
:attr:ATTR_SPECS. State-derived values (current_state,
hvac_mode) remain here since they come from the top-level
state field, not from 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_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
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.
SBER_SPEED_VALUES
module-attribute
¶
Allowed Sber ENUM values for hvac_air_flow_power (per Sber C2C spec).
HVAC_FAN_CATEGORY
module-attribute
¶
Sber device category for fan entities.
HvacFanEntity
¶
Bases: FanSpeedMixin, 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_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
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: FanSpeedMixin, 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_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. |