Force _attr_native_value
to metric in bmw_connected_drive (#75225)
Co-authored-by: rikroe <rikroe@users.noreply.github.com>
This commit is contained in:
parent
c52d4c64bf
commit
686449cef6
2 changed files with 4 additions and 6 deletions
|
@ -33,7 +33,8 @@ class BMWDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
entry.data[CONF_PASSWORD],
|
||||
get_region_from_name(entry.data[CONF_REGION]),
|
||||
observer_position=GPSPosition(hass.config.latitude, hass.config.longitude),
|
||||
use_metric_units=hass.config.units.is_metric,
|
||||
# Force metric system as BMW API apparently only returns metric values now
|
||||
use_metric_units=True,
|
||||
)
|
||||
self.read_only = entry.options[CONF_READ_ONLY]
|
||||
self._entry = entry
|
||||
|
|
|
@ -16,7 +16,6 @@ from homeassistant.components.sensor import (
|
|||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
CONF_UNIT_SYSTEM_IMPERIAL,
|
||||
LENGTH_KILOMETERS,
|
||||
LENGTH_MILES,
|
||||
PERCENTAGE,
|
||||
|
@ -183,10 +182,8 @@ class BMWSensor(BMWBaseEntity, SensorEntity):
|
|||
self._attr_name = f"{vehicle.name} {description.key}"
|
||||
self._attr_unique_id = f"{vehicle.vin}-{description.key}"
|
||||
|
||||
if unit_system.name == CONF_UNIT_SYSTEM_IMPERIAL:
|
||||
self._attr_native_unit_of_measurement = description.unit_imperial
|
||||
else:
|
||||
self._attr_native_unit_of_measurement = description.unit_metric
|
||||
# Force metric system as BMW API apparently only returns metric values now
|
||||
self._attr_native_unit_of_measurement = description.unit_metric
|
||||
|
||||
@callback
|
||||
def _handle_coordinator_update(self) -> None:
|
||||
|
|
Loading…
Add table
Reference in a new issue