Wait for second trigger

I'm sure this is a simple rule but between trial and error and searching the community here, I cannot figure it out!

I basically want the acceleration sensor on the litter box to be active, then wait until a door opens then flip a virtual switch. But if the door doesn't open within 5 min, then do nothing.

Here's what I have:

But it seems to wait for the door to open but then just flips the virtual switch whether the door was opened or not.

Probably simple for someone to figure out but I would be greatly appreciative!

It's pretty simple actually, the timeout means that after the time you specified, the next line in the rule is executed.
Therefore, it's behaving normally.
A simple way to fix your rule would be to add an IF statement after the "Wait for Event" that checked if "Laundry Room Door open", in case it was the timeout that occurred.
In 2.2.5 they added a way of checking if it was the timeout that triggered or the wait for event, but in your case I don't think you should bother with it as it's a bit more complicated.

Also, if you just want it to do nothing, just remove the timeout and that's it. It would wait forever, until the rule is triggered again.

In this scenario though, if the door opened then closed only 2 min after the litter box acceleration sensor was active, then the if command would see the door was currently closed though and wouldn't flip the virtual switch, correct?

As soon as it opened, the IF would run, which should evaluate to True.
The timeout is only there in case your Wait for Event doesn't happen

The issue with this approach is that the next time the laundry room door was opened, then it would flip the switch. That could be a day later.

Perhaps some context would help:
I have an acceleration sensor on our litter box so that a tablet in our house shows the last time the litter box was changed. The cat can activate the motion sensor just by rummaging around in there. However, when we clean the litter box, we open the laundry room door and dump the litter in a garbage that is just outside the laundry room door.

So my goal is to have a rule that when the litter box sensor is active, and then the laundry room door opens within 5 minutes of that (and no longer), then the virtual switch gets flipped. If the door is opened at a point later than 5 minutes, I would want nothing to happen.

Then just add the IF I mentioned, it would be exactly as you said.

Like this?


It seems to me that the switch will be turned on any time the laundry room door is opened after the acceleration sensor is active? Like a day or two later, no?

Yes, but keep the 5 minutes timeout

Ohhhhh! Now I see!


Ok, that make sense! So the rule will wait up to 10 minutes and if, during that time, the door is open, the IF condition will run and since the door is open at that point, the If command is true and therefore it flips the switch.

Thanks so much!

A keyword I was searching for trying to find an answer was "second trigger" or "2nd trigger" so I'm adding that here to hopefully help others in the future.

1 Like

No problem, that is exactly it.

And just to complement, after the 10 minutes of wait and the door still not open, the rule will go to the next step, which is to run the IF. At this point, it will evaluate to false so it will not turn on your switch.

1 Like