My end goal is to create automation that disables my automatic Lawn Mower in case there was any rain over the past 6 hours.
To track when it rains I’m using the OpenWeatherMap integration. But since I’m using the free tier - I can only use the Hourly API which returns weather forecast for the next hour only (instead for the whole day).
How do I make this work?
I was thinking of using the sensor.openweathermap_forecast_precipitation history data to check if it was raining over the past 6 hours:
As can be seen from the screenshot - the history is there.
But I’m not sure how to translate this into actual history stats.
Could you help me define the yaml please?
Additionally, after I create the history stats - how can I define a simple boolean switch that says whether it has rained or not depending on the history stats?
Yeah, it’s a very decent approach.
The forecasting itself may not be supe accurate but the current weather is - or in other words OpenWeatherMap knows very well if it’s raining at the moment or not. So if we store that history and put it in a switch it’s actually pretty trustworthy. I don’t think I need a rain sensor because other people already installed them and this is where OpenWeatherMap takes its data from
So this is my final configuration that used to work fine for the past 22 days. However, I noticed that it doesn’t work anymore - the history stats shows positive value when not raining and vice-versa - 0 value when it starts raining. I’m trying to wrap my head around why this is the case.
I recently updated HASSIO so it might be related, although not really sure how.
From the graphics it really looks like the history stats works in an inverted way - when it has been raining for the past 6 hours - the value is 0 and vice-versa - when there hasn’t been any rain the value is above 0. But why is that? This started happening since last HASSIO update and I already checked the graphics for the previous days - the history stats works as expected there and is on-par with the binary sensor.
Any suggestions?