Бытовая техника¶
KettleEntity¶
Умный чайник: управление температурой нагрева.
Sber Kettle entity -- maps HA water_heater entities to Sber kettle category.
Supports on/off control, water temperature reading, and target temperature setting.
Two very different kinds of HA entity end up in this category (see
CATEGORY_DOMAIN_MAP):
- a plain
switch— a dumb kettle on a smart socket. It hasturn_on/turn_offand nothing else. - a
water_heater— a real smart kettle. Hereturn_on/turn_offare optional in Home Assistant: an integration only gets them by declaringWaterHeaterEntityFeature.ON_OFF, and the SkyKettle-style integrations do not. Such a kettle is driven purely throughset_operation_modewith model-specific mode names taken from itsoperation_listattribute ("Boil", "Heat", "off", …), and a bareset_temperatureonly moves the setpoint without ever starting the heater.
:class:KettleEntity therefore prefers operation modes whenever a
water_heater advertises an operation_list, and falls back to the
historical turn_on / turn_off / set_temperature calls
otherwise — for a switch always, since no switch.set_operation_mode
service exists in Home Assistant.
KETTLE_CATEGORY
module-attribute
¶
Sber device category for kettle entities.
KETTLE_TEMPERATURE_MIN
module-attribute
¶
Lowest target temperature offered to Sber, in °C.
KETTLE_TEMPERATURE_MAX
module-attribute
¶
Highest target temperature offered to Sber, in °C (i.e. "boil").
KETTLE_TEMPERATURE_STEP
module-attribute
¶
Step of the Sber target-temperature slider, in °C.
MODE_DRIVEN_DOMAIN
module-attribute
¶
The only HA domain that can be driven through set_operation_mode.
water_heater is the sole domain in Home Assistant that both publishes
an operation_list attribute and registers a set_operation_mode
service. The kettle category also accepts a plain switch (a dumb
kettle on a smart socket, see CATEGORY_DOMAIN_MAP), and a template
switch is free to carry an operation_list attribute of its own —
routing that entity through switch.set_operation_mode would raise
ServiceNotFound on every single Sber command.
KETTLE_OPTION_OFF_MODE
module-attribute
¶
Entity-option key naming the HA operation mode that switches the kettle off.
KETTLE_OPTION_BOIL_MODE
module-attribute
¶
Entity-option key naming the HA operation mode that boils the water.
KETTLE_OPTION_HEAT_MODE
module-attribute
¶
Entity-option key naming the HA operation mode that heats to a setpoint.
OFF_MODE_CANDIDATES
module-attribute
¶
Mode names auto-detected as "switch the kettle off" (case-insensitive).
BOIL_MODE_CANDIDATES
module-attribute
¶
Mode names auto-detected as "boil" (case-insensitive).
HEAT_MODE_CANDIDATES
module-attribute
¶
HEAT_MODE_CANDIDATES = ('heat', 'electric', 'eco', 'gas', 'heat_pump', 'high_demand', 'performance')
Mode names auto-detected as "heat to the setpoint", best match first.
heat is what SkyKettle-style kettles use; the rest are Home
Assistant's own water_heater constants, which a generic integration
is likely to reuse. Order is preference order, not alphabetical.
KettleEntity
¶
Bases: BaseEntity
Sber kettle entity for smart kettle devices.
Maps HA water_heater entities to the Sber 'kettle' category with support for: - On/off control - Current water temperature reading - Target temperature setting (60-100, step 10) - Child lock (read-only from HA attributes) - Water level and low water level indicators
The Sber kettle spec has no notion of a "mode": the whole mapping
from Sber's on_off + kitchen_water_temperature_set onto a
kettle's own operation modes lives here.
Initialize kettle 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/kettle.py
available_operation_modes
property
¶
Operation modes this entity can actually be driven with.
The raw operation_list attribute filtered by the one thing it
cannot tell us: whether a set_operation_mode service exists
for this entity at all. Only :data:MODE_DRIVEN_DOMAIN has one,
so for every other domain the answer is "no modes", no matter
what the attribute says.
Returns:
| Type | Description |
|---|---|
str
|
Mode names in the order the integration reported them, or an |
...
|
empty tuple when this entity is not mode-driven. |
supports_operation_modes
property
¶
True when the HA entity is driven through set_operation_mode.
Decided by the entity itself: a switch kettle (and any
water_heater that reports no operation_list) keeps the
historical turn_on / turn_off path untouched.
apply_entity_options
¶
Apply per-entity kettle options from entry.options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
options
|
dict
|
Mapping with optional |
required |
Source code in custom_components/sber_mqtt_bridge/devices/kettle.py
validate_entity_options
¶
Reject mode names this entity does not actually offer.
A mode that is not in the entity's operation_list would be
silently dropped by the HA service call, leaving the user with a
kettle that acknowledges commands and never heats — so the
mismatch is reported at the moment they save it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
options
|
dict
|
Mapping submitted by the panel. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
When a key is unknown to this class, when a value is not a string, or when it names a mode the entity does not report. |
Source code in custom_components/sber_mqtt_bridge/devices/kettle.py
entity_options_state
¶
Return the kettle option block rendered by the panel.
The panel needs three things: what the user picked (empty string means "auto"), what the entity actually offers so the dropdowns are not free text, and what the bridge resolved — the last one is what a user who configured nothing must be able to check.
Returns:
| Type | Description |
|---|---|
dict[str, object]
|
Explicit |
dict[str, object]
|
the entity's |
dict[str, object]
|
counterparts (empty string when nothing could be resolved). |
Source code in custom_components/sber_mqtt_bridge/devices/kettle.py
fill_by_ha_state
¶
Parse HA state and update kettle 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/kettle.py
create_allowed_values_list
¶
Build allowed values map for temperature setting.
The range is deliberately not derived from the entity's HA
min_temp / max_temp: model.id is a digest of the
advertised capabilities, so making the range device-specific would
hand every existing user a brand-new Sber model for a kettle that
did not change.
Returns:
| Type | Description |
|---|---|
dict[str, dict]
|
Dict mapping feature key to its allowed INTEGER values descriptor. |
Source code in custom_components/sber_mqtt_bridge/devices/kettle.py
process_cmd
¶
Turn a Sber command into HA service calls.
Mode-driven kettles are handled as a whole payload rather than
key by key, because on_off and
kitchen_water_temperature_set describe one intent when
they arrive together ("heat this water to 80") and would
otherwise produce two contradictory mode switches.
Falls back to :meth:BaseEntity.process_cmd — i.e. to the
historical turn_on / turn_off / set_temperature calls
— for a kettle without operation modes, and for a mode-driven one
whose relevant mode could not be resolved.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cmd_data
|
dict
|
Command payload with a |
required |
Returns:
| Type | Description |
|---|---|
list[CommandResult]
|
List of HA service call dicts to execute. |
Source code in custom_components/sber_mqtt_bridge/devices/kettle.py
VacuumCleanerEntity¶
Робот-пылесос: режимы уборки, управление.
Sber Vacuum Cleaner entity -- maps HA vacuum entities to Sber vacuum_cleaner category.
Supports start/resume/pause/return_to_dock commands, status reporting,
cleaning program (derived from the HA mode list) and battery level.
Every ENUM value crossing to the cloud comes from Sber's documented
vocabulary in _generated/reference_values.py; HA names that denote
nothing Sber knows are dropped rather than translated by guesswork.
Battery is sourced from
the deprecated HA vacuum battery_level attribute (legacy fallback,
removal planned in HA 2026.8) or from a linked battery sensor entity via
the battery link role.
VACUUM_CLEANER_CATEGORY
module-attribute
¶
Sber device category for vacuum cleaner entities.
PROGRAM_VALUES
module-attribute
¶
Cleaning routes Sber documents: perimeter, spot, smart, random_route.
Known mismatch, deliberately accepted. These are cleaning routes,
but the only list Home Assistant's vacuum entity offers is
fan_speed_list, which is suction power. The two coincide only by
name, so:
- a robot whose modes read
Silent / Standard / Turbo— the common case — matches nothing and gets no route control at all, which is honest but means the Sber app shows no program selector; - a robot that happens to spell a mode
SpotorSmartgets the control, and choosing that route in the app callsvacuum.set_fan_speed— i.e. it changes suction, not route.
Both beat the previous behaviour (publishing raw HA fan-speed names,
which Sber cannot route at all), and neither can be fixed here: HA has no
route-carrying attribute to read. Fixing it properly needs a per-device
mapping the user configures, which is why no synonym is invented for
auto — that is a common fan-speed name and would silently hand the
route control to every robot that has it.
CLEANING_TYPE_VALUES
module-attribute
¶
Cleaning types Sber documents: dry, wet, mixed.
VacuumCleanerEntity
¶
Bases: BaseEntity
Sber vacuum cleaner entity for robot vacuum devices.
Maps HA vacuum entities to the Sber 'vacuum_cleaner' category with support for:
- start / resume / pause / return_to_dock commands
- Status reporting, folded onto Sber's four documented values
(see :data:_HA_STATE_TO_SBER_STATUS)
- Cleaning program, when the HA mode list names a documented Sber
route (:data:PROGRAM_VALUES)
- Battery percentage (legacy battery_level attribute or linked
battery sensor via the battery link role)
Every ENUM this class emits is taken from
:data:~custom_components.sber_mqtt_bridge._generated.reference_values.FEATURE_ENUM_VALUES.
HA's own vocabulary (fan-speed names, STATE_* constants) overlaps
it only by accident, and a value outside the documented set is one the
cloud cannot route — it renders a control that never works.
Command handlers address the entity in its own HA domain
(:meth:get_entity_domain) rather than a hard-coded vacuum, so an
entity forced into this category by a user type override is driven
through services that actually exist for it. For a vacuum.*
entity — the only domain this category maps to — the emitted calls
are unchanged.
Initialize vacuum cleaner 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/vacuum_cleaner.py
LINKABLE_ROLES
class-attribute
instance-attribute
¶
LINKABLE_ROLES = (ROLE_BATTERY,)
Linked companion roles: a battery sensor supplies battery_percentage.
HA deprecated the vacuum battery_level attribute (removal in
2026.8); migrated integrations expose battery as a separate sensor
entity, which users link here.
fill_by_ha_state
¶
Parse HA state and update vacuum cleaner 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/vacuum_cleaner.py
update_linked_data
¶
Inject battery percentage from a linked battery sensor entity.
HA deprecated the vacuum battery_level attribute; migrated
integrations publish battery as a separate sensor entity. When
such a sensor is linked with the battery role, its state
feeds the Sber battery_percentage feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
role
|
str
|
Link role name (only |
required |
ha_state
|
dict
|
HA state dict with 'state' containing the reading. |
required |
Source code in custom_components/sber_mqtt_bridge/devices/vacuum_cleaner.py
create_allowed_values_list
¶
Build allowed values map for vacuum features.
Both entries carry Sber's own vocabulary, never HA's: the app renders exactly what is declared and echoes it back as a command, so an undocumented value is a dead button.
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/vacuum_cleaner.py
HumidifierEntity¶
Увлажнитель воздуха.
Sber Humidifier entity -- maps HA humidifier entities to Sber hvac_humidifier.
HUMIDIFIER_CATEGORY
module-attribute
¶
Sber device category for humidifier entities.
HA_TO_SBER_HUMIDIFIER_MODE
module-attribute
¶
HA_TO_SBER_HUMIDIFIER_MODE = {'auto': 'auto', 'low': 'low', 'mid': 'medium', 'medium': 'medium', 'normal': 'medium', 'comfort': 'medium', 'high': 'high', 'silent': 'quiet', 'sleep': 'quiet', 'night': 'quiet', 'eco': 'quiet', 'strong': 'turbo', 'boost': 'turbo'}
Map HA humidifier modes to Sber-standard enum values (case-insensitive lookup).
Sber hvac_air_flow_power accepts only auto/low/medium/high/turbo/quiet —
standard HA modes (MODE_NORMAL, MODE_ECO, MODE_COMFORT) map to the
semantically closest value; unmapped device-specific modes are dropped
(issue #44 audit — raw HA strings must not leak into Sber enums).
HumidifierEntity
¶
Bases: BaseEntity
Sber humidifier entity for humidity control devices.
Maps HA humidifier entities to the Sber 'hvac_humidifier' category with support for: - On/off control - Target humidity setting - Work mode selection (when supported by the device)
Command handlers address the entity in its own HA domain
(:meth:get_entity_domain) rather than a hard-coded humidifier,
so an entity forced into this category by a user type override is
driven through services that actually exist for it. For a
humidifier.* entity the emitted calls are unchanged.
Initialize humidifier 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/humidifier.py
fill_by_ha_state
¶
Parse HA state and update all humidifier attributes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ha_state
|
dict
|
HA state dict with 'state' and 'attributes' keys. Attributes may include humidity, current_humidity, available_modes, and mode. |
required |
Source code in custom_components/sber_mqtt_bridge/devices/humidifier.py
update_linked_data
¶
Inject current humidity from a linked sensor entity.
When the HA humidifier entity does not provide current_humidity
in its attributes, an external humidity sensor can be linked to
supply the value for the Sber humidity feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
role
|
str
|
Link role name (only |
required |
ha_state
|
dict
|
HA state dict with 'state' containing the reading. |
required |
Source code in custom_components/sber_mqtt_bridge/devices/humidifier.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. |