mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Account for openweathermap 'dew_point' not always being present (#48826)
This commit is contained in:
parent
e70d7327f9
commit
2765256b61
@ -122,7 +122,7 @@ class WeatherUpdateCoordinator(DataUpdateCoordinator):
|
||||
ATTR_API_FEELS_LIKE_TEMPERATURE: current_weather.temperature("celsius").get(
|
||||
"feels_like"
|
||||
),
|
||||
ATTR_API_DEW_POINT: (round(current_weather.dewpoint / 100, 1)),
|
||||
ATTR_API_DEW_POINT: self._fmt_dewpoint(current_weather.dewpoint),
|
||||
ATTR_API_PRESSURE: current_weather.pressure.get("press"),
|
||||
ATTR_API_HUMIDITY: current_weather.humidity,
|
||||
ATTR_API_WIND_BEARING: current_weather.wind().get("deg"),
|
||||
@ -178,6 +178,12 @@ class WeatherUpdateCoordinator(DataUpdateCoordinator):
|
||||
|
||||
return forecast
|
||||
|
||||
@staticmethod
|
||||
def _fmt_dewpoint(dewpoint):
|
||||
if dewpoint is not None:
|
||||
return round(dewpoint / 100, 1)
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _get_rain(rain):
|
||||
"""Get rain data from weather data."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user