Trigger automation when Openweather forecasting rain in next hour if it is already raining

Hi,

For Openweather I see one sensor that has all the forecast data for the next 47 hours in a yaml which gets updated every hour. How would I start an automaton if there is rain coming within the next hour or if forecast missed it and it is already raining?

triggers are always OR logic:

trigger:
  - platform: state
    entity_id: weather.openweathermap
    to: rainy
  - platform: numeric_state
    entity_id: sensor.openweathermap_hourly_forecast_precipitation
    above: 0
condition:
  - if needed
action:
  -
  -

I have no clue how you want to trust to measure ‘if it is already raining’ from a weather sensor.
For the forecast, try this in your devtools > templates, assuming your entity is weather.openweathermap

{{ states.weather.openweathermap.attributes.forecast[0].precipitation }}

this gives you the precipitaion of the first group in the forecast attribute. With me that is too late as it covers ‘now’ so you should then use the second group, i.e.

{{ states.weather.openweathermap.attributes.forecast[1].precipitation }}

EDIT: this you can use in automation, as template trigger/condition

Hi, I have the same forecast entity but I have no clue what period this covers, do you know if this is ‘next hour’ or any ‘next x hours’? I have so little rain where I live that I have not been able to easily check this

I really don’t know for sure either TBH but I would assume that it’s the “next hour”. I think that’s the only thing that makes sense in my own head.

I’ve never really checked it for accuracy either.

Thanks all so far. Reason for looking for this I would like to have my screens go up before it is starting to rain. And I don’t mind buying a weather station but I think they are rather late with noticing it already is raining and weather predictions are for next twelve hours. While in my case I would like to know if there will be rain in the next hour or so. And what I did notice sometimes if I look at forecast now it is stating no rain in next hour and then in an hour or so it is raining despite that signal an hour ago of no rain. So in other words what to trust :slight_smile: cloudbased not safest but own weather station seems also not sufficient.

Why would a local weather station not be sufficient? It could detect rain when it actually rains… or do you want to act ‘before’ … I guess you would but is it an issue to pull up the screens when it just started to rain?

EDIT: my forecast providers (3 of them) are hopeless, I see ‘raining now’ when nothing happens and not the whole day or other states except rain where it is actuallt raining. In my view it only works when you actually measure for drops

I am indeed worried it would notice too late it is raining, and also when seeing data being pulled every five minutes. Could be already rather soaked screens and then rolled up would be better leave them hanging and drying before rolling.

I have no solution, some of my weather providers update 10m so way too late in this case. Hence a local rain-sensor would be the only realistic option imo.

What is the best way to detect rain? - Configuration - Home Assistant Community (home-assistant.io)

:umbrella: DIY Zigbee rain gauge - Share your Projects! - Home Assistant Community (home-assistant.io)

ESP rain detector - ESPHome - Home Assistant Community (home-assistant.io)

etc.

1 Like

ok thanks, than will look indeed for a Bresser or Alecta weather station.

If indeed DIY with ESP it not your thing …then yes, be careful on the connection … I have seen a few tuya and I (many others) am not too fond of tuya

Fully agreed on that one, though I did already buy some Tuya ones without knowing they were Tuya based, they are working but rather not indeed.