How to trigger an action only if a condition was met for a specified time?

I'd like to make a rule where I am sent a notification if humidity on a sensor exceeds X%, but only if it has been above X% for at least N minutes.

I'm sure this has been asked/addressed before but wasn't able to find it in search. I suspect I can use a combination of delays or private variables with conditional logic. I figured I'd check here for a good example before attempting to work one out on my own (with likely initial bugs).

While not for humidity you can probably get some ideas from this. In this one I change the thermostat if doors are left open for more than 2 minutes and I change it again once the doors are closed for more than 2 minutes. You would just want to use the Delay command and then make an IF test after the delay to see if your initial trigger condition was still true.


Thanks for the reference!