Discard predictions only when their inputs change

A finished plan was discarded whenever any watched State object changed
during the save or calculation, including diagnostic-only weather
sensors and the thermostat's current_temperature/hvac_action. The
proposed-heat entity then went unavailable for five minutes without
cause. Compare only the values the prediction uses: room and outdoor
temperature states and units, thermostat mode and target, and relay
state and last change.

Also pass config_entry to the coordinator explicitly instead of relying
on HA's ContextVar fallback, which HA reports as deprecated usage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
buzeraandClaude Opus 5.5 committed 2026-10-26 21:21:25 +02:00
1 parent c3646ba876
commit 2a0a94c640
3 files changed
+40 -7

No files matched your search

+1
View File
@@ -21,6 +21,7 @@ async def setup(hass, entry):
async def test_setup_reload_unload(hass, entry, inputs):
coordinator = await setup(hass, entry)
assert coordinator.config_entry is entry
registry = er.async_get(hass)
entities = er.async_entries_for_config_entry(registry, entry.entry_id)
assert len(entities) == 5