From d832ce0b267a9084876edb12aea9c60f2f41e6fc Mon Sep 17 00:00:00 2001 From: Austin Mroczek Date: Sat, 28 Mar 2020 20:59:57 -0700 Subject: [PATCH] =?UTF-8?q?Fix=20openweathermap=20sensor.py=20so=20no=20Ke?= =?UTF-8?q?yError=20if=20raining=20is=20miss=E2=80=A6=20(#33372)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- homeassistant/components/openweathermap/sensor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/openweathermap/sensor.py b/homeassistant/components/openweathermap/sensor.py index ce32458f640..ac85eff6794 100644 --- a/homeassistant/components/openweathermap/sensor.py +++ b/homeassistant/components/openweathermap/sensor.py @@ -163,8 +163,9 @@ class OpenWeatherMapSensor(Entity): elif self.type == "clouds": self._state = data.get_clouds() elif self.type == "rain": - if data.get_rain(): - self._state = round(data.get_rain()["3h"], 0) + rain = data.get_rain() + if "3h" in rain: + self._state = round(rain["3h"], 0) self._unit_of_measurement = "mm" else: self._state = "not raining"