Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
25d731e
feat(autolearn): expose forecast days and the rules that read a learn…
Developer-Simon Nov 23, 2026
4a39a77
feat(demo): seed a forecast check and a year of season weeks
Developer-Simon Nov 23, 2026
d11383f
feat(monitoring): serve the forecast check and the season weeks from …
Developer-Simon Nov 23, 2026
e135dcc
feat(monitoring): collect the forecast check and season weeks for the…
Developer-Simon Nov 23, 2026
c8b003e
feat(monitoring): add texts for forecast, season and the usual day
Developer-Simon Nov 23, 2026
8e5f721
feat(monitoring): add the insight model for season and forecast
Developer-Simon Nov 23, 2026
80bb7d0
feat(monitoring): add the usual day to the insight model
Developer-Simon Nov 23, 2026
fe3631f
feat(monitoring): add the forecast and year comparison components
Developer-Simon Nov 23, 2026
57e2a44
fix(monitoring): keep texts and locale out of the insight model
Developer-Simon Nov 23, 2026
bc67258
feat(monitoring): add the forecast view and tab to the monitoring tem…
Developer-Simon Nov 23, 2026
82cde6e
fix(monitoring): show the legend items for statistics weeks and gaps
Developer-Simon Nov 23, 2026
1d8f4c8
feat(monitoring): style the forecast view
Developer-Simon Nov 23, 2026
a664db2
fix(monitoring): route locale formatting through I18n
Developer-Simon Nov 23, 2026
5e9d157
feat(monitoring): add the usual day component
Developer-Simon Nov 23, 2026
1749c86
feat(monitoring): show learned values as a usual day
Developer-Simon Nov 23, 2026
ebf5e84
fix(monitoring): link the surplus tile to the forecast and follow rep…
Developer-Simon Nov 23, 2026
72d192a
feat(monitoring): style the usual day
Developer-Simon Nov 23, 2026
d6da484
chore(monitoring): drop the texts of the old learned values list
Developer-Simon Nov 23, 2026
a1eb3a9
fix(monitoring): harden the insight charts and components
Developer-Simon Nov 23, 2026
7751f73
fix(monitoring): keep the forecast view inside the screen and polish …
Developer-Simon Nov 23, 2026
372f5aa
docs(monitoring): describe the forecast view, the year comparison and…
Developer-Simon Nov 23, 2026
b29e739
chore(webui): bump cache marks for the monitoring assets
Developer-Simon Nov 23, 2026
ca4f7a0
feat(monitoring): add a tour target to the forecast tab
Developer-Simon Nov 25, 2026
ab438d5
test(autolearn): keep the cycle test window open until today
Developer-Simon Nov 25, 2026
da980a5
chore(release): bump component versions
Nov 25, 2026
eb3e44d
docs(changelog): update changelogs
Nov 25, 2026
3168e41
fix(monitoring): keep one gap between the cards of the forecast and l…
Developer-Simon Nov 25, 2026
1b52e7c
docs(monitoring): drop the description of the old learned values list
Developer-Simon Nov 25, 2026
2d6749e
fix(monitoring): let the forecast view use the full tab width
Developer-Simon Nov 25, 2026
f54424f
docs(changelog): update changelogs
Nov 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions changelog/highlights/297.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"de": {
"dashboard": "Monitoring zeigt die Prognoseprüfung, einen Jahresvergleich und die Lernwerte als üblichen Tag"
},
"en": {
"*": "Monitoring shows the forecast check, a year comparison and the learned values as a usual day"
},
"tour": {
"*": {
"steps": [
{
"device": "any",
"need": "view_monitoring",
"open": [
"monitoring-forecast"
],
"panel": "monitoring-panel",
"target": "monitoring-forecast",
"text": {
"de": "Die neue Ansicht Prognose zeigt, ob die Node ihrer Überschussprognose oder dem Saisonmedian folgt, und vergleicht beide über die letzten 14 Tage. Darunter vergleichst du Erzeugung, Verbrauch und mehr Woche für Woche mit den Vorjahren.",
"en": "The new Forecast view shows whether the node follows its surplus forecast or the season median, and compares the two over the last 14 days. Below it you compare production, consumption and more with the previous years, week by week."
},
"title": {
"de": "Prognose und Jahresvergleich",
"en": "Forecast and year comparison"
}
},
{
"device": "any",
"need": "view_monitoring",
"open": [
"monitoring-learned"
],
"panel": "monitoring-panel",
"target": "monitoring-learned",
"text": {
"de": "Die Lernwerte erscheinen jetzt als üblicher Tag auf einer Zeitachse, mit Nachtruhe und den üblichen Zeiten deiner Geräte. Tippe auf eine Zeile, um den Verlauf übers Jahr zu sehen.",
"en": "The learned values now appear as a usual day on a time axis, with night rest and the usual times of your devices. Tap a row to see how it changes over the year."
},
"title": {
"de": "Ein üblicher Tag",
"en": "A usual day"
}
}
]
}
}
}
32 changes: 29 additions & 3 deletions dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## v0.11.22-pre.35 (2026-11-06)
## v0.11.22-pre.36 (2026-11-06)

