Skip to content

Forecast: keep load learning when an update only changes a measurement driver's script #2088

Backlog

Description

@frahlg

Problem

The forecast learning revision (site-v2:…, forecastSiteConfig.RefreshIdentity) changed on a home site at the native update to v0.167.0-beta.1 on 2026-11-22. The site's meter, PV and battery hardware did not change. Every learned load and PV model state is keyed on that revision, so the update started the load model cold and threw away about 25 days of load history. (An earlier change happened on 2026-10-28.)

Cold-starting load learning is expensive in winter. A replay on the forecast archive and a walk over the site's history show this:

  • A better temperature (heating) term only helps when the model holds a few weeks of whole days.
  • With learning restarted every few weeks, it cannot learn the heating response.
  • The first days after a reset are clearly worse.

The current rule also costs the calibrators and the per-lead source choice their evidence, because they restart with the revision as well.

What I see in the code

forecastStaticRevision hashes the meter, zone, measurement options, learning weather, the learning drivers (meter/PV/battery) and each driver's full script digest. So any byte change to one of those Lua scripts in a release resets learning, even when what the driver measures is the same.

#1488 fixed the case where only the release path moved. The script content case is still a full reset. At this update the log shows the driver repository swapping in newer release scripts ("this release's driver runs instead of an older selection"). I have not pinned down which input changed the hash: the reset is visible, but the cause is not logged.

Proposal

  1. Log why the learning revision changed. At a change, log the component that differs: meter, options, weather, a driver entry, a script digest, or the device identity. Today it can only be inferred.
  2. Do not reset load learning on a script-content change alone when the meter identity, the device identities and the measurement options are unchanged. Two possible ways:
    • Key learning on a driver-declared measurement contract version instead of the whole script digest. A driver bumps that version only when the meaning or scaling of a reading changes.
    • On a content-only change, keep the learned state but mark it, and let the calibrators and the source choice restart. That is a soft change instead of a cold start.
  3. Optionally, also keep calibrator and source-choice evidence across config versions that keep the same learning revision. Today each config version starts its own history.

A true topology change (new meter, new PV or battery device, changed sign or scaling) should still reset, as now.

Why it matters now

Winter is where the load forecast matters most and where it needs the longest memory. A reset at each beta update makes the forecast cold several times per season.

Activity

  1. added
    enhancement
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions