BMW Connected Drive in UK - how to change units to miles?

I’ve just installed the core BMW Connected Drive integration. It works beautifully, however as I’m in the UK I would like the distances in miles not km.

I can’t find anywhere to change this; there’s nothing in the integration configuration and I can’t see any list of entries for configuration.yaml for this integration. I’ve searched the forum but can only find older posts where I think things were done differently.

Can someone help please?

Did you find a solution for this?

I couldn’t find any option for this in the integration, so I did it with custom sensors.

In configuration.yaml, add this (unless you have a sensors.yaml already):

sensor: !include sensors.yaml

In sensors.yaml:

- platform: template
  sensors:
    i3_mileometer:
      friendly_name: "i3 mileometer"
      value_template: "{% set miles = (float(states('sensor.i3_120_mileage')) * 0.621371) | round %} {{ miles }}"
      unit_of_measurement: "miles"
      icon_template: "mdi:speedometer"
    i3_range:
      friendly_name: "i3 current range"
      value_template: "{% set miles = (float(states('sensor.i3_120_remaining_range_electric')) * 0.621371) | round %} {{ miles }}"
      unit_of_measurement: "miles"
      icon_template: "mdi:map-marker-distance"

Obviously, if you don’t have an i3 replace the sensor.i3* bits with your vehicle’s sensor names.

Then restart HA.

image

1 Like

thanks works a treat

Hi Miranda, Thank you for posting this but for me it does’nt seem to work. Would you know why?

- platform: template
  sensors:
    335d_xdrive_mileometer:
      friendly_name: "335d_xDrive_mileometer"
      value_template: "{% set miles = (float(states('sensor.335d_xdrive_mileage')) * 0.621371) | round %} {{ miles }}"
      unit_of_measurement: "miles"
      icon_template: "mdi:speedometer"
    335d_xdrive_range:
      friendly_name: "335d_xDrive_current range"
      value_template: "{% set miles = (float(states('sensor.335d_xdrive__remaining_range_total')) * 0.621371) | round %} {{ miles }}"
      unit_of_measurement: "miles"
      icon_template: "mdi:map-marker-distance"

Kindest Regards
Mark

Hi Mark, looks OK to me, although I’m not on the very latest version of HA.

Are you sure you have the names of your variables correct (‘sensor.335d_xdrive_mileage’ etc)? If you replace the sensor names with a random number does it calculate?

Hi Miranda, thanks for the reply. I see another entity for the mileage which shows the correct mileage value and the same for the remaining range but they are greyed out. Should I be seeing the original entity but just showing miles instead of KM? Sorry fairly new to HA and still working out how the structure works. I am getting this error though:

335d_xdrive_mileage

This entity (‘sensor.335d_xdrive_mileage_2’) does not have a unique ID, therefore its settings cannot be managed from the UI. See the documentation for more detail.

regards
Mark