Skip to content

fix(automations): correct the learning feature after the full review - #296

Merged
Developer-Simon merged 22 commits into
prereleasefrom
fix/automation-learning-review
Nov 23, 2026
Merged

Developer-Simon merged 22 commits into
prereleasefrom
fix/automation-learning-review

Conversation

@Developer-Simon

@Developer-Simon Developer-Simon commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Squash-merge commit message

A review of the whole learning feature (PR 1 to 5c) found real defects. This PR fixes the confirmed ones before the feedback and season work builds on them.

- "Delete learned data" now clears every learned state through one reset registry on the learning hub, including the Home Assistant cache, PV raster and model, forecast check, cycles and the engine's last run
- The engine survives a panicking detector and keeps the results of devices that finished
- Suggestions keep harm first, the cap counts only open ones, every value carries a spread, and a suggestion an existing rule already covers or contradicts is dropped by its intent, energy suggestions without a replay verdict are dropped
- Rule actions are matched by direction, one minimum run table, switch times skip unreachable and away days and keep stable IDs
- The change point test sees falling base load too, and replay, season, threshold and PV reserve edge cases are fixed
- Minute recording keeps what Home Assistant cannot deliver while paused and resets a zeroed file header
- Learned bounds are rejected on save exactly as the service would reject them
- Restoring settings checks the field roles, the monitoring acknowledgement needs a CSRF token, day files are written atomically
- The suggestion popover is hidden without edit rights, closes on scroll and softly, and every dropped suggestion stays undoable

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>

Highlight translations

Highlights (de):
- Das Lernen der Automationen ist nach einer Gesamtprüfung zuverlässiger, Löschen räumt alles auf

Tour

none

Summary

A review of the whole learning feature (PR 1 to 5c) found real defects. This PR fixes the confirmed ones before the feedback and season work builds on them.

Checks

  • The title is a Conventional Commits subject.
  • scripts/dev/check_tracked_secrets.sh is clean.
  • AI assistance disclosed per AI-DISCLAIMER.md: Claude Sonnet 5.5
  • Suites run locally: go test, npm test, pytest, smoke
  • Linked issue: none

Developer-Simon and others added 22 commits November 23, 2026 20:52
The "Gelerntes löschen" action called a fixed list of resets and missed
the HA sync cache, the PV raster, PV model and weather, the forecast check,
the cycle tracker and the engine's last run. Components now register a
Resetter with the hub next to their saver, and the hub resets all of them
in registration order, collecting errors per name.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… devices

A panicking detector now counts as finished without candidates and is
logged, instead of taking the process down. The engine keeps the results
per detector and device: a carried device that did not finish keeps its
last result, the finished devices of a late round are adopted, and a
device that no longer exists is dropped.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…value a spread

Harmful findings sort before all others, and the detector variety is
chosen inside each severity. Hidden findings leave the list before the
cap but keep their shown entry. Every candidate value now has a spread:
flapping the MAD of the gaps, threshold the MAD of the daily peaks,
no-effect and overridden one case, surplus window the MAD of the day
starts, with the window start added as a value.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…uggestions without replay

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…un table

A rule action with a set direction now only claims a state change in that
direction, so a hand switch after a rule that switched off is no longer
attributed to the rule. RuleState walks rule IDs in sorted order, so two
rules on the same entity claim deterministically.

The separate reliabilityMinRuntime table is removed. Every caller uses
minRunForRole, so other switchable devices now get 300 s instead of 120 s.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…Ds stable

Switch times and couplings count unreachable and away days neither as hits
nor as misses. A shown switch time ID is kept while its centre stays within
30 minutes of it, so a centre that drifts across a grid line keeps its ID.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
CUSUM now runs S+ and S- on standardised values and reports the
direction. The base load drift reuses it, so a sustained fall gives a
baseload.drift.down notice without a device or fix.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…on edge cases

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…days

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…clean every location

While paused, the minute store now only skips the keys Home Assistant
can deliver (e:*, b:pv, b:battery_soc). Other keys keep being recorded.
Reset and retention cover every location the store has used, not only
the current and the previous one. Days dropped with unwritten minutes
are logged. The prefetch is skipped when the companion has not offered
any series.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A power loss can leave the header of a minute file zeroed. OpenAppend now
truncates such a file to empty and logs the path. Files with another
non-zero header still return an error and stay untouched.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d reject

The service refuses a learned reference whose min is above max or whose
fallback lies outside min and max, but the dashboard saved such rules
and the service only rejected them later. The save now runs the same
check through a save hook in the config manager, which keeps config free
of an import on autolearn.

Both sides read the bounds section of learned_vectors.json. A learned
value of NaN or Inf is no longer stored or published, since its payload
would not encode and an empty payload deletes the retained topic.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…itoring ack

Settings restore now compares the revision with the current settings and
requires the role of every changed field, the same check as the PUT path.
Monitoring acknowledgement checks the CSRF token like its neighbours.
Day files are written through energystats.WriteFileAtomic, which syncs
before the rename.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…p every undo

Finding popovers hide Ignorieren and the fixes without the automations
right. The popover closes on page scroll and window resize. The learning
settings treat an unreadable session as no edit right, so the new-feature
hint stays hidden. The suggestion band keeps every dismiss within the hint
time and undoes them newest first, and a failed dismiss shows a toast and
keeps the tile.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the JS test

The vector file is now an object with resolve and bounds sections. The
JS test iterated the whole file as an array, so npm test failed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The expanded band card gets is-enter when it opens from closed, and the
target trace runs 280 ms after a 120 ms delay. Reduced motion only fades it.
The finding popover leaves with a 160 ms scale and fade through
x-transition:leave. Its entrance no longer fills forwards, so the leave
transition is not held back. Reduced motion keeps only the fade. The energy
group label uses the pv flow colour, and the learning text in de and en
follows the agreed wording.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A habit or energy finding that carries no Apply fix and belongs to no rule is
a notice. The suggestion band skips it and the rule check hands it to
Monitoring.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Exemption granted by Developer-Simon with 👍. No tour is required for these highlights:

  • Dashboard v0.11.22-pre.35: correct the learning feature after the full review

@Developer-Simon
Developer-Simon merged commit 88f3c75 into prerelease Nov 23, 2026
20 checks passed
@Developer-Simon
Developer-Simon deleted the fix/automation-learning-review branch November 23, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant