BavarianData

Manual / Reference

Services reference

Every service is available in Developer Tools → Actions and (for most) as a button in the integration’s Configure menu.

Every service that acts on a car has a Vehicle picker (device_id), plus the older vin and entry_id fields, which still work. With one car you need none of them. Picking the car also picks its account, so with two accounts (a BMW and a MINI, say) the picker is all you need.

With two cars, a service that acts on one car (a tire diagnosis, a mileage report, an export…) refuses a call that doesn’t say which car, and the error lists the cars to choose from. A service that reads every car (fetch_telematic_data, get_charging_sessions, get_charging_places, get_trips, get_coverage_report, import_statistics) still reads them all when no car is named. A VIN that isn’t a car of the account is refused before any quota is spent. A call that runs out of quota, has no valid token or that BMW refuses fails with that message, so the automation stops instead of looking like it worked.

Fetch services — spend API quota ⚡

Each of these spends one or more of your 50 requests a day. The first two run automatically once a day as the daily refresh; calling them by hand just fetches early and spends an extra request.

ServiceWhat it fetches
bavariandata.fetch_telematic_dataCurrent contents of the telematics container — every field BMW cannot stream, and the streamable fields of your data groups, in one request. Without a vin it refreshes every vehicle on the account, one request each.
bavariandata.fetch_vehicle_mappingsVehicles linked to the account and their PRIMARY/SECONDARY status. A primary car this entry has not seen yet is added as a device (one more request, once). It does not switch on streaming — tick the car’s fields in the portal via Configure → Choose streamed data.
bavariandata.fetch_basic_dataStatic vehicle metadata (model, series, …).
bavariandata.fetch_charging_historyBMW’s charging sessions (paginated; optional from/to), imported into local history and enriched with measured grid energy.
bavariandata.fetch_tyre_diagnosisSmart-maintenance tire diagnosis — tread wear, remaining mileage, defect status per wheel. Populates the tire sensors and the card’s wheel diagram.
bavariandata.fetch_location_charging_settingsLocation-based charging settings (paginated).
bavariandata.fetch_vehicle_imageVehicle render (updates the cached image entity).

Local services — no quota

These read (or write) the integration’s own store and cost no quota.

ServiceWhat it does
bavariandata.get_charging_sessionsRecorded charging sessions as response data.
bavariandata.get_charging_placesThe places the car has charged at, with the speed at each — see below.
bavariandata.get_tripsRecorded trips as response data (endpoints as place names), plus any drive still under way.
bavariandata.get_driving_summaryThe month-in-review aggregation for trips.
bavariandata.get_efficiencyMeasured consumption, the real range it implies, the charging loss and the monthly trend — see below.
bavariandata.get_mileage_reportHow far the car is driven and where it stands against its mileage allowance — see below.
bavariandata.get_fuel_historyA petrol, diesel or plug-in hybrid car’s refuels and fuel consumption, read off its tank level — see below.
bavariandata.get_evcc_configThe evcc custom vehicle configuration for a car, plus the bridge’s MQTT topics — see below.
bavariandata.set_trip_classCorrects a trip’s business/private/commute class.
bavariandata.set_charge_costEnters what a charge cost (a receipt), or takes it back — see below.
bavariandata.mark_trip_startNotes when a drive began, for a car that reports only once parked — see below.
bavariandata.export_historyReturns a month as CSV or a printable HTML report.
bavariandata.get_coverage_reportDescriptor-coverage self-test — see below.
bavariandata.import_statisticsRebuilds the long-term statistics from the store.
bavariandata.activate_stream_fieldsReplaces which attributes BMW streams, by replaying the portal’s stream-setup request — see below.

Field details

get_charging_sessions / get_trips

vin, from, to, limit. Returns records newest-first as response data (tick Return response in Developer Tools).

