Do something only if location mode has been set to Away for 3 minutes


#1

1) Give a description of the problem
I’m stumped. I have a piston that monitors doors and windows and sends a SMS message and triggers a phone call if doors or windows are opened when the location mode is away. The challenge is I want it to notify us only if it has been three minutes since the location mode was changed to away. I’ve tried different permutations but can’t figure it out and the piston never waits 3 minutes. I know I can do this using a variable and a wait statement but it seems like there’s probably a more straightforward approach I’m missing.

I guess I basically want something that says “send alerts if something opens when the location mode is away and it has been set to away for longer than 3 minute.” I’ve tried various comparisons for location mode (stays, stays away from, etc.) without luck.

As a note, we use a voice command to set the location mode to away as we leave, hence the need to have the piston hold off for three minutes in case someone forgets something and has to run back into the house. The screenshot shows my latest attempt.

I’m sure I’m missing something obvious but I’m missing it. Thoughts or suggestions?

2) What is the expected behaviour?
Send alerts if a door or window opens AND location mode has been set to Away for three minutes or more.

3) What is happening/not happening?
The piston doesn’t wait 3 minutes before reacting to a change in a door or window sensor’s open/closed status.

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

REMOVE BELOW AFTER READING


#2

I did not dig into your piston, but you have nested triggers. One at line 23 and one at line 29. Generally, it is not a good idea to do that. Usually, I like to stay with a single top level trigger and conditions below that. Also, and I am not sure on this one, there have been recent discussions about “stays” and whether or not the programming was finished for that. And, “stays” seems to have some unusual and unexpected behavior. @orangebucket may be able to offer more on that topic.


#3

Okay, my bad. It appears the piston was actually working. I had created a copy to play with and forgot to pause the original. Since the original didn’t have the “wait 3 minute” code, it was firing immediately. Doh. :grimacing:


#4

On latest HE, stays should work. repeating what was said, you nested the stays inside other triggers, and that is not going to end well for stays.

Stays should get ‘executed/evaluated’ on each run, and not just some runs…

For example mode could change, but because a contact did not change, the stays timer will not be set/cancelled properly.