mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Correct handling of weather forecast (#73909)
This commit is contained in:
parent
fd9fdc6283
commit
01606c34aa
@ -719,10 +719,12 @@ class WeatherEntity(Entity):
|
|||||||
value_temp, precision
|
value_temp, precision
|
||||||
)
|
)
|
||||||
|
|
||||||
if forecast_temp_low := forecast_entry.pop(
|
if (
|
||||||
|
forecast_temp_low := forecast_entry.pop(
|
||||||
ATTR_FORECAST_NATIVE_TEMP_LOW,
|
ATTR_FORECAST_NATIVE_TEMP_LOW,
|
||||||
forecast_entry.get(ATTR_FORECAST_TEMP_LOW),
|
forecast_entry.get(ATTR_FORECAST_TEMP_LOW),
|
||||||
):
|
)
|
||||||
|
) is not None:
|
||||||
with suppress(TypeError, ValueError):
|
with suppress(TypeError, ValueError):
|
||||||
forecast_temp_low_f = float(forecast_temp_low)
|
forecast_temp_low_f = float(forecast_temp_low)
|
||||||
value_temp_low = UNIT_CONVERSIONS[
|
value_temp_low = UNIT_CONVERSIONS[
|
||||||
@ -737,10 +739,12 @@ class WeatherEntity(Entity):
|
|||||||
value_temp_low, precision
|
value_temp_low, precision
|
||||||
)
|
)
|
||||||
|
|
||||||
if forecast_pressure := forecast_entry.pop(
|
if (
|
||||||
|
forecast_pressure := forecast_entry.pop(
|
||||||
ATTR_FORECAST_NATIVE_PRESSURE,
|
ATTR_FORECAST_NATIVE_PRESSURE,
|
||||||
forecast_entry.get(ATTR_FORECAST_PRESSURE),
|
forecast_entry.get(ATTR_FORECAST_PRESSURE),
|
||||||
):
|
)
|
||||||
|
) is not None:
|
||||||
from_pressure_unit = (
|
from_pressure_unit = (
|
||||||
self.native_pressure_unit or self._default_pressure_unit
|
self.native_pressure_unit or self._default_pressure_unit
|
||||||
)
|
)
|
||||||
@ -756,10 +760,12 @@ class WeatherEntity(Entity):
|
|||||||
ROUNDING_PRECISION,
|
ROUNDING_PRECISION,
|
||||||
)
|
)
|
||||||
|
|
||||||
if forecast_wind_speed := forecast_entry.pop(
|
if (
|
||||||
|
forecast_wind_speed := forecast_entry.pop(
|
||||||
ATTR_FORECAST_NATIVE_WIND_SPEED,
|
ATTR_FORECAST_NATIVE_WIND_SPEED,
|
||||||
forecast_entry.get(ATTR_FORECAST_WIND_SPEED),
|
forecast_entry.get(ATTR_FORECAST_WIND_SPEED),
|
||||||
):
|
)
|
||||||
|
) is not None:
|
||||||
from_wind_speed_unit = (
|
from_wind_speed_unit = (
|
||||||
self.native_wind_speed_unit or self._default_wind_speed_unit
|
self.native_wind_speed_unit or self._default_wind_speed_unit
|
||||||
)
|
)
|
||||||
@ -775,10 +781,12 @@ class WeatherEntity(Entity):
|
|||||||
ROUNDING_PRECISION,
|
ROUNDING_PRECISION,
|
||||||
)
|
)
|
||||||
|
|
||||||
if forecast_precipitation := forecast_entry.pop(
|
if (
|
||||||
|
forecast_precipitation := forecast_entry.pop(
|
||||||
ATTR_FORECAST_NATIVE_PRECIPITATION,
|
ATTR_FORECAST_NATIVE_PRECIPITATION,
|
||||||
forecast_entry.get(ATTR_FORECAST_PRECIPITATION),
|
forecast_entry.get(ATTR_FORECAST_PRECIPITATION),
|
||||||
):
|
)
|
||||||
|
) is not None:
|
||||||
from_precipitation_unit = (
|
from_precipitation_unit = (
|
||||||
self.native_precipitation_unit
|
self.native_precipitation_unit
|
||||||
or self._default_precipitation_unit
|
or self._default_precipitation_unit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user