Simple if X trigger, then wait until Y trigger, then do Z


#1

1) Give a description of the problem
Trying to set up a simple piston that is activated on trigger X, then stays on standby until a following trigger Y happens, when that happens do Z.

2) What is the expected behavior?
Example. If my front yard gate opens, wait until the front door opens, then do something. In this way I can track the direction a person is moving.

3) What is happening/not happening?
Not sure if I am using the repeat feature correctly. Is this the best way to accomplish a if X wait till Y trigger? For the “until” in the repeat loop, is there an expression to say “until 5 minutes after the piston is first triggered?”

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS THEN HIGHLIGHT ALL OF THE LOGS SND CLICK ON THE </> ICON TO FORMAT THEM)


#2

I almost never used REPEAT.
Somehow some unpredictable situations messed it up.
I had a similar logic in my house , if someone opened the door, are they going upstairs or staying downstairs. Repeat got messed up if they WERE going upstairs, triggered some stuff, but changed their minds and came back downtairs in 3 seconds… It was messy:)))) (perhaps because of my lack of knowledge but anyway)

I started using variables.
@gatestatus
IF Gate door changes to open
Then
Set global variable @gatestatus = Open

IF Front door changes to open
AND
IF @gatestatus is = Open
Then
Do this do that
Wait 5 minutes
Set @gatestatus to = Closed