mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Fix openweathermap sensor.py so no KeyError if raining is miss… (#33372)
This commit is contained in:
parent
f32ae95ef4
commit
d832ce0b26
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user