mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Only do unit conversion of met
elevation when set in config entry (#88491)
convert met elevation unit only when it exists in config entry Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
parent
30ebc6604f
commit
7a884a9d61
@ -149,7 +149,7 @@ class MetWeatherData:
|
||||
self._coordinates: dict[str, str] | None = None
|
||||
|
||||
def set_coordinates(self) -> bool:
|
||||
"""Weather data inialization - set the coordinates."""
|
||||
"""Weather data initialization - set the coordinates."""
|
||||
if self._config.get(CONF_TRACK_HOME, False):
|
||||
latitude = self.hass.config.latitude
|
||||
longitude = self.hass.config.longitude
|
||||
@ -158,15 +158,14 @@ class MetWeatherData:
|
||||
latitude = self._config[CONF_LATITUDE]
|
||||
longitude = self._config[CONF_LONGITUDE]
|
||||
elevation = self._config[CONF_ELEVATION]
|
||||
|
||||
if not self._is_metric:
|
||||
elevation = int(
|
||||
round(
|
||||
DistanceConverter.convert(
|
||||
elevation, UnitOfLength.FEET, UnitOfLength.METERS
|
||||
if not self._is_metric:
|
||||
elevation = int(
|
||||
round(
|
||||
DistanceConverter.convert(
|
||||
elevation, UnitOfLength.FEET, UnitOfLength.METERS
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
coordinates = {
|
||||
"lat": str(latitude),
|
||||
|
Loading…
x
Reference in New Issue
Block a user