A bare date names the whole day in Home Assistant’s time zone, at whichever end it is used: from: 2026-08-01 starts at your midnight and to: 2026-08-31 runs to the end of the 31st, so asking for a month doesn’t silently drop its last day. Pass an explicit date/time instead and it is used exactly as given.

get_trips also returns open_trips — a drive still under way, which is not in the journal yet: no end, no classification, a provisional distance and the route so far when route recording is on. It rides along whenever the window you asked for contains the present moment (including no window at all): a request for last March plainly doesn’t mean the drive happening now, but one for this month just as plainly does. See Trips.

get_charging_places

vin, from, to (whole days, as above). Returns places, most visited first, worked out from the stored sessions, and locations_remembered (whether Remember charging locations is on). Each place carries zone, address, provider, latitude/longitude (only with remembered locations), assumed, unnamed, kind (ac, dc or mixed), visits, first_visit, last_visit, energy_kwh, typical_minutes, avg_kw with power_visits, best_kw, minutes_per_10 with rate_visits, preconditioning (on/off, or null) and curves. A figure from one visit is that visit’s; from two on it is the median. See Charging places.

get_driving_summary

vin, month (YYYY-MM, defaults to current). Returns distance, the business/private/commute split, consumption, recuperation, driving-style score, top destinations, and (with a tariff) estimated driving cost.

Consumption comes back as two independent figures, either of which may be absent when its inputs don’t support one:

  • energy_balance — an object with kwh_per_100km plus the window and the inputs it came from. Its source says which side of the charger it describes: "grid" only when every contributing session carried a measured grid_kwh, otherwise "battery" (BMW streams battery charging power, so an estimated session never measured the wall). Read source before labeling the number — the two differ by the charging losses.
  • avg_consumption_kwh_per_100km — battery-side, from the trips.

Recuperation is recuperation_kwh_per_100km, a distance-weighted mean rather than a total. See how consumption is measured.

get_efficiency

vin. Returns the measured-efficiency profile: consumption, the real range it implies, the charging loss, and a month-by-month trend. Reads the local store, so it costs no BMW API quota.

  • consumption — battery-side kwh_per_100km plus window_days (30, 90, 365, or null when it took the whole ledger) and the odometer window it was measured over. grid_consumption is the same figure at the plug, present only when every charge in that same window carried a measured grid_kwh.

  • measured_loss_percent — the gap between the two, when both exist. This is measured, and is a different thing from the charging loss % setting, which is an assumption used for costing.

  • range — full_km, now_km (scaled by the current charge), bmw_km (the car’s own prediction) and vs_bmw_percent. Absent when either the capacity or the consumption is unknown.

  • capacity_kwh / capacity_source — measured once battery health is confident, otherwise bmw.

  • trend — one entry per calendar month that could be measured, oldest first; months whose charging couldn’t bracket enough distance are omitted rather than shown as zero.

  • cost_per_100km / currency / energy_mix — this month’s running cost and where its energy came from.

  • by_temperature — consumption per outside-temperature band, from trips with route weather: bands (each from_c, to_c, trips, km, kwh_per_100km, the last null below 30 km), cold_kwh_per_100km (below 5 °C), mild_kwh_per_100km (15–25 °C), cold_penalty_percent and trips. Its status is ok, no_weather or plug_in_hybrid.

  • bmw_lifetime — BMW’s own lifetime figures from its OBFCM counters, or null when the car sends none: fuel_l_per_100km and distance_km, and on a plug-in hybrid also electric_kwh_per_100km (engine off), electric_km, grid_kwh_per_100km (all driving) and electric_share_percent.

status says why a figure is missing: ok, not_enough_history, no_capacity, or plug_in_hybrid (consumption, range, trend and cost_per_100km are all withheld on a hybrid; bmw_lifetime is what the card shows instead). See Efficiency & real range.

get_mileage_report

