How would I do a RM where the trigger is "Variable Has Been greater than 0 for at at least 2 seconds?"

I'm trying to create an action that when a keypad button is pressed, it increments a global variable by 1, so that I can then have other programs that trigger based on this value, such as if the variable is 1 (button pressed once) it does one action, but if the variable is 2 (such as a double tap) then it does a different action.

I need a way to reset the variable back to 0 though after 2 seconds. So I'm looking for an event that does:

If Variable 1 has a value that is greater than 0 for at least 2 seconds, then set Variable 1's value to zero.

Basically this trigger from HomeSeer4:

I can't claim all of what I list below is possible, but I don't have time at the moment to confirm, so thought I'd let you explore... That's half the fun :slight_smile:

Try setting something like this up in an RM rule:

Trigger: Button is pressed

  • Cancel Actions from this rule
  • Set Variable = < Current Variable Value > + 1
  • Set Variable = 0 -> Delayed by 2 seconds (Cancellable)


1 Like

Thanks I'll try! That looks promising. It's really just the "Has been for" or "Has been for exactly" that I'm trying to do so your event might work. I'll give it a shot and see.

Edit :That worked great, thanks so much!

1 Like

That was quick :slightly_smiling_face:. Great to hear it worked. I wasn't sure whether you could choose 2 seconds or not.