Commit graph

8 commits

Author SHA1 Message Date
dlawler489
591da31e60 Fix range_days undercounting for the "all time" battery range
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 18s
(end - start).days truncates instead of rounding, so "all time" (which
starts at the earliest reading's exact timestamp, rarely local midnight)
could report fewer range_days than days_with_data -- reads backwards
("5 of 4 days have data"). Round the duration up instead; day-aligned
presets and custom ranges are unaffected since they're already exact
multiples of 24h.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 11:13:19 +10:00
dlawler489
c30165c153 Add longer battery ranges and a custom date-range picker
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 22s
Extends the battery card's range beyond Today/3 days/This week to Last 30
days, Last 365 days, All time, and a user-picked custom start/end date.
Since battery telemetry is only ever captured on the live "today" poll and
never backfilled, a long or all-time range typically has real gaps -- the
card now shows how many of the requested days actually have battery data
rather than implying continuous history.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 11:10:20 +10:00
dlawler489
353f154626 Add battery SOC history chart and estimated battery value to dashboard
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 20s
New card (hidden entirely for solar-only plants) shows: an SOC curve over
Today/Last 3 days/This week, and an estimate of what the battery actually
saved -- discharged energy valued at the import rate it avoided, minus
charged energy valued at the feed-in credit given up, both matched against
the current plan's own time-of-use windows.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 09:14:07 +10:00
dlawler489
918ea39e8d Include solar export credit in the TOU cost breakdown
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 19s
Previously only showed import cost by tariff period; now also shows the
feed-in/export credit components alongside it, plus a net (usage cost
minus export credit) total.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 08:16:10 +10:00
dlawler489
ad232447b8 Add data freshness indicator, TOU cost breakdown, and solar self-consumption stats to dashboard
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 23s
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 07:45:05 +10:00
dlawler489
9e66a9a97d Add battery telemetry for plants with a hybrid inverter/ESS
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 24s
Confirmed against Sungrow's own docs and live-tested against a real
battery plant: SOC and charge/discharge power live at the *device*
level (getDeviceRealTimeData against the hybrid inverter's ps_key,
device_type 14), not in the plant-aggregate points used elsewhere in
this client -- querying them via the plant-level endpoint just returns
null. Battery status is fetched once per live "today" poll (not
backfilled historically) and stored in three new nullable columns,
self-migrated on startup since there's no Alembic here.

Also fixes the dashboard's self-consumption line to derive from
load - import rather than generation - export, which overstated
"solar -> house" for battery systems (a chunk of that gap was going
into charging, not the house). The live flow diagram now shows a
Battery node (SOC + charge/discharge) that stays hidden entirely for
solar-only plants like Kallangur.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-09 12:25:09 +10:00
dlawler489
3d7c8d9ca0 Add live power-flow diagram and net revenue to the dashboard
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 24s
New /api/usage/live endpoint derives instantaneous-ish kW from the most
recent interval reading, shown as a solar -> house/grid flow diagram
that updates every 30s and flips direction/color between exporting and
importing. /api/usage/summary now also reports net revenue for the
selected period, reusing the existing costing engine against the
current plan.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-09 11:52:16 +10:00
dlawler489
84c4922bbc Initial commit: solar usage vs AER plan comparison app
FastAPI app that pulls interval usage from Sungrow iSolarCloud (OAuth2),
caches AER Consumer Data Right electricity plan data, and compares actual
metered usage against every available plan to estimate real annual cost
(TOU, tiered feed-in, and flat tariffs).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-09 11:07:01 +10:00