diff --git a/homeassistant/components/openweathermap/sensor.py b/homeassistant/components/openweathermap/sensor.py index b730923f0bd..938fb609158 100644 --- a/homeassistant/components/openweathermap/sensor.py +++ b/homeassistant/components/openweathermap/sensor.py @@ -165,15 +165,16 @@ class OpenWeatherMapSensor(Entity): self._state = data.get_clouds() elif self.type == "rain": rain = data.get_rain() - if "3h" in rain: - self._state = round(rain["3h"], 0) + if "1h" in rain: + self._state = round(rain["1h"], 0) self._unit_of_measurement = "mm" else: self._state = "not raining" self._unit_of_measurement = "" elif self.type == "snow": - if data.get_snow(): - self._state = round(data.get_snow(), 0) + snow = data.get_snow() + if "1h" in snow: + self._state = round(snow["1h"], 0) self._unit_of_measurement = "mm" else: self._state = "not snowing" diff --git a/homeassistant/components/openweathermap/weather.py b/homeassistant/components/openweathermap/weather.py index ce8676ad440..7200e759d3b 100644 --- a/homeassistant/components/openweathermap/weather.py +++ b/homeassistant/components/openweathermap/weather.py @@ -203,18 +203,16 @@ class OpenWeatherMapWeather(WeatherEntity): } ) else: + rain = entry.get_rain().get("1h") + if rain is not None: + rain = round(rain, 1) data.append( { ATTR_FORECAST_TIME: entry.get_reference_time("unix") * 1000, ATTR_FORECAST_TEMP: entry.get_temperature("celsius").get( "temp" ), - ATTR_FORECAST_PRECIPITATION: ( - round(entry.get_rain().get("3h"), 1) - if entry.get_rain().get("3h") is not None - and (round(entry.get_rain().get("3h"), 1) > 0) - else None - ), + ATTR_FORECAST_PRECIPITATION: rain, ATTR_FORECAST_CONDITION: [ k for k, v in CONDITION_CLASSES.items()