Skip to content

feat(autolearn): take minute values from Home Assistant - #294

Merged
Developer-Simon merged 11 commits into
prereleasefrom
feat/automation-learning-ha-source
Nov 23, 2026
Merged

Developer-Simon merged 11 commits into
prereleasefrom
feat/automation-learning-ha-source

Conversation

@Developer-Simon

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

Copy link
Copy Markdown
Owner

Squash-merge commit message

Home Assistant now serves as a source of minute values for the learning functions. The replay PR (#295) is merged, this PR is rebased on prerelease.

Source: when the companion is paired, the node asks Home Assistant for minute values (1m from the raw states, 5m from the short term statistics) through the existing history exchange. A new server peer `learnrec` keeps the answers in memory only, youngest days first, within half of the minute budget of the learning level. The companion itself is unchanged.

Recording mode: `learning_minutes_mode` has a new value `pause_with_companion`. The own recording pauses while the companion offered 1m coverage in the last 10 minutes, and resumes within a minute when it stops. `auto` resolves to it only with a paired companion and no extra drive. An explicit "Always" is never changed. The card Learning > Recording shows the three modes, greys out the middle one without a companion with an action to the Users page, and adds the switch "Reconcile with Home Assistant" (on by default, only with a companion).

Reconcile: before the heavy nightly run the node fetches the last 14 days that its own recording does not cover without a gap and waits up to 90 seconds for the answers. Reading prefers the own minute, then 1m from Home Assistant, then 5m. A day with more than 20 percent of 5m minutes does not count as minute exact. The values are never written to a drive and are dropped after the run.

Known limits: only `b:pv` and `b:battery_soc` come from Home Assistant as balance fields, grid, load and battery need their signs and units checked first. Pausing together with the location drive leaves gaps in the drive files, a follow-up should only allow it with the location memory. With the mode "Off" the reconcile is still planned in the backend, only the card hides its switch. The demo companion offers no minute coverage for learning series, so the pause is covered by unit tests only.

Highlights:
- Learning functions can take minute values from Home Assistant

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

Highlight translations

Highlights (de):
- Die Lernfunktionen können Minutenwerte aus Home Assistant übernehmen

Tour

none

Summary

Home Assistant now serves as a source of minute values for the learning functions. The replay PR (#295) is merged, this PR is rebased on prerelease.

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, node test, pytest, smoke
  • Linked issue: none

@Developer-Simon
Developer-Simon marked this pull request as draft November 22, 2026 21:56
@Developer-Simon
Developer-Simon marked this pull request as ready for review November 23, 2026 18:00
@Developer-Simon
Developer-Simon force-pushed the feat/automation-learning-ha-source branch 2 times, most recently from ce139e0 to 90162c2 Compare November 23, 2026 18:25
Developer-Simon and others added 9 commits November 23, 2026 19:27
…ompanion

Add the learnrec server peer HASync. It announces the learning series
to the companion, fetches missing days as 1m values (last 7 days) or
5m values (up to 30 days) and keeps them in RAM only. Requests run one
at a time, the newest days first, within RAMMinuteBytes/2. Replies after
the deadline or of another tier are dropped, Drop clears the cache.

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

Add the pause_with_companion mode, the learning_ha_reconcile_disabled
setting and the companion fields of the minute status. Auto without a
drive and with a paired companion pauses in RAM, an explicit always
stays always.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…h gaps before the heavy run

The heavy learning run reads the own minutes first and fills the gaps
from the Home Assistant cache. Before a daily round, the engine fetches
the missing days of the last 14 days from the companion and drops the
cache afterwards. HASync gains Days and WaitIdle for the status and the
wait.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The minute recording switch becomes a radio group with Always,
Pause while Home Assistant delivers, and Off. The pause row is
disabled without a paired companion and links to the users page.
A reconcile switch and a paused note show next to it.

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

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Developer-Simon
Developer-Simon force-pushed the feat/automation-learning-ha-source branch from 90162c2 to 33c7bcb Compare November 23, 2026 18:28
@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.34: Learning functions can take minute values from Home Assistant

@Developer-Simon
Developer-Simon merged commit 7aa657e into prerelease Nov 23, 2026
20 checks passed
@Developer-Simon
Developer-Simon deleted the feat/automation-learning-ha-source branch November 23, 2026 18:42
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