Repository navigation
Loadpoint UI: time-based values instead of session values for integrated devices (BC) - #35525
Conversation
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="core/metrics/db_flow.go" line_range="384" />
<code_context>
res.Co2 = &co2
}
+ res.entities = entities
return res, nil
}
</code_context>
<issue_to_address>
**Loadpoint cards show combined usage**
When two loadpoints in the same group have the same configured title, `QueryFlow` maps both loadpoint IDs to a shared `flowEntity`, so `periodStats` returns combined meters, energy, autarky, and prices for each loadpoint; both cards show the combined values as their own.
Keep flow attribution separate by loadpoint ID instead of sharing a title-aggregated entity.
Also at `core/metrics/db_flow.go:177`, `core/metrics/stats.go:47-49`.
</issue_to_address>
### Comment 2
<location path="core/metrics/stats.go" line_range="65" />
<code_context>
res := EnergyStats{slot: slotStart}
- sqlDB, err := db.Instance.DB()
+ today, err := periodStats(entity, midnight, slotStart)
if err != nil {
return res, err
</code_context>
<issue_to_address>
**Period attribution stays stale**
When the loadpoint collector computes stats at a slot boundary before other collectors have persisted their completed-slot readings, `energyStats` calls `periodStats` before other collectors have persisted their completed-slot readings, so `QueryFlow` caches incomplete attribution for that slot; later readings do not trigger a refresh, and the published autarky and price values remain wrong until the next slot.
Compute and cache period stats from a consistent snapshot after the slot’s collector writes complete, or invalidate the cached stats when those writes land.
</issue_to_address>
### Comment 3
<location path="core/metrics/stats.go" line_range="71-75" />
<code_context>
- ).Scan(&res.Today, &res.Last24h, &res.Last7d)
-
- return res, err
+ if res.Last24h, err = periodStats(entity, slotStart.Add(-24*time.Hour), slotStart); err != nil {
+ return res, err
+ }
+ if res.Last7d, err = periodStats(entity, slotStart.AddDate(0, 0, -7), slotStart); err != nil {
</code_context>
<issue_to_address>
**Stats refreshes repeat database scans**
When multiple loadpoints refresh their stats, especially with a large meter history, `energyStats` calls `periodStats` for today, 24 hours, and 7 days, and each call runs `QueryFlow` over meter, sink, and flow data. Repeating those scans for each loadpoint increases database load and delays stats updates.
Reuse flow attribution across the period calculations and loadpoints instead of rerunning `QueryFlow` for every period.
</issue_to_address>
### Comment 4
<location path="assets/js/components/Loadpoints/SessionInfo.vue" line_range="133-134" />
<code_context>
+ options(): Option[] {
+ const periods = this.experimental ? this.periodOptions : [];
+ // integrated devices drop the session once periods replace it
+ const session =
+ this.chargerFeatureIntegratedDevice && periods.length ? [] : this.sessionOptions;
+ return [...session, ...periods].filter((option) => option.available);
},
</code_context>
<issue_to_address>
**Integrated devices retain session values**
When the device is integrated and experimental mode is off, or no period stats are available, `periods.length` is false, so `session` remains `this.sessionOptions` and the dropdown keeps session values; the card displays misleading session data.
Suppress `sessionOptions` for integrated devices regardless of whether period options are available.
</issue_to_address>
Ja, da arbeiten wir ja schon länger drauf hin 😆. Neue Energy-Seite und so ... Aber noch nicht in diesem PR. Followup Thema. |
|
@naltatis Ist Autarkie für einzelne Verbraucher/Ladepunkte wirklich der treffendere Begriff oder sollte man lieber bei PV-Anteil bleiben? Ich würde den Begriff Autarkie nur in Bezug auf Gesamtverbrauch von Site sehen. |
|
Ist vor dem Hintergrund zu #33251. Ich bin aber offen für alternatives Wording oder klarere Beschreibung hier. |
|
Eigentlich müsste nur die Autarkiequote an der Batterie gespeichert werden und sich dann vererben. Dann wäre es auch bzgl. Netzladen korrekt. |
Stimmt, das wäre eine gute Idee. Das bedeutet die Hausbatterie braucht eine Autarkiequote, wieviel Netzenergie und Pv-Energie gespeichert ist. Wenn ein Ladepunkt dann Energie aus der Batterie bekommt, geht nur die geladene Energiemenge x Autarkie(Batterie) in den Pv-Anteil des Ladepunktes mit ein. Damit könnte man dann beim Wording PV-Anteil bleiben. Der PV-Anteil des Ladepunktes setzt sich dann aus Direktverbrauch + PV-Anteil der Batterieenergie zusammen. |
Linked issuesChecked at commit aa52d2d #35454 Misleading PV indicator for heatpump · 1 of 1 met
|
|
@florian240483 @Tombra1889 tried different "Autarky" alternatives. "Solar & battery (24h)" is the most descriptive and technically correct one. "Solar share", "Self-supply", "Own energy", "Self-produced" are also valid alternatives. But for now, I'd say we skip this discussion here and and go with the existing "Solar" wording we already have for sessions. Needs a proper rename/cleanup later in all places. |

fixes #35454, refs #19753
Session values mislead for heaters. The card now also offers the rolling 24h and 7d windows, attributed like the Energy page, so both views agree.
last24handlast7d: energy, pv energy, battery energy, average price, cost. Grid is the rest.todayEnergyunchanged.CustomSelectsupports optgroups via agroupfield on the option.last24hEnergyandlast7dEnergyare replaced by thelast24handlast7dobjects, in the state API and on MQTT.Screenshots
Published loadpoint data, excerpt:
Follow-ups: remove integrated devices from the charging sessions log, clarify the "Solar" naming (pv and battery are already published separately).
🤖 Generated with Claude Code