From 1dd4ba5fcdb2b5d622ec6c0e01b106f417c9186b Mon Sep 17 00:00:00 2001
From: Stefan Agner <stefan@agner.ch>
Date: Thu, 8 Jul 2021 11:39:56 +0200
Subject: [PATCH] Fix precipitation calculation for hourly forecast (#52676)

It seems that hourly forecast have precipitation in 3h blocks.
---
 .../components/openweathermap/weather_update_coordinator.py   | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/homeassistant/components/openweathermap/weather_update_coordinator.py b/homeassistant/components/openweathermap/weather_update_coordinator.py
index 98f39290d22..73edc9fae75 100644
--- a/homeassistant/components/openweathermap/weather_update_coordinator.py
+++ b/homeassistant/components/openweathermap/weather_update_coordinator.py
@@ -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