Skip to content

[Bug]: Mileage not updating #377

@mikeb93

Description

@mikeb93

Home Assistant version

2026.4.4

BMW CarData HA integration version

5.1.8

Installation method

HACS

BMW vehicle model & year

iX2 2024

What happened?

Hi, since a couple updates ago the mileage is not updating anymore for my iX2.
This entity seemed always a bit unreliable unfortunately.
Looks like it stopped working end of March

state:
  translated: 34.469 km
  raw: "34469.0"
  last_changed: "2026-04-28T12:19:14.632Z"
  last_updated: "2026-04-28T12:19:14.632Z"
attributes:
  state_class: total_increasing
  timestamp: "2026-03-29T10:21:31.000Z"
  unit_of_measurement: km
  device_class: distance
  friendly_name: iX2 xDrive30 Vehicle mileage

my actual mileage now is 36.152 though..

I'm not sure but isn't the mileage missing from the API reply?
'vehicle.vehicleIdentification.basicVehicleData': {'timestamp': None, 'unit': None, 'value': None}

Any ideas?

Steps to reproduce

No response

Screenshots

No response

Debug logs

There is an unknown VIN referenced in the Debug Logs. I've marked it with [UNKNOWN_VIN]

2026-04-28 14:19:14.589 INFO (MainThread) [homeassistant.components.sensor] Setting up cardata.sensor
2026-04-28 14:19:14.667 DEBUG (MainThread) [custom_components.cardata.sensor] Created 3 diagnostic sensor(s) for entry [UNKNOWN_VIN] (CarData Debug Device)
2026-04-28 14:19:14.669 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up cardata.binary_sensor
2026-04-28 14:19:14.676 INFO (MainThread) [homeassistant.components.device_tracker] Setting up cardata.device_tracker
2026-04-28 14:19:14.676 DEBUG (MainThread) [custom_components.cardata.device_tracker] Restored last known location for [VIN]: [LAT], [LONG]
2026-04-28 14:19:14.677 DEBUG (MainThread) [custom_components.cardata.device_tracker] Created device tracker for VIN: [VIN]
2026-04-28 14:19:14.678 INFO (MainThread) [homeassistant.components.image] Setting up cardata.image
2026-04-28 14:19:14.679 DEBUG (MainThread) [custom_components.cardata.image] Created image entity for VIN: [VIN] with image path: /config/www/community/cardata/[VIN].png
2026-04-28 14:19:14.680 INFO (MainThread) [homeassistant.components.button] Setting up cardata.button
2026-04-28 14:19:14.680 DEBUG (MainThread) [custom_components.cardata.button] Created SOC learning reset buttons for iX2 xDrive30 ([VIN])
2026-04-28 14:19:14.681 DEBUG (MainThread) [custom_components.cardata.button] Added 2 button entities
2026-04-28 14:19:14.682 DEBUG (MainThread) [custom_components.cardata.button] Created consumption reset button for iX2 xDrive30 ([VIN])
2026-04-28 14:19:14.682 INFO (MainThread) [homeassistant.components.number] Setting up cardata.number
2026-04-28 14:19:14.682 DEBUG (MainThread) [custom_components.cardata.number] Created manual battery capacity input for iX2 xDrive30 ([VIN])
2026-04-28 14:19:14.683 DEBUG (MainThread) [custom_components.cardata.number] Added 1 number entities
2026-04-28 14:19:14.683 DEBUG (MainThread) [custom_components.cardata.telematics] Starting telematic poll loop for entry [UNKNOWN_VIN]
2026-04-28 14:19:14.683 DEBUG (MainThread) [custom_components.cardata.telematics] Next telematic poll in 1341.4 seconds (22.4 minutes) [failures=0]
2026-04-28 14:20:44.101 DEBUG (MainThread) [custom_components.cardata.auth] Token was refreshed by another caller; skipping (valid for 3504 seconds)
2026-04-28 14:20:53.209 DEBUG (MainThread) [custom_components.cardata.auth] Token was refreshed by another caller; skipping (valid for 3495 seconds)
2026-04-28 14:20:53.695 INFO (MainThread) [custom_components.cardata.services] Cardata vehicle mappings: [{'mappedSince': '2026-01-16T10:17:06.353Z', 'mappingType': 'PRIMARY', 'vin': '[VIN]'}]
2026-04-28 14:21:34.336 DEBUG (MainThread) [custom_components.cardata.auth] Token still valid for 3453 seconds, skipping refresh
2026-04-28 14:21:34.785 DEBUG (MainThread) [custom_components.cardata.telematics] Cardata telematic data for [VIN] (container G00B025F732UD): {'telematicData': {'vehicle.powertrain.electric.battery.preconditioning.manualMode.statusFeedback': {'timestamp': None, 'unit': None, 'value': None}, 'vehicle.powertrain.tractionBattery.charging.port.anyPosition.isPlugged': {'timestamp': None, 'unit': None, 'value': None}, 'vehicle.powertrain.electric.battery.stateOfHealth.displayed': {'timestamp': None, 'unit': None, 'value': None}, 'vehicle.drivetrain.electricEngine.remainingElectricRange': {'timestamp': '2026-04-28T12:21:34.750Z', 'unit': 'km', 'value': '276'}, 'vehicle.powertrain.electric.battery.stateOfCharge.target': {'timestamp': '2026-04-28T10:51:37.000Z', 'unit': '%', 'value': '80'}, 'vehicle.trip.segment.end.drivetrain.batteryManagement.hvSoc': {'timestamp': '2026-04-27T19:47:25.233Z', 'unit': '%', 'value': '69'}, 'vehicle.drivetrain.electricEngine.charging.lastChargingResult': {'timestamp': '2026-04-28T12:21:34.750Z', 'unit': None, 'value': 'FAILED'}, 'vehicle.drivetrain.batteryManagement.maxEnergy': {'timestamp': '2026-04-28T10:51:37.000Z', 'unit': 'kWh', 'value': '61'}, 'vehicle.powertrain.electric.battery.charging.acLimit.selected': {'timestamp': '2026-04-28T10:51:37.000Z', 'unit': 'A', 'value': '6'}, 'vehicle.drivetrain.electricEngine.charging.phaseNumber': {'timestamp': None, 'unit': None, 'value': None}, 'vehicle.drivetrain.batteryManagement.batterySizeMax': {'timestamp': '2026-04-28T10:51:37.000Z', 'unit': 'kWh', 'value': '0'}, 'vehicle.drivetrain.electricEngine.charging.method': {'timestamp': '2026-04-28T10:51:37.000Z', 'unit': None, 'value': 'NOCHARGING'}, 'vehicle.powertrain.electric.battery.charging.power': {'timestamp': None, 'unit': 'W', 'value': None}, 'vehicle.body.chargingPort.lockedStatus': {'timestamp': '2026-04-28T10:51:37.000Z', 'unit': None, 'value': 'CHARGING_CABLE_NOT_LOCKED'}, 'vehicle.powertrain.tractionBattery.charging.port.anyPosition.flap.isOpen': {'timestamp': None, 'unit': None, 'value': None}, 'vehicle.vehicle.avgAuxPower': {'timestamp': None, 'unit': 'kW', 'value': None}, 'vehicle.drivetrain.electricEngine.charging.status': {'timestamp': '2026-04-28T10:51:37.000Z', 'unit': None, 'value': 'NOCHARGING'}, 'vehicle.body.chargingPort.plugEventId': {'timestamp': '2026-04-28T10:51:37.000Z', 'unit': None, 'value': '348'}, 'vehicle.drivetrain.electricEngine.charging.timeToFullyCharged': {'timestamp': None, 'unit': 'min', 'value': None}, 'vehicle.drivetrain.electricEngine.charging.lastChargingReason': {'timestamp': '2026-04-28T12:21:34.750Z', 'unit': None, 'value': 'INVALID'}, 'vehicle.trip.segment.accumulated.drivetrain.electricEngine.recuperationTotal': {'timestamp': None, 'unit': None, 'value': None}, 'vehicle.drivetrain.electricEngine.charging.hvStatus': {'timestamp': '2026-04-28T12:21:34.750Z', 'unit': None, 'value': 'INVALID'}, 'vehicle.drivetrain.electricEngine.charging.reasonChargingEnd': {'timestamp': None, 'unit': None, 'value': None}, 'vehicle.drivetrain.electricEngine.charging.acAmpere': {'timestamp': None, 'unit': 'A', 'value': None}, 'vehicle.drivetrain.electricEngine.charging.acVoltage': {'timestamp': None, 'unit': 'V', 'value': None}, 'vehicle.drivetrain.electricEngine.charging.level': {'timestamp': '2026-04-28T12:21:34.750Z', 'unit': '%', 'value': '66'}, 'vehicle.powertrain.electric.battery.preconditioning.automaticMode.statusFeedback': {'timestamp': None, 'unit': None, 'value': None}, 'vehicle.drivetrain.electricEngine.charging.timeRemaining': {'timestamp': None, 'unit': 'min', 'value': None}, 'vehicle.powertrain.electric.battery.stateOfCharge.displayed': {'timestamp': None, 'unit': 'percent', 'value': None}, 'vehicle.drivetrain.batteryManagement.header': {'timestamp': '2026-04-28T10:51:37.000Z', 'unit': '%', 'value': '66'}, 'vehicle.vehicleIdentification.basicVehicleData': {'timestamp': None, 'unit': None, 'value': None}}}
2026-04-28 14:21:34.785 DEBUG (MainThread) [custom_components.cardata.soc_prediction] SOC: Vehicle [VIN] marked as BEV
2026-04-28 14:21:34.786 DEBUG (MainThread) [custom_components.cardata.telematics] Cardata telematic fetch succeeded for at least one VIN
2026-04-28 14:21:34.786 INFO (MainThread) [custom_components.cardata.services] Cardata fetch_telematic_data: successfully fetched data for entry [TOKEN?]
2026-04-28 14:29:14.184 DEBUG (MainThread) [custom_components.cardata.auth] Token was refreshed by another caller; skipping (valid for 2994 seconds)
2026-04-28 14:29:14.556 INFO (MainThread) [custom_components.cardata.services] Cardata basic data for [VIN]: {'bodyType': 'Sports Activity Coupe', 'brand': 'BMW', 'chargingModes': ['AC_LOW'], 'colourCodeRaw': '475', 'colourDescription': 'BLACK SAPPHIRE METALLIC', 'constructionDate': '2024-03-14T00:00:00.000+0000', 'countryCode': 'DE', 'driveTrain': 'BEV', 'engine': 'XE2', 'fullSAList': '02PA,0420,0481,0710,0775,0313,04U6,08TF,09T1,0610,0654,06AF,01EK,0428,0230,0248,0431,0494,05AU,06NX,03KA,04T2,0552,0760,0851,04V1,07EW,08WN,04NW,0674,04U9,07LG,0337,0548,04AT,05AC,09T2,06AK,0801,0402,06AE,03DN,0430,05AV,08R3,06U3,08R9,03MC,0879,0322,04T3,0459,05DN,02VB,0455,02VF,0478', 'hasNavi': True, 'hasSunRoof': True, 'headUnit': 'MGU_02_A', 'modelKey': '71GM', 'modelName': 'iX2 xDrive30', 'numberOfDoors': 5, 'propulsionType': 'EL', 'series': 'X', 'seriesDevt': 'U10', 'simStatus': 'ACTIVE', 'steering': 'LL'}
2026-04-28 14:29:14.556 DEBUG (MainThread) [custom_components.cardata.pending_manager] basic_data started for key=[VIN]
2026-04-28 14:29:14.556 DEBUG (MainThread) [custom_components.cardata.device_info] Magic SOC: Set default consumption for [VIN] (iX2 xDrive30) to 0.18 kWh/km
2026-04-28 14:29:14.556 DEBUG (MainThread) [custom_components.cardata.device_info] Magic SOC: Set default capacity for [VIN] (iX2 xDrive30) to 64.7 kWh
2026-04-28 14:29:14.556 DEBUG (MainThread) [custom_components.cardata.pending_manager] basic_data completed for key=[VIN]
2026-04-28 14:29:14.684 DEBUG (MainThread) [custom_components.cardata.lifecycle] Running scheduled ghost device cleanup for entry [UNKNOWN_VIN]
2026-04-28 14:29:14.684 DEBUG (MainThread) [custom_components.cardata.metadata] Skipping cleanup for VIN [VIN] (device existed before this session, created 8798824 seconds ago)
2026-04-28 14:29:14.684 DEBUG (MainThread) [custom_components.cardata.metadata] Skipping cleanup for VIN [UNKNOWN_VIN] (device existed before this session, created 8797409 seconds ago)

Additional context

No response

Checklist

  • I'm using the latest version of the integration
  • I've searched existing issues to avoid duplicates
  • I've included debug logs and version information
  • If I used an LLM to help write this report, I have included real debug logs (not reconstructed from reading the source code)
  • For frontend/card issues: I've done a full browser cache refresh (Ctrl+Shift+R on Windows/Linux, Cmd+Shift+R on macOS, or Reset Frontend Cache in the mobile companion app)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions