feat(grafana): add Trip Cost and Cost/100km panels to Drive Details - #5334
feat(grafana): add Trip Cost and Cost/100km panels to Drive Details#5334finikwashere wants to merge 1 commit into
Conversation
Add two new stat panels to the Drive Details internal dashboard that
estimate the cost of a trip based on recent charging price data:
- Trip Cost (est.): total estimated cost for the drive
- Ø Cost / 100 <unit>: estimated cost per 100 km or 100 mi
Cost/kWh is determined by a 3-tier lookup:
1. Average cost/kWh across all charging sessions that ended within
the 24 hours before the drive started (the most relevant window)
2. Fallback: cost/kWh of the single most recent charge before
the drive, if no sessions exist in the 24h window
3. N/A if no prior charge has cost data at all
Both panels are placed at y=28 alongside the existing Distance driven
and Elevation Summary panels (all resized to w=3 to fit on one row).
✅ Deploy Preview for teslamate ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thanks for your idea. Cost per drive is not a metric which is valuable, even for a trip it is misleading, see #2433 (comment) and #4678 (comment) |
|
Sorry for the terse close — let me give the actual reasoning, since the #4678 argument (SOC delta over a period) doesn't apply to your approach. Your energy figure is per-drive and fine. The problem is the price side: there is no link in the data between a charging session and the energy a given drive consumed. The 24h window is an arbitrary cut-off, and the fallback has no time limit at all — a drive can be priced with a charge from months earlier. Two identical drives get different costs depending on whether a Supercharger stop happened to precede one of them, even though most of the energy came from home charging. Without FIFO attribution of charged kWh to drives, a per-drive cost isn't derivable from what TeslaMate stores, and a stat panel with 2 decimals implies a precision we don't have. That's different from the trip dashboard, which shows money actually spent in the selected period rather than a synthesized per-drive price. 🤖 Review drafted with Claude Code](https://claude.com/claude-code) (Opus 5 high) — sponsored by Claude for Open Source |
Closes #5333
Added two new stat panels to the Drive Details dashboard that estimate the cost of a trip based on recent charging price data:
Cost/kWh is determined by a 3-tier lookup:
Both panels are placed at y=28 alongside the existing Distance driven and Elevation Summary panels (all resized to w=3 to fit on one row).