Triggering if a sensor has been ON for over X minutes during the last Y minutes

I have a RG-9 rain sensor that reports if it is raining or not. It is quite sensitive so it’ll report as “Dry” if no rain drops have hit the sensor dome in the last few seconds, but it can also reports “Wet” if there is some morning dew forming.

Screen Shot 2021-11-03 at 22.20.35

I would like to close a window and garage door if it is persistently raining, not just drizzling (I live in Portland, OR – so there is a difference :slight_smile: )

Can I specify a trigger if the rain sensor reported “Wet” for more than X minutes within the last Y-minutes window?? It is reported using a ESP32/ESPHome sensor, so the integration could be done at that end as well.

There are some suggestions in this feature request.

Vote for it if you would like to see it implemented.

I use Node-Red for those situations.
There is a setting in the polling of event states that checks if the status reverts back or stays the same.