-
-
Notifications
You must be signed in to change notification settings - Fork 123
Load ML Improvements, Put back GivTCP Load #3392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
e69f775
04e5925
d1e7ed7
e770310
8f6b706
76dd55a
cdbb3b3
61d8b3b
de534a0
c5b5408
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1083,3 +1083,352 @@ series: | |||||||||||||||||||||
| let res = []; for (const item of entity.attributes.detailedForecast) { | ||||||||||||||||||||||
| res.push([new Date(item.period_start).getTime(), item.pv_estimateCL]); } | ||||||||||||||||||||||
| return res.sort((a, b) => a[0] - b[0]); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ############################################### | ||||||||||||||||||||||
| #------------------------ML Home Load Forecast (excl EV)------------------------------- | ||||||||||||||||||||||
| ############################################### | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| type: custom:apexcharts-card | ||||||||||||||||||||||
| header: | ||||||||||||||||||||||
| show: true | ||||||||||||||||||||||
| title: ML Home Load Forecast (excl EV) | ||||||||||||||||||||||
| show_states: true | ||||||||||||||||||||||
| colorize_states: true | ||||||||||||||||||||||
| graph_span: 4d | ||||||||||||||||||||||
| update_interval: 15min | ||||||||||||||||||||||
| span: | ||||||||||||||||||||||
| start: day | ||||||||||||||||||||||
| offset: "-2d" | ||||||||||||||||||||||
| apex_config: | ||||||||||||||||||||||
| legend: | ||||||||||||||||||||||
| show: true | ||||||||||||||||||||||
| now: | ||||||||||||||||||||||
| show: true | ||||||||||||||||||||||
| yaxis: | ||||||||||||||||||||||
| - id: forecasts | ||||||||||||||||||||||
| show: true | ||||||||||||||||||||||
| opposite: true | ||||||||||||||||||||||
| decimals: 0 | ||||||||||||||||||||||
| max: 60 | ||||||||||||||||||||||
| min: 0 | ||||||||||||||||||||||
| apex_config: | ||||||||||||||||||||||
| tickAmount: 6 | ||||||||||||||||||||||
| - id: mae | ||||||||||||||||||||||
| show: false | ||||||||||||||||||||||
| opposite: true | ||||||||||||||||||||||
| decimals: 2 | ||||||||||||||||||||||
| max: auto | ||||||||||||||||||||||
| min: -0.1 | ||||||||||||||||||||||
| apex_config: | ||||||||||||||||||||||
| tickAmount: 6 | ||||||||||||||||||||||
| series: | ||||||||||||||||||||||
| - entity: sensor.predbat_load_ml_stats | ||||||||||||||||||||||
| attribute: load_today | ||||||||||||||||||||||
| stroke_width: 2 | ||||||||||||||||||||||
| extend_to: now | ||||||||||||||||||||||
| curve: smooth | ||||||||||||||||||||||
| name: Load | ||||||||||||||||||||||
| opacity: 0.2 | ||||||||||||||||||||||
| type: area | ||||||||||||||||||||||
| yaxis_id: forecasts | ||||||||||||||||||||||
| color: orange | ||||||||||||||||||||||
| - entity: sensor.predbat_load_ml_stats | ||||||||||||||||||||||
| attribute: load_today | ||||||||||||||||||||||
| stroke_width: 3 | ||||||||||||||||||||||
| extend_to: now | ||||||||||||||||||||||
| curve: smooth | ||||||||||||||||||||||
| name: Load | ||||||||||||||||||||||
| opacity: 1 | ||||||||||||||||||||||
| type: line | ||||||||||||||||||||||
| yaxis_id: forecasts | ||||||||||||||||||||||
| color: orange | ||||||||||||||||||||||
| show: | ||||||||||||||||||||||
| in_header: false | ||||||||||||||||||||||
| in_legend: false | ||||||||||||||||||||||
| - entity: sensor.predbat_load_ml_forecast | ||||||||||||||||||||||
| stroke_width: 3 | ||||||||||||||||||||||
| curve: smooth | ||||||||||||||||||||||
| name: ML Load | ||||||||||||||||||||||
| color: red | ||||||||||||||||||||||
| opacity: 0.35 | ||||||||||||||||||||||
| yaxis_id: forecasts | ||||||||||||||||||||||
| show: | ||||||||||||||||||||||
| in_header: false | ||||||||||||||||||||||
| in_legend: true | ||||||||||||||||||||||
| data_generator: > | ||||||||||||||||||||||
| let res = []; for (const [key, value] of | ||||||||||||||||||||||
| Object.entries(entity.attributes.results)) { res.push([new | ||||||||||||||||||||||
| Date(key).getTime(), value]); } return res.sort((a, b) => { return a[0] - | ||||||||||||||||||||||
| b[0] }) | ||||||||||||||||||||||
|
Comment on lines
+1160
to
+1163
|
||||||||||||||||||||||
| let res = []; for (const [key, value] of | |
| Object.entries(entity.attributes.results)) { res.push([new | |
| Date(key).getTime(), value]); } return res.sort((a, b) => { return a[0] - | |
| b[0] }) | |
| if (!entity || !entity.attributes || !entity.attributes.results) return []; | |
| const res = []; | |
| for (const [key, value] of Object.entries(entity.attributes.results || {})) { | |
| res.push([new Date(key).getTime(), value]); | |
| } | |
| return res.sort((a, b) => a[0] - b[0]); |
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Legend/series names are duplicated (both the -1h and -8h series are named "FC"), which makes them indistinguishable in the legend/tooltip. Use distinct names (e.g., "FC -1h" and "FC -8h").
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Legend/series names are duplicated here as well (both forecast-offset series are named "FC"), which makes it hard to tell them apart in the legend/tooltip. Use distinct names for the -1h vs -8h series.
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cumulative-kWh → power conversion doesn’t guard against negative deltas (e2 < e1), which can happen if the cumulative series resets/backsteps and will produce misleading negative power spikes. Consider skipping negative dE values (similar to the later rolling-average generator) or otherwise handling resets explicitly.
Copilot
AI
Feb 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The label says "Home Power (Avg 1h)", but group_by.duration is set to 6h, so the displayed series won’t match the name. Either change the name or adjust the group_by duration to align with the label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading REST "Load_Power" directly changes semantics and breaks the existing assumption (and fixtures) that GivTCP load is unreliable during some modes (e.g., grid charging). The repo’s REST fixtures show Load_Power != PV_Power + Grid_Power + Battery_Power (e.g., coverage/cases/rest_v2.json has Load_Power=624 but balance=590; rest_v3.json has 197 vs balance=233), and tests assert the energy-balance value. Consider reverting to the balance calculation, or make using Load_Power an opt-in config with a safe fallback when it disagrees significantly with the energy balance.