Fix shadow observer lifecycle, learning and prediction correctness

This commit is contained in:
buzera committed 2026-10-26 17:50:20 +02:00
1 parent 2b9a10979b
commit c434f3995d
10 files changed
+594 -33

No files matched your search

+25
View File
@@ -73,3 +73,28 @@ python -m unittest discover -s tests -v
- Corrects the manifest classification from `helper` to `service`. Existing config entries should move from the Helpers listing to **Settings → Devices & services → Integrations** after replacing the files and restarting Home Assistant Core. No deletion/reconfiguration is needed to upgrade.
- When the integration config entry is deleted from the Integrations page, Home Assistant removes its registered entities, and `async_remove_entry` removes the locally persisted learned-model data (`.storage/heating_mpc.<entry_id>`). The custom component source folder remains on disk until manually removed.
- MPC behavior is otherwise unchanged and remains read-only / shadow-only.
## Unreleased: v0.2.1 reliability audit
See [AUDIT.md](AUDIT.md) for findings, fixes, test evidence and remaining gaps.
No active control was added; the manifest version has not been advanced.
- Fix config-entry v1 migration, obsolete room forecast cleanup and coordinator
cleanup after a raised platform setup error.
- Validate saved models atomically and add an explicit payload schema version.
Compatible legacy coefficients survive; readiness now requires at least 30 new
accepted ON and 30 OFF samples **per room** when loading legacy models without
per-room counters. The existing 200-total-sample requirement also applies.
- Reject intervals containing relay changes or outside-provider changes. Accept
only 270–330-second intervals and normalize small timing differences. This can
slow learning; it never generates extra heating cycles.
- Normalize thermostat targets to Celsius; reject invalid weights and optimizer
parameters. Status can report `invalid_weights` or `inputs_changed`; neither
publishes a proposal. Input changes during calculation discard the prediction.
- Model diagnostics include each room's accepted total/ON/OFF sample counts.
Predictions remain **counterfactual**: the proposed plan is not the actual
Generic Thermostat's future command sequence.
Offline lifecycle tests use HA doubles. Freshness policies, actual HA/HAOS lifecycle
validation and held-out prediction accuracy remain unfinished. Back up before
trying these changes; follow the safe trial and rollback notes in AUDIT.md.