Skip to content

Releases: kvanbiesen/bmw-cardata-ha

4.1.5

08 Dec 17:36
0ea25bc

Choose a tag to compare

What's Changed

big en issues fixed

  • fixed #27

  • fixed (maybe) #28

  • IMAGE download works (fetches car image from the server, if it /config/media/cardata/.png ->
    Lovelace card anyone ? #13
    if it doesnt fill -> use DEV TOOLS -> actions -> cardata.fetch_image

Ps sorry for the updates so quick. :-) fixing stuff as we go lol

Full Changelog: 4.1.4...4.1.5

4.1.4

08 Dec 10:37

Choose a tag to compare

Fixed the threading on the device tracker, should update now again.

Full Changelog: 4.1.3...4.1.4

4.1.3

07 Dec 19:18
913e33a

Choose a tag to compare

Full Changelog: 4.1.0...4.1.3

4.1.0

07 Dec 12:44
aac620f

Choose a tag to compare

As My english is pretty bad, i used AI to list some changes, i hope not to many breaking ones

You might need to remove the integration and readd.

Big update, might cause breakage :)

- renamed it to BMW Cardata (maybe we get a logo also if i didnt mess up the first push of the logo lol)**

  • sensor names are fixed
  • location is a wip, pushed the old coordinates back for now, dont relly to hard on this i'm working on it, was looking at other stuff first.
  • changed the whole flow
  • if you have an old installation. (where sensors missing a prefix, like 330i, in dev -> tools actions -> there is a new service migrate ( takes paramaters dry-run and force. (Enable debug, do a dry-run), see if the names are better looking. Try then withouth paramaters. If it doesnt do anything but looks good (Force=True); Shouldnt cause loss of data or duplicate sensors!
    -Reduced the API SPAM by 80 or 90% !!!!!!!
    -reduce spamming the HA recorder, only update if update is needed. No need to change 100 -> 100 for example causeing a log for the recorder
  • debug disabled by default (manually change it in const.py for serious debugging), otherwise it follows HA rules
  • Gps location debouncing, only update if both lat/long come in and there is noticable movement of couple of meters.
    -..........

BUGS 🐛

  • if you add the integration, and click the link to authorize, copy the usercode manually and past it, it often defaults to a prefilled code
  • Only thing, if you have many unused containers or getting 429 error in log (cant do much about it). Remove the integration and install it the next day, keeping to try keeps Spamming the VERY limited container api (myabe 20-40times a call -> this what stalled my development).
  • i created also a service, to batch removed old orphaned containers, this will mostl likely blow your api limit of the day so do it, and then remove integration, wait till next day and install again.

-..........

NO Warranty 👯‍♀️


Short release notes (one-line bullets)

Breaking: Bootstrap now performs a one-time forced HV container creation if none exists to seed telematic data (may create an extra container on initial setup).
Added: Debounced coordinator updates (batch non-GPS descriptor updates every 5s) to drastically reduce MQTT/Home Assistant update spam.
Added: Smart filtering in entities — binary sensors and numeric sensors avoid redundant HA updates; GPS updates still push immediately.
Fixed: Entities created with VIN-only names are now pre-populated from restored metadata so names appear correctly on startup.
Improved: SOC tracking and estimation (better power handling, testing tracking, AC power derivation).
Improved: Container management logic — safer reuse and clearer matching (name, purpose, descriptor signature).
Added: Config flow options for manual token refresh, reauth, fetching mappings/basic/telematic, reset telemetry container, and cleanup orphaned entities.
Internal: Prevent MQTT auto-start during bootstrap/token refresh so metadata is available before entities are created.

Developer-facing changelog (grouped)

Breaking / Important behavior changes

One-time forced HV container creation during bootstrap if no container found (bootstrap.async_run_bootstrap now attempts a conservative forced creation after a failed non-forced attempt). This enables seeding of telematic descriptors (e.g., mileage) that otherwise remain "unknown". It may create a container automatically the first time after upgrade.
MQTT no longer auto-starts until bootstrap completes (prevents creating entities without names/metadata).

Added

Debounced coordinator updates: coordinator now batches non-GPS updates and new-entity notifications and dispatches them every 5.0 seconds (CardataCoordinator._DEBOUNCE_SECONDS), significantly reducing update churn.
New smart filtering at both coordinator and entity level:
    Coordinator suppresses insignificant numeric changes (< 0.01 by default).
    BinarySensor and numeric sensors only push to HA when the state actually changed (prevents repeated identical updates).
Config flow options expanded:
    Manual token refresh
    Start device authorization (reauth)
    Fetch mappings, basic vehicle info, telematic data via API
    Reset telemetry container
    Cleanup orphaned entities
Diagnostics and watchdog: Coordinator emits diagnostic signals periodically and tracks last_message timestamps and connection status.
New dispatcher signals introduced (namespaced by entry): new_sensor, new_binary, update, diagnostics, soc_estimate, telematic_api.

Fixed

Pre-populate coordinator.names from restored device_metadata during setup to avoid entities being created only with VIN identifiers.
Split container creation logic out of the token refresh path to prevent excessive API calls during refresh (async_ensure_container_for_entry).
Ensure bootstrap fetches vehicle basic data first and applies metadata to populate coordinator.names prior to entity creation.
Various error handling/logging improvements and rate-limit handling during bootstrap telematic/mapping API calls.

Improved SOC & power handling

SOC tracking refactor:
    SocTracking class with fields for better state tracking.
    Separate testing SOC tracking used for internal simulations.
    Better handling of maxEnergy → energy_kwh, rate calculations, and target SOC application.
Effective charging power derived from either direct charging power or computed AC power (voltage * current * phases).
AvgAuxPower used to adjust charging power for testing/smoothed estimates.

Container management changes

Container reuse checks now require all matching conditions: name, purpose, AND descriptor signature — avoids accidental reuse of mismatched containers.
Container manager can list, create, delete, and reset containers safely with locking to prevent concurrent operations.
One-time forced creation introduced in bootstrap to ensure telematic seeding.

Entity & restore behavior

Entities wait until bootstrap finishes (names/metadata restored) before being created; binary sensor platform awaits bootstrap flag and coordinator.names.
restore_descriptor_state and restore_soc_cache improvements to rehydrate SOC & related derived values on startup.

Config flow & UX

Cleaner config flow and options menu with direct actions to trigger API calls and maintenance tasks (reset container, cleanup entities).
The "cleanup entities" option removes all entities for the integration from the entity registry (with confirmation).

Stats for the PR

Files changed: 19
Commits: 5
Additions: 1,799 lines
Deletions: 209 lines
PR draft: true
URL: https://github.com/kvanbiesen/bmw-cardata-ha/pull/22

Files/locations with notable changes (high level)

init.py — setup lifecycle: prevent MQTT auto-start during bootstrap, pre-populate coordinator.names from restored metadata, wait for bootstrap completion before platform setup.
bootstrap.py — VIN discovery, basic data & telematic seeding; now attempts conservative forced container creation if necessary.
coordinator.py — major refactor: DescriptorState/SocTracking classes, debounced updates, pending queues, improved SOC estimation and diagnostics signals.
auth.py — clearer token refresh and reauth flow separation, moved container creation out of refresh; added ensure container function.
container.py — robust container management, reuse matching and reset logic with signature checking.
config_flow.py — expanded options for manual actions (refresh tokens, reauth, fetch mappings/basic/telematic, reset container, cleanup entities).
binary_sensor.py — smart filtering to avoid redundant HA updates.
device_flow.py, descriptor_titles.py, debug.py and others — supporting improvements.

Upgrade / rollout notes (what to do after merging)

Expect a one-time API call that may create an HV container when bootstrap runs the first time after upgrade. If you want to avoid automatic creation:
    Before upgrading, consider setting up a container manually (via options → "Reset telemetry container") after upgrading, or
    Use the new config flow option "Reset telemetry container" or "Get telematics data" after upgrade to seed descriptors manually.
After merge, restart Home Assistant (or reload integration). Entities will be created with proper names and many previously "unknown" sensors should be populated either from telematic seed or the MQTT stream.
If you see fewer HA updates / less noise — this is deliberate (debouncing + smart filtering). If you need immediate updates for a descriptor, check that the stream is sending it or run the “Get telematics data (API)” option.
If sensors you expect remain unknown: enable debug logging, check coordinator.data for VIN keys, and use the new fetch options to trigger API seeding.

Suggested PR body (short, markdown)

Title: Testing before release
Summary: Major stability and UX improvements: bootstrap now seeds telematic data more reliably (one-time forced container creation), MQTT entity creation is deferred until metadata is available, large refactor of coordinator for debounced updates and improved SOC estimation, container management hardened, and new config options added for manual maintenance.
Key risks: One-time container creation (documented above); debug and config options provided to manage behavior.
Test plan: Restart HA, ensure vehicles appear with friendly names, confirm "vehicle.vehicle.travelledDistance" and other long-term descriptors get populated after bootstrap/telematic fetch or after using the Reset/G...
Read more

4.1.0-pre

01 Dec 09:35

Choose a tag to compare

4.1.0-pre Pre-release
Pre-release
  • Try to reduce spammyneess of the integration by keeping hold of the HA Settings
  • When removing the integration, prompt for removing all old entries. (prevent HA from caching old names and history optional

4.0.1

28 Nov 07:59

Choose a tag to compare

Might have to delete integration and re-install it again due do my mistake (accidently switched unqie and enitidy id)

  • fixes #11
  • fixes #8
  • fixes new car been added on HA reboot

First population of the car field will be slower, als it now waits to get all de needed data to create a proper sensor. Simple toggle tru the remote app of the doors is enough to start most of it.

Car only gets added if there is updates on the the sensor, otherwise we end up with a bunch of sensor that dont have the proper naming

#12 under investigation

4.0.0

27 Nov 17:07
ec0c272

Choose a tag to compare

Major Upgrade.

  • Refactored the whole integration so its more readable and easier to fix
  • Squatted some unneeded loops
  • Remove #2 that added the prefix.
    -> didnt work fully
  • some sensors got instantly updated and missed the car_name_prefix on creation. Not ideal if you have multiple cars. Now the sensor created is delayed until the integration knows the car name
  • Propably some other stuff

WARNING. BEST to remove the integration and reinstall it cause otherwise lotsa duplicate sensor (and none working ones because new unique id's)

Recommended to use this version

4.0.0-pre

27 Nov 16:55

Choose a tag to compare

4.0.0-pre Pre-release
Pre-release

Prelease (BIG -> READ FIRST)

-Major Refactor of making the whole thing easier to manage and debug
-reverted #2 cause it tends to overwrite the name with empty if the sensor loads before it can get the attribute
this causes al sensors to be recreated but now with proper names an all of them have proper unique id.

  • fixed bootstrapping
    -Squatted some minor bugs (redundant calcaltions)

So You will have to adapt your automations, cards etc.!!!!!!!!!!!

3.0.3

26 Nov 21:30
a3b5bbc

Choose a tag to compare

bumped version
added logo to hacs

  • some minor typos

merged #3

3.0.2

25 Nov 21:25
9614d2c

Choose a tag to compare

Bump Versions and maintainer