-
Notifications
You must be signed in to change notification settings - Fork 0
Feature Charging History and Cost
Because BavarianData streams data in real time, it records every completed charging session and can put a price on it — all from the stream, spending no REST quota.
BMW never sends a kWh counter, so the integration integrates the live charging power over time into two sensors per vehicle:
-
Charged Energy (Total) — a monotonic kWh counter
(
device_class: energy/state_class: total_increasing). Add it to the Energy dashboard as an "individual device" to see and cost your car's charging alongside the rest of the house. - Charged Energy (Session) — resets at the start of every session.
Both work on any vehicle that streams charging power.
Every completed session is recorded and kept in the integration's own store rather than the recorder (which purges after ten days). It captures start/end SoC, energy, duration, peak power, the charging power curve, and cost.
Retention is set by history_retain_months under
Configure → Charging costs & history (0 = keep everything).
Set this up under Configure → Charging costs & history (Settings reference). Pick a price source:
- Fixed price per kWh — a flat rate you know.
- Live price entity — point it at Tibber, Nordpool, aWATTar, … That entity is sampled while the car charges, so a session spanning a price change is billed correctly rather than at whatever the price happened to be at the end.
Until you choose a price source, no cost entities are created at all — a wrong number would be worse than none.
You then get, per vehicle:
- Charging Energy (This Month) — always available.
- Charging Cost (This Month) and Charging Cost (Last Session) — once a price source is set.
- Charging Cost per 100 km — additionally needs the odometer (Vehicle status cluster) and two sessions to measure a distance between.
Energy is measured at the battery, so it's slightly below what the grid delivered. Two ways to reconcile:
-
Wallbox sensor — select your wallbox energy sensor
(
grid_energy_entity) and that exact grid figure is used instead. -
Loss percentage — otherwise gross the battery figure up by your charging
losses (
charging_loss_percent). It stays at 0 % by default, because an invented correction would look like a measurement.
A session charged while the price was briefly unknown is flagged partial
rather than silently understated.
The bavariandata.fetch_charging_history service pulls BMW's own recorded
sessions and imports them into the local history, so charges from before you
installed the integration appear on the card and in the monthly summaries.
Overlapping live-recorded sessions are enriched in place with BMW's measured
grid energy. This one does spend API quota (one or more of your 50/24 h).
- The
view: chargingcard. -
bavariandata.get_charging_sessionsreturns the full history as service response data (optionalvin,from,to,limit) — no quota. - Export to CSV or a printable report.
- Long-term statistics on the Energy dashboard.
BavarianData is an independent, community-built integration and is not affiliated with, endorsed by, or sponsored by BMW Group. "BMW", "Mini", "Rolls-Royce" and "CarData" are trademarks of their respective owners. Screenshots and documentation images of the MyBMW / BMW CarData portal are © BMW AG, shown here solely to document how to set up the service; personal data has been redacted. Released under the MIT License. · Issues · Discussions
Getting started
The card
Features
- Entities & devices
- Charging history & cost
- Battery health
- Trips
- Energy & statistics
- Export
- Events & blueprints
- API quota
Reference