You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add charging history and tyre diagnosis daily-poll sensors
Fetch charging session history and tyre health data from BMW API,
disabled by default with API quota warnings. Poll budget automatically
adjusts to account for daily calls, keeping total scheduled usage
within budget.
Each feature adds a diagnostic sensor per vehicle, a settings toggle,
and a manual service trigger. Null-safety guards handle missing or
malformed API responses gracefully.
Copy file name to clipboardExpand all lines: README.md
+26-2Lines changed: 26 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -247,13 +247,35 @@ Each EV/PHEV vehicle gets two button entities to reset learned efficiency:
247
247
248
248
These buttons appear in the vehicle's device page under Configuration entities.
249
249
250
+
## Charging History (Optional)
251
+
252
+
The integration can fetch your BMW charging session history from the past 30 days. This is **disabled by default** to conserve your API quota.
253
+
254
+
-**Enable via**: Settings → Devices & Services → BMW CarData → Configure → Settings → Enable Charging History
255
+
-**API cost**: 1 call per vehicle per day (from your 50-call daily quota)
256
+
-**Sensor**: Creates a diagnostic sensor per vehicle showing session count and last charge date
257
+
-**Attributes**: Full session data including start/end SOC, energy consumed, duration, location, and cost information
258
+
-**Manual trigger**: Use `cardata.fetch_charging_history` service in Developer Tools
259
+
260
+
## Tyre Diagnosis (Optional)
261
+
262
+
The integration can fetch tyre health and wear data from BMW's Smart Maintenance system. This is **disabled by default** to conserve your API quota.
263
+
264
+
-**Enable via**: Settings → Devices & Services → BMW CarData → Configure → Settings → Enable Tyre Diagnosis
265
+
-**API cost**: 1 call per vehicle per day (from your 50-call daily quota)
266
+
-**Sensor**: Creates a diagnostic sensor per vehicle showing aggregate tyre status
267
+
-**Attributes**: Per-wheel data including dimension, wear, season, manufacturer, defect status, and production date
268
+
-**Manual trigger**: Use `cardata.fetch_tyre_diagnosis` service in Developer Tools
269
+
250
270
## Developer Tools Services
251
271
252
272
Home Assistant's Developer Tools expose helper services for manual API checks:
253
273
254
274
-`cardata.fetch_telematic_data` fetches the current contents of the configured telematics container for a VIN and logs the raw payload.
255
275
-`cardata.fetch_vehicle_mappings` calls `GET /customers/vehicles/mappings` and logs the mapping details (including PRIMARY or SECONDARY status). Only primary mappings return data; some vehicles do not support secondary users, in which case the mapped user is considered the primary one.
256
276
-`cardata.fetch_basic_data` calls `GET /customers/vehicles/{vin}/basicData` to retrieve static metadata (model name, series, etc.) for the specified VIN.
277
+
-`cardata.fetch_charging_history` fetches the last 30 days of charging sessions for a VIN. Uses 1 API call per vehicle.
278
+
-`cardata.fetch_tyre_diagnosis` fetches tyre health and wear data for a VIN. Uses 1 API call per vehicle.
257
279
-`migrations` call for proper renaming the sensors from old installations
258
280
259
281
## API Quota and MQTT Streaming
@@ -263,8 +285,9 @@ BMW imposes a **50 calls/day** limit on the CarData API. This integration does n
263
285
-**MQTT Stream (real-time)**: The MQTT stream is unlimited and provides real-time updates for events like door locks, motion state, charging power, etc. GPS coordinates are paired using BMW payload timestamps (same GPS fix detection) with an arrival-time fallback, so location updates work even when latitude and longitude arrive in separate MQTT messages. In direct BMW mode, token refresh during MQTT reconnection is lock-free to avoid blocking the connection, and the MQTT connection is proactively reconnected with fresh credentials to prevent session expiry (~1 hour).
264
286
-**Trip-end polling**: When a vehicle stops moving (trip ends), the integration triggers an immediate API poll to capture post-trip battery state. This ensures SOC is updated even when the MQTT stream only delivers GPS/mileage but not SOC (common on some models). A per-VIN 10-minute cooldown prevents GPS burst flapping from burning API quota.
265
287
-**Charge-end polling**: When charging completes or stops, the integration triggers an immediate API poll to get the actual BMW SOC for learning calibration of the predicted SOC sensor, subject to the same per-VIN cooldown.
266
-
-**Fallback polling**: The integration polls every 12 hours as a fallback in case MQTT stream fails or after Home Assistant restarts. VINs with fresh MQTT data are skipped individually, so in multi-car setups only stale VINs consume API calls.
267
-
-**Multi-VIN setups**: All vehicles share the same 50 call/day limit.
288
+
-**Fallback polling**: The integration polls periodically as a fallback in case MQTT stream fails or after Home Assistant restarts. VINs with fresh MQTT data are skipped individually, so in multi-car setups only stale VINs consume API calls.
289
+
-**Daily optional features**: When Charging History and/or Tyre Diagnosis are enabled, each adds 1 API call per vehicle per day. The polling interval automatically increases to compensate — e.g. with both features on 2 cars, polling stretches from 2h to 2.4h per VIN.
290
+
-**Multi-VIN setups**: All vehicles share the same 50 call/day limit. The poll interval scales with VIN count plus any enabled daily features. Each VIN is guaranteed at least 1 poll per day; BMW's 429 backoff handles actual quota enforcement.
268
291
-**Rate limiting**: If BMW returns a 429 (rate limited) response, the integration backs off automatically with exponential delay.
269
292
270
293
## Requirements
@@ -318,6 +341,7 @@ The integration is organized into focused modules:
318
341
|`stream_circuit_breaker.py`| Circuit breaker for reconnection rate limiting |
0 commit comments