Introduce thermal zones as config subentries

Each temperature sensor used to be its own "room", so a room with two
sensors counted twice and comfort importance was tied to sensors.

zones.py adds Zone: a name, one or more sensors with sensor weights, a
comfort weight, an optional target offset and adjacent zones (made
symmetric). Sensor weights only combine readings; comfort weights only
steer the MPC; neither touches the learned thermal coefficients.

Zones are config subentries (HA's native "Add zone" / edit / delete on
the integration page), with validation that a sensor belongs to one
zone and is not an outdoor source, and a sensor-weight step for
multi-sensor zones. Initial setup still asks for room sensors and
weights and creates one zone per sensor. Configure no longer asks for
rooms or weights.

Config entry version 3. Migrating from 2 turns each room sensor into a
one-sensor zone with its comfort weight and the sensor's entity ID as
the zone key, so learned models, forecast entities (now linked to their
zone, so deleting a zone removes them) and accuracy statistics carry
over. Older versions cannot load a version 3 entry; rolling back needs
the HA backup.

A zone learns only across polls that used the same sensors (a sensor
dropping out shifts the mean by its offset); the new poll outcome
"sensors_changed" reports this. Status renames: input_quality.zones
(per-sensor detail nested), excluded_zones, retired_zone_models; adds
zone_names. Invalid stored comfort weights now fall back to 1.0, so the
invalid_weights status is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
buzeraandClaude Opus 5.5 committed 2026-10-27 02:32:11 +02:00
1 parent 220ac570d2
commit 46587af8a3
15 files changed
+867 -155

No files matched your search

@@ -40,7 +40,7 @@
},
"weights": {
"title": "Room priorities",
"description": "Each room has a relative comfort weight between 0.1 and 10; sensor entity is shown by each field."
"description": "Each selected sensor becomes its own zone with this comfort weight. Later, group the sensors of one room into one zone with Add zone or by editing a zone."
}
},
"error": {
@@ -59,7 +59,6 @@
"data": {
"climate_entity": "Existing Generic Thermostat",
"heater_entity": "Physical heating switch (read-only)",
"room_entities": "Individual room temperature sensors",
"horizon_minutes": "Prediction horizon (minutes)",
"minimum_on_minutes": "Minimum ON time (minutes)",
"minimum_off_minutes": "Minimum OFF time (minutes)",
@@ -94,14 +93,9 @@
"outside_rain_sources": "Rain sources (optional)",
"outside_snow_sources": "Snow sources (optional)"
}
},
"weights": {
"title": "Room priorities",
"description": "Weights determine relative comfort importance, not physics coefficients."
}
},
"error": {
"invalid_rooms": "Select 1–12 distinct room sensors.",
"invalid_weather": "Select at least one outdoor temperature sensor, distinct from room sensors."
}
},
@@ -111,6 +105,7 @@
"state": {
"waiting_for_inputs": "Waiting for inputs",
"first_sample": "First sample",
"sensors_changed": "Zone sensors changed",
"learned": "Learned",
"partly_rejected": "Partly rejected (outlier)",
"interval_out_of_range": "Irregular interval",
@@ -120,5 +115,62 @@
}
}
}
},
"config_subentries": {
"zone": {
"entry_type": "Zone",
"initiate_flow": {
"user": "Add zone",
"reconfigure": "Edit zone"
},
"step": {
"user": {
"title": "Thermal zone",
"description": "A room or area of the apartment. Sensor weights combine several sensors in one room; the comfort weight says how much the zone matters to the MPC. Neither changes the zone's learned thermal properties.",
"data": {
"name": "Name",
"sensors": "Temperature sensors",
"comfort_weight": "Comfort weight",
"target_offset": "Target offset (°C)",
"neighbors": "Adjacent zones (heat exchange)"
},
"data_description": {
"comfort_weight": "Relative importance for the MPC (0.1–10).",
"target_offset": "Added to the thermostat's target temperature for this zone.",
"neighbors": "Zones this one exchanges heat with, for example through a wall or an open door. The coefficient is learned only when the data supports it."
}
},
"sensor_weights": {
"title": "Sensor weights",
"description": "How much each sensor counts in the zone temperature (0.1–10)."
},
"reconfigure": {
"title": "Thermal zone",
"description": "A room or area of the apartment. Sensor weights combine several sensors in one room; the comfort weight says how much the zone matters to the MPC. Neither changes the zone's learned thermal properties.",
"data": {
"name": "Name",
"sensors": "Temperature sensors",
"comfort_weight": "Comfort weight",
"target_offset": "Target offset (°C)",
"neighbors": "Adjacent zones (heat exchange)"
},
"data_description": {
"comfort_weight": "Relative importance for the MPC (0.1–10).",
"target_offset": "Added to the thermostat's target temperature for this zone.",
"neighbors": "Zones this one exchanges heat with, for example through a wall or an open door. The coefficient is learned only when the data supports it."
}
}
},
"error": {
"zone_name_required": "Enter a name.",
"zone_sensors": "Choose 1–6 different sensors.",
"sensor_in_other_zone": "A chosen sensor already belongs to another zone.",
"sensor_is_weather_source": "A chosen sensor is used as an outdoor temperature source.",
"too_many_zones": "At most 12 zones are supported."
},
"abort": {
"reconfigure_successful": "The zone was updated."
}
}
}
}