The new Plan and Home tabs in #418 surface yesterday's export totals from `/attribution/day` and `/energy/report`, but per-slot realized export kWh isn't logged anywhere. `/api/v1/execution/today` carries consumption per slot but no export counterpart.
This means we can't:
- Overlay realized export kWh on the "Yesterday + actuals" rates chart (we have rates and import kWh; export kWh is the missing piece).
- Compute precise per-slot export earnings (we currently estimate `yesterday total kWh × current export rate`, flagged as estimate in the UI).
What's needed
- Add `export_kwh` column to `execution_log` table (migration).
- Compute it in the heartbeat:
- When `grid_kw < 0` for the slot duration, integrate to kWh and store.
- Source: Fox grid power measurements (same source as the existing `consumption_kwh`).
- Expose in `/api/v1/execution/today` response.
- Plumb through the type in ExecutionSlot (already declared in the UI types as `export_kwh?`, currently always undefined).
- (Optional) Backfill historical export_kwh from existing `pv_realtime_history` rows if available, otherwise leave NULL.
Why now
UI rebuild (#418) exposed the gap. Without this, the rates view on Plan can show today/tomorrow/yesterday import + export rates side-by-side but only realized import — half the story.
Workaround until shipped: UI shows totals from `/attribution/day` (daily aggregate) and flags estimates as estimates.
The new Plan and Home tabs in #418 surface yesterday's export totals from `/attribution/day` and `/energy/report`, but per-slot realized export kWh isn't logged anywhere. `/api/v1/execution/today` carries consumption per slot but no export counterpart.
This means we can't:
What's needed
Why now
UI rebuild (#418) exposed the gap. Without this, the rates view on Plan can show today/tomorrow/yesterday import + export rates side-by-side but only realized import — half the story.
Workaround until shipped: UI shows totals from `/attribution/day` (daily aggregate) and flags estimates as estimates.