diff --git a/homeassistant/components/openweathermap/weather_update_coordinator.py b/homeassistant/components/openweathermap/weather_update_coordinator.py index 51e475eb754..20cc71da725 100644 --- a/homeassistant/components/openweathermap/weather_update_coordinator.py +++ b/homeassistant/components/openweathermap/weather_update_coordinator.py @@ -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."""