Skip to content

feat(autolearn): record minute values and regulator steps for learning - #293

Merged
Developer-Simon merged 21 commits into
prereleasefrom
feat/automation-learning-minutes
Nov 22, 2026
Merged

Developer-Simon merged 21 commits into
prereleasefrom
feat/automation-learning-minutes

Conversation

@Developer-Simon

Copy link
Copy Markdown
Owner

Squash-merge commit message

The node now records minute values per entity, in RAM or in binary day files on the extra drive or the system drive, and keeps every regulator step of a scenario.

Minute recording: a new store keeps power per entity, the energy balance and the outdoor temperature for every minute. The place follows the situation. Without an extra drive the node records in RAM only, with a drive it records on the drive and the Learning page shows a "newly active" note with a Keep button. An explicit choice of place is never overwritten. If the drive fails the recording goes on in RAM and the missing minutes are added when it returns, without a gap or a doubled minute. The RAM part is bounded per learning level (4, 16 and 64 MiB). The files are `learnrec/minutes/YYYY-MM-DD.enm` with a CRC per block, a cut last block is dropped and the next start appends cleanly. The recording is not part of the backup and "Delete learned data" removes it.

Settings: new fields `learning_minutes_mode`, `learning_minutes_location` and `learning_minutes_days` (1 to 365, default 60) and a card "Recording" on the Learning page with a switch, the three places, the retention stepper, the usage line and the note for a newly set up drive. The chain suggestions read the recording after a restart and catch up on the missed minutes.

Regulator steps: the automation service publishes every computed step of a scenario regulator as a non-retained message on `<base>/scenario/<id>/step` (error, net, from, to and the reason sent, deadband, unchanged or limit). The dashboard keeps them in a ring per scenario and in per scenario day files, and counts the energy outside the deadband per day.

Demo: three days of minute values and a scenario with steps are seeded, the demo keeps the recording on the system drive.

Known limits: the measurement chain learning does not catch up after a restart yet, because the minute frame carries no chain topology. After a restart the step reader does not reload its RAM ring from the files. The second 02:xx hour of the autumn time change is not recorded. These are listed as open points in the spec.

Highlights:
- The node records minute values and keeps every regulator step as a base for learning

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

Highlight translations

Highlights (de):
- Die Node zeichnet Minutenwerte auf und behält jeden Reglerschritt als Grundlage zum Lernen

Tour

none

Summary

The node now records minute values per entity, in RAM or in binary day files on the extra drive or the system drive, and keeps every regulator step of a scenario.

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 21 commits November 22, 2026 19:05
Add learning_minutes_mode, learning_minutes_location and
learning_minutes_days to the settings, with schema, defaults, and
RoleEditSetup access. Add the per-stage RAM budget for minute recording
(eco 4 MiB, balanced 16 MiB, full 64 MiB), ResolveMinutes for mode and
location, and RAMDays to cap the RAM days by that budget.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Day file with header ENM1, key blocks and value blocks, each framed by
length and CRC32. Gaps are NaN. An incomplete or invalid last block is
dropped on read, and OpenAppend cuts the file to the end of the last
valid block.

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

The MinuteStore collects the minute values of entities, balance and
outdoor temperature in RAM and writes them at Flush to the day files of
the chosen location. While a drive is down, the values stay in RAM and
are appended once it is back, without gaps or duplicates.

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The chain suggestion collector remembers the last counted minute, saves it
with the day sums and reports the minute after it through ReplayFrom. Replayed
frames do not change the device owner of an entity, since the recording has
no device IDs. main.go registers the collector for replay and calls
learnHub.Replay once before the energy loop starts. The reader is still nil
until the MinuteStore is wired in, so Replay does nothing for now.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Each computed regulator step goes to <base>/scenario/<id>/step, not
retained, QoS 0, with err, net, from, to and why (sent, deadband,
unchanged or limit). Steps are reported even when no setpoint is
sent, and a blocked publish reports why sent with to equal from.
The step is not written to the scenario state or the history.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
StepLog holds the regulator steps of each scenario in RAM for the
days the learning profile keeps, validates the payloads and derives
the day figures (changes, sign flips, out-of-deadband energy). Day
files gain an optional steps map, old files load unchanged.

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

Steps go to learnrec/minutes/YYYY-MM-DD.<scenario>.steps as 24-byte
little endian records, appended once per step on each Flush. Steps
older than the ring are read back from those files, and old day files
are pruned. Day figures skip deadband steps and cap the gap to the
next step at 300 s.

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

The MinuteStore and the StepLog start with the dashboard. Their settings
and location come from a snapshot that the ten-second loop refreshes, so
the minute path never reads a file under the hub mutex. Step topics of the
automation service share one WatchTopics call with the node agent. Flush
runs every five minutes and once more on shutdown. Reset clears minutes
and steps, and chain suggestions take their switch before the replay.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The RAM ring of the step log follows the RAM day budget of the minute
store, in every location. The step files keep the configured days. A
step older than the ring that is not yet in its file stays in RAM until
the next flush writes it. The flush logs its duration when it takes more
than two seconds.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The learning status gets a minutes object (resolved settings plus store
usage) and a minutes_drive new-hint while an automatic location resolves
to the drive and the hint is not acknowledged. The Reset path already
clears minutes and steps from 7a.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The learning record card gets the minute recording block above the
profile days: a switch for the recording, three location rows (RAM,
drive, system) with their sub lines, a stepper for the days on drive
and system, the usage line and the hint when the minutes moved to a
newly set up drive. Choosing a row writes the location explicitly.
Everything is disabled without edit_setup.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The drive row of the minute recording showed the free space in MB
("6000,0 MB frei"). It now uses GB and TB with one decimal from 1000
MB upward, the same 1000 steps as the storage page.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The demo writes three days of minute values (device power, balance and
outdoor temperature) into learnrec/minutes under the data directory, and
the regulator steps of the nulleinspeisung scenario for the last day.
Existing files are kept, so a second seed writes the same bytes.

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

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

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

  • Dashboard v0.11.22-pre.32: The node records minute values and keeps every regulator step as a base for learning

@Developer-Simon
Developer-Simon merged commit 19e65e7 into prerelease Nov 22, 2026
20 checks passed
@Developer-Simon
Developer-Simon deleted the feat/automation-learning-minutes branch November 22, 2026 18:15
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