mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +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":
|
elif self.type == "clouds":
|
||||||
self._state = data.get_clouds()
|
self._state = data.get_clouds()
|
||||||
elif self.type == "rain":
|
elif self.type == "rain":
|
||||||
if data.get_rain():
|
rain = data.get_rain()
|
||||||
self._state = round(data.get_rain()["3h"], 0)
|
if "3h" in rain:
|
||||||
|
self._state = round(rain["3h"], 0)
|
||||||
self._unit_of_measurement = "mm"
|
self._unit_of_measurement = "mm"
|
||||||
else:
|
else:
|
||||||
self._state = "not raining"
|
self._state = "not raining"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user