From f40870b4d74efd3274b009eaa05172f73873bb97 Mon Sep 17 00:00:00 2001 From: rikroe <42204099+rikroe@users.noreply.github.com> Date: Wed, 22 Dec 2021 12:27:36 +0100 Subject: [PATCH] Round imperial values to two decimals in bmw_connected_drive (#62531) Co-authored-by: rikroe --- homeassistant/components/bmw_connected_drive/sensor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/bmw_connected_drive/sensor.py b/homeassistant/components/bmw_connected_drive/sensor.py index 241ee3a83b6..1ef7e33497c 100644 --- a/homeassistant/components/bmw_connected_drive/sensor.py +++ b/homeassistant/components/bmw_connected_drive/sensor.py @@ -73,7 +73,7 @@ SENSOR_TYPES: dict[str, BMWSensorEntityDescription] = { unit_metric=LENGTH_KILOMETERS, unit_imperial=LENGTH_MILES, value=lambda x, hass: round( - hass.config.units.length(x[0], UNIT_MAP.get(x[1], x[1])) + hass.config.units.length(x[0], UNIT_MAP.get(x[1], x[1])), 2 ), ), "remaining_range_total": BMWSensorEntityDescription( @@ -82,7 +82,7 @@ SENSOR_TYPES: dict[str, BMWSensorEntityDescription] = { unit_metric=LENGTH_KILOMETERS, unit_imperial=LENGTH_MILES, value=lambda x, hass: round( - hass.config.units.length(x[0], UNIT_MAP.get(x[1], x[1])) + hass.config.units.length(x[0], UNIT_MAP.get(x[1], x[1])), 2 ), ), "remaining_range_electric": BMWSensorEntityDescription( @@ -91,7 +91,7 @@ SENSOR_TYPES: dict[str, BMWSensorEntityDescription] = { unit_metric=LENGTH_KILOMETERS, unit_imperial=LENGTH_MILES, value=lambda x, hass: round( - hass.config.units.length(x[0], UNIT_MAP.get(x[1], x[1])) + hass.config.units.length(x[0], UNIT_MAP.get(x[1], x[1])), 2 ), ), "remaining_range_fuel": BMWSensorEntityDescription( @@ -100,7 +100,7 @@ SENSOR_TYPES: dict[str, BMWSensorEntityDescription] = { unit_metric=LENGTH_KILOMETERS, unit_imperial=LENGTH_MILES, value=lambda x, hass: round( - hass.config.units.length(x[0], UNIT_MAP.get(x[1], x[1])) + hass.config.units.length(x[0], UNIT_MAP.get(x[1], x[1])), 2 ), ), "remaining_fuel": BMWSensorEntityDescription( @@ -109,7 +109,7 @@ SENSOR_TYPES: dict[str, BMWSensorEntityDescription] = { unit_metric=VOLUME_LITERS, unit_imperial=VOLUME_GALLONS, value=lambda x, hass: round( - hass.config.units.volume(x[0], UNIT_MAP.get(x[1], x[1])) + hass.config.units.volume(x[0], UNIT_MAP.get(x[1], x[1])), 2 ), ), "fuel_percent": BMWSensorEntityDescription(