vin. Returns the mileage overview as response data, read off the car’s daily odometer log, so it costs no BMW API quota. All distances are in km.

  • odometer_km, since — the newest reading and the day the log starts.
  • this_month, this_year — {km, partial}; partial when the period began before the log did. A partial this_year also carries estimated_km once the pace is known: km plus the days before the log at that pace.
  • km_per_day, projected_year_km — the 90-day pace; null until the readings span four weeks.
  • months — the last 12 calendar months, oldest first: {month: "YYYY-MM", km, partial}, km null where the log doesn’t reach.
  • allowance — null without one. Otherwise kind (lease/yearly), start, end, allowance_km, per_year_km and status: ok, ended, not_started or unknown (no odometer for the start). With ok or ended also used_km, plan_km, balance_km (plan minus used, positive = under plan), remaining_km, days_left, km_per_day_left, projected_km and projected_over_km.

get_fuel_history

vin. Returns the Fuel view’s data as response data, read off the car’s tank level, so it costs no BMW API quota. Only a car with an engine keeps a fuel log; a battery car answers with an empty list.

  • refuels — newest first: t, km (the odometer), added_l or, on a car that streams only a percentage, added_percent, the level after it, and l_per_100km / window_km for the stretch it closed, when that could be measured.
  • average — {l_per_100km, km, litres, windows} over the last 12 months: total liters over total km of every measurable stretch between two refuels. null until there is one. A stretch counts once it is at least 150 km long, and only if it comes out between 2 and 30 l/100 km (on a plug-in hybrid, anything up to 30).
  • since_refuel — {km, litres, l_per_100km} since the newest refuel; the figure only once the stretch is 150 km long.
  • tank — litres, percent and range_km now.
  • bmw_lifetime — as in get_efficiency, or null.

A refuel is a rise of at least 5 L (8 % on a percentage-only car) while the car stands still, within 25 km of driving. The tank reading is accurate to a few liters, so a single stretch can be off; the average is the figure to use.

get_evcc_config

vin. Returns the evcc configuration for one car, ready to paste into evcc.yaml, plus everything needed to debug the bridge. Reads local state only, so it costs no BMW API quota.

  • yaml — the vehicles: block, with your VIN, your topic prefix and the car’s pack size already filled in. Only the fields the car actually reports are referenced, and no timeout is set (the bridge republishes on a heartbeat instead).
  • enabled — whether the bridge is switched on. The YAML is generated either way, but nothing is published while this is false.
  • mqtt_available — whether Home Assistant has a loaded MQTT integration to publish through. false here is the first thing to check when nothing appears on the broker.
  • topic_prefix, topics — the prefix in force and every topic the bridge owns.
  • published_topics — the subset currently being published, i.e. what this car actually reports. A status missing from this list means the car reports no plug state — see the bridge page’s troubleshooting.

See MQTT bridge (evcc & more).

set_trip_class

vin, trip_id (as returned by get_trips), classification (business · private · commute). Writes the local store only.

set_charge_cost

vin, session_id (the id from get_charging_sessions, or the bavariandata_charging_stopped event’s session_id), amount (optional), fees (optional). The amount is the charge’s total in the currency set under Configure → Charging costs & history; it replaces BMW’s or the tariff’s cost, which is kept. fees is the part of that total that was not energy, such as a public charger’s time or parking fee: the total stays the amount, and the export shows the fees in a column of their own. Fees above the amount are refused. Leave amount out to take an entered amount back and restore that cost. Writes the local store only. See Entering what a charge cost.

mark_trip_start

vin, at (optional; defaults to now). For a car that reports only once parked, with Trip detection set to End-of-trip reports: the trip that the car’s next report ends starts at this time. Call it when the drive begins, for example when your phone connects to the car’s Bluetooth. Refused in the live mode, where nothing would read it. Writes the local store only. See Trips.

export_history

vin, month (YYYY-MM), type (charging · trips · both), format (csv · html), language (en · de · fr · it · es · nl · pl · pt · cs · sv, HTML report only). Returns the file contents as response data; nothing is written to disk. See Export.

