PLEG or PLTS and how to set timer

I’m trying to figure out the most efficient way to start a timer when a security sensor is triggered. When triggered I need to set a 90 second timer. If it times out set a VSwitch on. If it doesn’t time out by the time the sensor resets then stop the timer and reset the timer.

Any tips would be much appreciated.

For timing PLEG does not have second level resolution … The NOW clause runs at 1 minute intervals.

So you would need to use PLTS if you want 90 seconds. Also a PLTS is already a virtual switch! You can turn it on/off … or trigger it for timed on/off behavior.