How to? If sensor open/closed for at least x seconds

Hi all,

I'm still fairly new to HE and RM, but not new to home automation. I need to set up a rule that fires off an action when a sensor remains tripped (i.e., open) for at least a certain number of seconds (30, in this case). What's the simplest, most reliable way to do this using RM?

The immediate use case is that I have a power-sensing relay connected to a door/window sensor. If AC power is lost the sensor informs HE (which is on a UPS), which then fires off a Pushover notification. But I only want to receive that notification if the power remains off longer than the time it should take the backup generator to kick in. Otherwise, I don't need to know that power was lost for, say, only 2 or 3 seconds. Please note that I think I might be able to handle this through the notifications app, but I can think of some other situations where I might need this capability within RM, so I figured it was best to figure it out now. Thanks in advance for help and guidance.

From memory I think the idea is to trigger the rule on the switch changing, I e. on or off, then put an IF-RHEN-ELSE in the actions:

IF switch open THEN
Delay X time (cancellable)
Do something
ELSE
Cancel actions from this rule

Others may be able to comment on this better than I can.

EDIT - Actually, I think you can incorporate the delay in the "do something" action.