Repository navigation
feat(live-chart): surface EV charger power as its own series - #190
Conversation
The Energy Balance overview shows EV charging power, but the Live chart
doesn't — so when the car is pulling 7 kW it's buried inside the Load
line. Now every driver that reports ev_w gets its own chart series
(one per charger), discovered and rendered the same way battery
drivers are.
Mirrors the per-battery discovery pattern:
- chartEVs map with one series per driver (append on status tick,
backfill zeros for drivers that go quiet so index alignment with
chartHistory.timestamps is preserved)
- Distinct fuchsia/magenta palette (EV_PALETTE) so EV lines can't be
confused with battery lines (amber/purple) or PV (green)
- Dynamic legend entry + click-to-hide, persisted via legendHidden
- Inline EV row in the hover tooltip, without the battery's
"target" column — EV chargers don't have a separate commanded
power target worth charting
- Reset-and-rediscover on history replay so a freshly-plugged-in
charger shows up on next reload rather than waiting for a new
/api/status poll
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e5e124565c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var pad = chartHistory.timestamps.length; | ||
| var slot = { ev: new Array(pad).fill(0) }; |
There was a problem hiding this comment.
Pad new EV series to prior sample count
ensureEVDriver initializes slot.ev with chartHistory.timestamps.length zeros, but callers invoke it after pushing the current timestamp and then append the current ev_w sample. On the first sample for a charger this produces [0, firstSample, ...], so EV values become one index behind chartHistory.timestamps (the newest EV point is not shown at the current time). This affects both live updates (pushChartData) and history replay (loadHistory) whenever an EV driver is first discovered.
Useful? React with 👍 / 👎.
Why
When the car is charging the Energy Balance overview clearly shows it (e.g. 7.20 kW), but the Live chart buries that power inside the Load line — so a pattern like "car started pulling 7 kW around 10:15" isn't visible at a glance. Fixes that by giving every EV charger its own series on the Live chart.
What
Mirrors the per-battery discovery already in place:
chartEVsmap, one series per driver that reportsev_w.Test plan
go test ./...— 576 tests pass across 38 packages🤖 Generated with Claude Code