Scene for sliding gate logic

I’m using a Fibaro dual relay (but just one of the outputs) to control a sliding gate that has the following logic in the control sequence.
First pulse (I use 2 sec) opens the gate - no problem there!
after a timeout in the gate logic, the gate automatically closes (about a minute) - no problem there either.
BUT
If you wish the gate to remain open indefinitely, you send a second pulse to start the closing sequence (before the auto-close feature occurs) and immediately after you send a further pulse which stops the gate and it remains in that state.

So I tried writing a scene which sends a pulse, delay 2secs (gate starts to open), wait 30 secs (gate is now open), send another pulse (gate starts to close) and after 1 sec, send a further pulse to stop it.

Trouble is that Vera UI7 (and 5) sorts the delays in increasing order and not the sequence desired.

I tried again using 2 separate scenes. One to open the gate - no problem and another to hold it open (again no problem), but how do I chain the two together so that I can open the gate and hold it open with one command?

Is this a job for PLEG or the PLT? If so, how please?

Thanks in advance for any advice!

You can use PLEG for this:

Inputs:
GateTimer On-Self Trigger, Off Interval 1:00 minute
Pulse ??? I have no idea what is triggering your PULSE
GateOpen Indicates Gate is Open

OpenGate Pulse and (Not GateOpen)
CloseGate (GateOpen; !GateTimer) and ((Pulse; GateTimer)

Actions:
OpenGate Open the Gate and Trigger GateTimer (Advance Tab, Select PLEG Device, StartTimerAction, timer name is GateTimer)
CloseGate Close the Gate

Richard

Thanks very much, but although I’ve installed PLEG I’ve not used it yet! I’ll see if I can get to grips with it.

My pulse is triggered by a manual input from my iPhone (Vera Mate) or by a schedule.

See:
http://forum.micasaverde.com/index.php/topic,21603.0.html