Skip to content

Commit

Permalink
Drop use of is_metric in tomorrowio (home-assistant#80271)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Oct 13, 2022
1 parent e852c9b commit 757df21
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions homeassistant/components/tomorrowio/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.util import slugify
from homeassistant.util.unit_conversion import DistanceConverter, SpeedConverter
from homeassistant.util.unit_system import IMPERIAL_SYSTEM

from . import TomorrowioDataUpdateCoordinator, TomorrowioEntity
from .const import (
Expand Down Expand Up @@ -327,11 +328,9 @@ def __init__(
)
self._attr_extra_state_attributes = {ATTR_ATTRIBUTION: self.attribution}
if self.entity_description.native_unit_of_measurement is None:
self._attr_native_unit_of_measurement = (
description.unit_metric
if hass.config.units.is_metric
else description.unit_imperial
)
self._attr_native_unit_of_measurement = description.unit_metric
if hass.config.units is IMPERIAL_SYSTEM:
self._attr_native_unit_of_measurement = description.unit_imperial

@property
@abstractmethod
Expand Down Expand Up @@ -359,7 +358,7 @@ def native_value(self) -> str | int | float | None:
desc.imperial_conversion
and desc.unit_imperial is not None
and desc.unit_imperial != desc.unit_metric
and not self.hass.config.units.is_metric
and self.hass.config.units is IMPERIAL_SYSTEM
):
return handle_conversion(state, desc.imperial_conversion)

Expand Down

0 comments on commit 757df21

Please sign in to comment.