Files
heating-mpc-ha/custom_components/heating_mpc/const.py
T
buzeraandClaude Opus 5.5 d2bd398a0f Show learning activity with Learning Progress and Last Sample sensors
During a first test the Status entity only said "learning" for the
first half hour (the radiator-lag wait after a restart), and the
attributes explaining why were hard to find. Add two sensors:

- Learning Progress (%): for the least trained room, the mean of its
  three readiness requirements (200 samples, 30 ON, 30 OFF), each capped
  at 100 %; 100 % means ready. Attributes show the counts.
- Last Sample: an enum of the last poll's learning outcome, with English
  and Romanian state names (e.g. "Waiting for radiators to settle"). Its
  history shows when learning happens.

Polls blocked by missing shared inputs now report waiting_for_inputs.
Readiness thresholds move to const.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 22:39:25 +02:00

59 lines
2.1 KiB
Python

"""Configuration constants for Heating MPC."""
DOMAIN = "heating_mpc"
CONF_CLIMATE = "climate_entity"
CONF_HEATER = "heater_entity"
CONF_OUTSIDE = "outside_entity" # v0.1 legacy single temperature source
CONF_ROOMS = "room_entities"
CONF_WEIGHTS = "weights"
CONF_HORIZON = "horizon_minutes"
CONF_MIN_ON = "minimum_on_minutes"
CONF_MIN_OFF = "minimum_off_minutes"
CONF_SWITCH_COST = "switching_cost"
CONF_HEAT_COST = "heating_cost"
CONF_ROOM_MAX_AGE = "room_max_age_minutes"
CONF_WEATHER_MAX_AGE = "weather_max_age_minutes"
# Stale room sensors: False leaves them out (re-weighting the other rooms),
# True keeps using their last value for sensors that report only on change.
CONF_ROOM_STALE_KEEP = "room_stale_use_last_value"
CONF_BAND = "comfort_band"
# Each source list is ordered: first valid sensor wins; remaining are fallbacks.
WEATHER_SOURCES = {
"temperature": "outside_temperature_sources",
"wind": "outside_wind_sources",
"clouds": "outside_clouds_sources",
"humidity": "outside_humidity_sources",
"feels_like": "outside_feelslike_sources",
"pressure": "outside_pressure_sources",
"visibility": "outside_visibility_sources",
"rain": "outside_rain_sources",
"snow": "outside_snow_sources",
}
WEATHER_MAIN = ("temperature", "wind", "clouds")
WEATHER_EXTRA = ("humidity", "feels_like", "pressure", "visibility", "rain", "snow")
DEFAULTS = {
CONF_ROOM_MAX_AGE: 30,
CONF_WEATHER_MAX_AGE: 120,
CONF_ROOM_STALE_KEEP: False,
CONF_HORIZON: 120,
CONF_MIN_ON: 15,
CONF_MIN_OFF: 10,
CONF_SWITCH_COST: 0.15,
CONF_HEAT_COST: 0.025,
CONF_BAND: 0.15,
}
# A room sensor silent this long is treated as dead even when keeping last values.
ROOM_STALE_KEEP_MAX_MINUTES = 24 * 60
SAMPLE_MINUTES = 5
# A room's model is trusted for forecasts after this many accepted samples.
READY_SAMPLES = 200
READY_ON_SAMPLES = 30
READY_OFF_SAMPLES = 30
# Outcome of each poll for learning (Status sample_result, Last Sample sensor).
SAMPLE_RESULTS = (
"waiting_for_inputs", "first_sample", "learned", "partly_rejected",
"interval_out_of_range", "relay_changed", "outside_source_changed", "lag_uncertain",
)
BLOCK_MINUTES = 15