RM help: If statement with time critera

I have a rule setup in sharptools so that after a trigger event, in the execution flow, there is an If statement. That if statement consists of:

If Switch XXX has been "on" for 1 minute, then..........

Note, the trigger is a different device than switch xxx.

After my trigger event, I have it so that the rule looks at a status relay. If that relay has been active for a minute, do a ceratin action, but if the relay only went acive a minute or less ago, do a different action.

Can't quite figure this one out.

There are probably several different ways to do this. The one that springs to mind is to use a separate rule triggered by the status relay turning on, with the trigger having a Stays for 1 minute element. So that rule is triggered when the relay has been on for 1 minute. Then it can set a Hub Variable (Boolean) to true. Now, when your main rule runs, it can just look at that Hub Variable to know if the status relay has been on for 1 minute.

You'd also need to clean things up, like reset the variable when the status relay turns off. That could be done with a Wait in the rule, Wait for Event, switch off, then set the Hub Variable to false.

2 Likes