mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix precipitation calculation for hourly forecast (#52676)
It seems that hourly forecast have precipitation in 3h blocks.
This commit is contained in:
parent
abca7deadb
commit
1dd4ba5fcd
@ -191,6 +191,8 @@ class WeatherUpdateCoordinator(DataUpdateCoordinator):
|
||||
"""Get rain data from weather data."""
|
||||
if "all" in rain:
|
||||
return round(rain["all"], 2)
|
||||
if "3h" in rain:
|
||||
return round(rain["3h"], 2)
|
||||
if "1h" in rain:
|
||||
return round(rain["1h"], 2)
|
||||
return 0
|
||||
@ -201,6 +203,8 @@ class WeatherUpdateCoordinator(DataUpdateCoordinator):
|
||||
if snow:
|
||||
if "all" in snow:
|
||||
return round(snow["all"], 2)
|
||||
if "3h" in snow:
|
||||
return round(snow["3h"], 2)
|
||||
if "1h" in snow:
|
||||
return round(snow["1h"], 2)
|
||||
return 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user