### Features

Expand Down Expand Up @@ -35,6 +35,21 @@
- **autolearn:** The node records minute values and keeps every regulator step as a base for learning (#293) (19e65e7)
- **autolearn:** Automation suggestions for surplus and load shifts are checked against your data (#295) (6c255ad)
- **autolearn:** Learning functions can take minute values from Home Assistant (#294) (7aa657e)
- **autolearn:** expose forecast days and the rules that read a learned value (25d731e)
- **demo:** seed a forecast check and a year of season weeks (4a39a77)
- **monitoring:** serve the forecast check and the season weeks from the api (d11383f)
- **monitoring:** collect the forecast check and season weeks for the endpoint (e135dcc)
- **monitoring:** add texts for forecast, season and the usual day (c8b003e)
- **monitoring:** add the insight model for season and forecast (8e5f721)
- **monitoring:** add the usual day to the insight model (80bb7d0)
- **monitoring:** add the forecast and year comparison components (fe3631f)
- **monitoring:** add the forecast view and tab to the monitoring template (bc67258)
- **monitoring:** style the forecast view (1d8f4c8)
- **monitoring:** add the usual day component (5e9d157)
- **monitoring:** show learned values as a usual day (1749c86)
- **monitoring:** style the usual day (72d192a)
- **monitoring:** add a tour target to the forecast tab (ca4f7a0)
- **monitoring:** Monitoring shows the forecast check, a year comparison and the learned values as a usual day (#297)
- **learnrec:** fetch minute values from Home Assistant through the companion (97e2665)
- **learnrec:** pause the own recording while Home Assistant delivers minutes (4086c45)
- **learnrec:** read own minutes first, then Home Assistant, and fetch gaps before the heavy run (44ee05d)
Expand Down Expand Up @@ -334,6 +349,16 @@
- **storage:** offer sticks with several partitions as a group and format single partitions (#243) (c4e6d33)
- **storage:** wipe old file system signatures before formatting a stick (#245) (aeafa63)
- **storage:** set up, back up and replug the additional drive reliably (#247) (b668394)
- **automations:** correct the learning feature after the full review (#296) (88f3c75)
- **monitoring:** keep texts and locale out of the insight model (57e2a44)
- **monitoring:** show the legend items for statistics weeks and gaps (82cde6e)
- **monitoring:** route locale formatting through I18n (a664db2)
- **monitoring:** link the surplus tile to the forecast and follow repeated focus (ebf5e84)
- **monitoring:** harden the insight charts and components (a1eb3a9)
- **monitoring:** keep the forecast view inside the screen and polish the usual day (7751f73)
- **monitoring:** keep one gap between the cards of the forecast and learned views (3168e41)
- **monitoring:** let the forecast view use the full tab width (2d6749e)
- **backup:** A restore stays in place even when the battery state cannot be written (#288) (e5c5437)
- **learning:** reset every learned state through one registry (594282c)
- **autolearn:** survive a detector panic and keep results of finished devices (102cad0)
- **autolearn:** keep harm first, cap open suggestions and give every value a spread (bde4c6a)
Expand All @@ -352,8 +377,6 @@
- **automations:** read the resolve section of the learned vectors in the JS test (2405fe4)
- **webui:** animate the band card and soften the popover close (ae782ae)
- **autolearn:** list findings without a fix only in Monitoring (2e4acd0)
- **automations:** correct the learning feature after the full review (#296)
- **backup:** A restore stays in place even when the battery state cannot be written (#288) (e5c5437)
- **autolearn:** harden the replay against unsupported fields and absent keys (f762aae)
- **automations:** prefill the surplus templates from a suggestion (d977098)
- **automations:** prefill the shift start template from a suggestion (d1b835a)
Expand Down Expand Up @@ -491,6 +514,7 @@

### Tests

- **autolearn:** keep the cycle test window open until today (ab438d5)
- **webui:** follow the template cache-bust mark (c30a3db)
- **smoke:** probe the live push on the house load (5382341)
- **webui:** follow the new cache-bust marks (b06cc13)
Expand All @@ -512,6 +536,8 @@

### Chores

- **monitoring:** drop the texts of the old learned values list (d6da484)
- **webui:** bump cache marks for the monitoring assets (b29e739)
- **webui:** bump the cache-bust marks for the learning review fixes (6c82592)
- **dashboard:** bump the cache-bust marks for the Home Assistant source (8b3bb59)
- **dashboard:** refresh the cache-bust history after the rebase (33c7bcb)
Expand Down
2 changes: 1 addition & 1 deletion dashboard/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.11.22-pre.35
v0.11.22-pre.36
3 changes: 2 additions & 1 deletion dashboard/cmd/dashboard/learn_cycles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ func TestCycleRunnerCollectsCyclesAndSurvivesRestart(t *testing.T) {
// ends a cycle starts at 15 minutes).
at = feedRun(t, r, at, []block{{true, 20}, {false, 20}, {true, 20}, {false, 20}})

to := at.Add(48 * time.Hour)
// AddCycles schreibt in den laufenden Tag des Speichers, also reicht das Fenster bis heute.
to := time.Now().Add(48 * time.Hour)
if got := countCycles(t, days, start, to); got != 2 {
t.Fatalf("cycles before restart = %d, want 2", got)
}
Expand Down
13 changes: 12 additions & 1 deletion dashboard/cmd/dashboard/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,10 @@ func main() {
forecastCheck := autolearn.LoadForecastCheck(filepath.Join(autolearnDir, "forecast.json"), log.Printf)
learnHub.AddSaver("forecast", forecastCheck)
learnHub.AddResetter("forecast", forecastCheck)
// Demo: ohne Prognosetage bekommt die Selbstpruefung die vierzehn Demo-Tage.
if strings.TrimSpace(os.Getenv("ENERGY_NODE_AUTOLEARN_FAST")) == "1" && len(forecastCheck.Days()) == 0 {
autolearn.DemoForecast(time.Now(), forecastCheck)
}
registerEnergyDetectors(automationEngine, pvReserve.Current, pvReserve.DayCount, forecastCheck)
automationEngine.Register(autolearn.BaseLoadDetector)
automationEngine.Register(autolearn.BatteryDetector)
Expand Down Expand Up @@ -710,8 +714,12 @@ func main() {
}
}
automationEngine.SetSeason(seasonStore)
// Demo: ohne Wochenwerte bekommt das Saisongedaechtnis die acht Demo-Wochen.
// Demo: ohne Wochenwerte bekommt das Saisongedaechtnis das Jahr davor und die Demo-Wochen.
// Die Demo-Wochen kommen zuletzt, damit sie die Tageswochen des Jahres davor ueberschreiben.
if strings.TrimSpace(os.Getenv("ENERGY_NODE_AUTOLEARN_FAST")) == "1" && len(seasonStore.Weeks("0000-W00", "9999-W99")) == 0 {
for _, w := range autolearn.DemoSeasonHistory(time.Now()) {
seasonStore.Put(w)
}
for _, w := range autolearn.DemoSeason(time.Now()) {
seasonStore.Put(w)
}
Expand Down Expand Up @@ -1479,6 +1487,9 @@ func main() {
snap := energy.Aggregate(devices, energyResolver, time.Now().UTC())
return monitoringLearned(learned, devices, snap, energyResolver)
},
Forecast: func(now time.Time) httpapi.MonitoringForecast {
return monitoringForecast(forecastCheck, seasonStore, suggestions.currentDoc, now)
},
},
CommandObserver: origin.observeCommand,
StorageFallback: storageFallback,
Expand Down
25 changes: 25 additions & 0 deletions dashboard/cmd/dashboard/monitoring.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package main

import (
"fmt"
"strings"
"sync"
"time"

"github.com/Developer-Simon/energy-node-dashboard/internal/autolearn"
"github.com/Developer-Simon/energy-node-dashboard/internal/energy"
"github.com/Developer-Simon/energy-node-dashboard/internal/httpapi"
"github.com/Developer-Simon/energy-node-dashboard/internal/learnrec"
Expand Down Expand Up @@ -101,3 +103,26 @@ func monitoringLearned(learned httpapi.MonitoringLearned, devices []registry.Dev
}
return learned
}

// monitoringForecast collects the forecast check and the season weeks for
// GET /api/v1/monitoring/forecast. The weeks run from the first ISO week two
// years back up to the ISO week of now. Without a readable rule document the
// readers stay empty.
func monitoringForecast(check *autolearn.ForecastCheck, season *autolearn.SeasonStore, doc func() (autolearn.Doc, bool), now time.Time) httpapi.MonitoringForecast {
year, week := now.ISOWeek()
from := fmt.Sprintf("%04d-W01", year-2)
to := fmt.Sprintf("%04d-W%02d", year, week)
readers := []autolearn.RuleRef{}
if d, ok := doc(); ok {
readers = autolearn.LearnedReaders(d, "site/surplus_left_wh")
}
return httpapi.MonitoringForecast{
Forecast: httpapi.MonitoringForecastCheck{
Needed: autolearn.ForecastWindow,
UseMedian: check.UseSeasonMedian(),
Days: check.Days(),
Readers: readers,
},
Season: httpapi.SeasonView(year, week, season.Weeks(from, to)),
}
}
39 changes: 39 additions & 0 deletions dashboard/cmd/dashboard/monitoring_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import (
"path/filepath"
"reflect"
"testing"
"time"

Expand Down Expand Up @@ -57,3 +59,40 @@ func findMonitoringNotice(notices []monitoring.Notice, id string) *monitoring.No
}
return nil
}

func TestMonitoringForecastCollects(t *testing.T) {
now := time.Date(2026, 11, 23, 12, 0, 0, 0, time.UTC)
season := autolearn.LoadSeasonStore(filepath.Join(t.TempDir(), "season.json"), t.Logf)
season.Put(autolearn.Week{Key: "2024-W01", Source: "days", Days: 7})
season.Put(autolearn.Week{Key: "2022-W10", Source: "days", Days: 7})
check := autolearn.LoadForecastCheck(filepath.Join(t.TempDir(), "forecast.json"), t.Logf)

doc := func() (autolearn.Doc, bool) {
return autolearn.Doc{Rules: []autolearn.Rule{{
ID: "a",
Name: "Wallbox",
Conditions: []autolearn.Condition{{Learned: map[string]autolearn.LearnedRef{"threshold": {Key: "site/surplus_left_wh"}}}},
}}}, true
}
got := monitoringForecast(check, season, doc, now)

if got.Forecast.Needed != autolearn.ForecastWindow {
t.Errorf("Needed = %d, want %d", got.Forecast.Needed, autolearn.ForecastWindow)
}
if got.Season.Year != 2026 {
t.Errorf("Season.Year = %d, want 2026", got.Season.Year)
}
if len(got.Season.Weeks) != 1 || got.Season.Weeks[0].Key != "2024-W01" {
t.Fatalf("Season.Weeks = %+v, want only 2024-W01", got.Season.Weeks)
}
want := []autolearn.RuleRef{{ID: "a", Name: "Wallbox"}}
if !reflect.DeepEqual(got.Forecast.Readers, want) {
t.Errorf("Readers = %+v, want %+v", got.Forecast.Readers, want)
}

none := func() (autolearn.Doc, bool) { return autolearn.Doc{}, false }
got = monitoringForecast(check, season, none, now)
if got.Forecast.Readers == nil || len(got.Forecast.Readers) != 0 {
t.Errorf("without document Readers = %#v, want empty", got.Forecast.Readers)
}
}
113 changes: 103 additions & 10 deletions dashboard/internal/autolearn/demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,21 +724,64 @@ func (b *demoBuilder) fill(rng *rand.Rand) {
}
}

// demoSeasonSeed, demoHistorySeed und demoForecastSeed sind die festen Seeds der
// Wochenwerte, des Jahres davor und der Prognose der Demo.
const (
demoSeasonSeed = demoSeed + 2
demoHistorySeed = demoSeed + 3
demoForecastSeed = demoSeed + 4
// demoHistoryWeeks ist die Zahl der Statistikwochen vor dem Saisongedächtnis.
demoHistoryWeeks = 64
// demoForecastErrW ist die größte Abweichung der Prognose vom Tagesrest in Wh.
demoForecastErrW = 900.0
)

// demoSummer ist der Sommeranteil der ISO-Woche, 0 im Januar und 1 Ende Juni.
func demoSummer(week int) float64 {
return math.Pow(math.Sin(math.Pi*(float64(week)-0.5)/52), 2)
}

// demoNoise ist ein Zufallswert in [-amp, amp] aus dem festen Strom rng.
func demoNoise(rng *rand.Rand, amp float64) float64 {
return (rng.Float64() - 0.5) * 2 * amp
}

// demoWeekEnergy liefert PV, Last, Einspeisung in kWh, die Grundlast in W und die
// Außentemperatur der ISO-Woche week. Die Werte folgen dem Jahresverlauf der
// Referenz, das Rauschen kommt aus rng.
func demoWeekEnergy(rng *rand.Rand, week int) (pv, load, export, base, temp float64) {
s := demoSummer(week)
pv = math.Max(8, 26+205*s+demoNoise(rng, 24))
load = 92 + 58*(1-s) + demoNoise(rng, 9)
export = math.Max(0, pv*0.52-12+demoNoise(rng, 6))
base = 178 + 52*(1-s) + demoNoise(rng, 7)
temp = 1.5 + 17.5*s + demoNoise(rng, 2.2)
return pv, load, export, base, temp
}

// DemoSeason liefert das Saisongedächtnis der Demo: die zwanzig Wochen vor now,
// die älteste zuerst. Jede Woche trägt ihre Außentemperatur, fünf Auslösungen
// der Demo-Regeln, damit der Temperaturvorschlag warme Wochen findet, und die
// gelernte Abschaltzeit der Balkonsteckdose, damit die Jahreslinie erscheint.
// die älteste zuerst. Jede Woche trägt ihre Energiewerte und Außentemperatur, fünf
// Auslösungen der Demo-Regeln, damit der Temperaturvorschlag warme Wochen findet,
// und die gelernte Abschaltzeit der Balkonsteckdose, damit die Jahreslinie erscheint.
func DemoSeason(now time.Time) []Week {
rng := rand.New(rand.NewSource(demoSeasonSeed))
out := make([]Week, 0, demoSeasonWeeks)
for k := demoSeasonWeeks; k >= 1; k-- {
at := now.AddDate(0, 0, -7*k)
_, w := at.ISOWeek()
pv, load, export, base, _ := demoWeekEnergy(rng, w)
temp := demoWeekTempC[k-1]
out = append(out, Week{
Key: isoWeekKey(now.AddDate(0, 0, -7*k)),
Source: seasonSourceDays,
Days: 7,
TempC: &temp,
Triggers: map[string]float64{demoRuleID: 5, demoPVRuleID: 5},
Learned: map[string]float64{demoBedtimeKey: demoBedtimeMin + 6*math.Sin(float64(k))},
Key: isoWeekKey(at),
Source: seasonSourceDays,
Days: 7,
ExportKWh: export,
PVKWh: pv,
LoadKWh: load,
BaseW: base,
TempC: &temp,
Triggers: map[string]float64{demoRuleID: 5, demoPVRuleID: 5},
Learned: map[string]float64{demoBedtimeKey: demoBedtimeMin + 6*math.Sin(float64(k))},
})
}
// Dieselben Wochen in den zwei Jahren davor: der Akku war damals selten leer,
Expand All @@ -747,7 +790,16 @@ func DemoSeason(now time.Time) []Week {
for back := 1; back <= 2; back++ {
for k := 0; k <= demoPriorWeeks; k++ {
y, w := now.AddDate(0, 0, -7*k).ISOWeek()
week := Week{Key: fmt.Sprintf("%d-W%02d", y-back, w), Source: seasonSourceDays, Days: 7, BaseW: demoSeasonBaseW}
pv, load, export, _, _ := demoWeekEnergy(rng, w)
week := Week{
Key: fmt.Sprintf("%d-W%02d", y-back, w),
Source: seasonSourceDays,
Days: 7,
ExportKWh: export,
PVKWh: pv,
LoadKWh: load,
BaseW: demoSeasonBaseW,
}
if back == 1 {
share := 0.1
week.EmptyShare = &share
Expand All @@ -758,6 +810,47 @@ func DemoSeason(now time.Time) []Week {
return out
}

// DemoSeasonHistory liefert die demoHistoryWeeks Statistikwochen vor den Wochen
// von DemoSeason, die älteste zuerst. Sie tragen Energiewerte und Temperatur, aber
// keine Auslösungen und keine gelernten Werte.
func DemoSeasonHistory(now time.Time) []Week {
rng := rand.New(rand.NewSource(demoHistorySeed))
out := make([]Week, 0, demoHistoryWeeks)
for k := demoSeasonWeeks + demoHistoryWeeks; k > demoSeasonWeeks; k-- {
at := now.AddDate(0, 0, -7*k)
_, w := at.ISOWeek()
pv, load, export, base, temp := demoWeekEnergy(rng, w)
out = append(out, Week{
Key: isoWeekKey(at),
Source: seasonSourceStats,
Days: 7,
ExportKWh: export,
PVKWh: pv,
LoadKWh: load,
BaseW: base,
TempC: &temp,
})
}
return out
}

// DemoForecast schreibt die vierzehn Tage vor now in die Prognose-Selbstprüfung c.
// Jeder Tag bekommt eine Prognose des Tagesrests ab 10:00, den gemessenen Rest und
// den Saisonmedian. Die Prognose liegt meist näher am Rest als der Median, daher
// bleibt die Prognose im Einsatz.
func DemoForecast(now time.Time, c *ForecastCheck) {
rng := rand.New(rand.NewSource(demoForecastSeed))
y, m, d := now.Local().Date()
for k := ForecastWindow; k >= 1; k-- {
day := time.Date(y, m, d-k, 0, 0, 0, 0, time.Local).Format(dayLayout)
actual := math.Max(300, 2600+demoNoise(rng, 1900))
forecast := math.Max(0, actual+demoNoise(rng, demoForecastErrW))
season := 2750 + demoNoise(rng, 260)
c.Record(day, forecast)
c.Close(day, actual, season)
}
}

// DemoDailyShare liefert den Tagesanteil der Lernlast für die letzten
// demoShareDays Tage vor now, den der Lernstand der Demo beim ersten Start
// bekommt. Der Anteil liegt unter der Hälfte des Ziels der Stufe eco.
Expand Down
Loading
Loading