get_coverage_report

vin. For each vehicle, compares the descriptors your selected stream clusters should deliver against those that have actually arrived, and lists any missing ones. Answers “I enabled a cluster but no entities appeared — is it my selection, my car, or a bug?” Reads the local store and live stream only.

Fields BMW marks as not streaming-capable are excluded from the comparison — they can only arrive over REST, so counting them would report a permanent gap that no setting can close. See Choose your data.

Expect a long missing list on a healthy car. BMW publishes one catalogue for the whole fleet, so every cluster holds fields your car has no hardware for — a third seat row, a convertible roof, a fuel tank on an electric car. The report lists them all; the per-cluster seen count is the part to read. Each report also names not_applicable clusters: the Electric vehicle and Vehicle basic data clusters on a car that has sent fuel data and no high-voltage battery data.

The Repairs warning is stricter than the report. It appears only when a selected cluster has sent nothing at all for 7 days — the signature of a Data Selection that didn’t save — and never for a partly-filled cluster, for the Vehicle events cluster (teleservice calls can be months apart), or for a not_applicable one.

A cluster your car simply doesn’t have stops being a gap after 30 days. If one single cluster is still silent after a month while every other selected cluster has delivered, the selection has clearly saved and the stream works — so what’s left is a car without those fields (an older i3 streams no tire pressure, for example). That cluster joins not_applicable, its fields stop counting as overdue, and the Repairs warning clears itself. Two or more silent clusters keep warning however long they stay silent: that pattern still points at the Data Selection.

import_statistics

vin. Rebuilds this integration’s long-term statistics from the recorded history, so charging/driving from before the install (or from while HA was down) appears on the Energy dashboard. Runs automatically as records are made; use it after restoring a backup or to verify the row counts. See Energy & statistics.

activate_stream_fields

Replaces a vehicle’s streamed-attribute selection by sending the same request the BMW portal sends when you save Datenauswahl ändern — so you can activate all your fields in one call instead of ticking checkboxes. It is a replace: the attribute list you pass becomes the whole selection.

Stream selection has no CarData API; it lives behind the market portal, which authenticates with your browser session. This service therefore needs a captured portal session, and — because that session (including BMW’s bot-defense cookies) is short-lived and cannot be refreshed automatically — it is a manual, occasional tool, not something that runs unattended. It spends no API quota.

Getting the four required values — open your vehicle’s stream-setup page in a browser, open DevTools → Network, save any change, and inspect the POST …/utilities/bmw/api/cd/streams/… request — on a MINI portal that path reads …/utilities/mini/api/cd/streams/…, because the segment mirrors the site you are on:

FieldWhere it comes fromExample
base_urlthe request originhttps://www.bmw.at
localefirst path segmentde-at
mapped_vehicle_idthe id in the URL (a hash, not the VIN)90d3dd3e0ba0ea99…
cookiethe request’s Cookie header (a secret — never logged)gcdmToken=…; ak_bmsc=…

Choosing the attributes — pass an explicit attributes list, or sections (cluster slugs like electric, status, tire). If you pass neither, it uses your saved Choose streamed data clusters, or the default cluster set. The list is de-duplicated and sorted, and an unchanged selection is detected and skipped. Returns {requested, accepted, unchanged} as response data.

If the call reports the session was rejected (auth), the captured cookie has expired — grab a fresh one and retry. If it times out, BMW’s bot-defense is throttling automated calls; wait a bit and retry with a freshly captured session (this is why it’s a one-shot manual tool, not something to loop). See Choose your data for the one-click bookmarklet alternative.

fetch_charging_history

vin, from (defaults to 30 days ago), to (defaults to now). Imports BMW’s sessions into local history; overlapping live-recorded sessions are enriched in place with BMW’s measured grid energy.

Updated Edit this page on GitHub