(Solved) Help Needed in PLEG timestamp function


Am a new to PLEG and trying out its timestamp function.

I have a universal sensor that gives a signal for 2-3 seconds (turns ON) and turns off. I need to evaluate that the signal ON time happens for less than 5 seconds. I have used this in the condition, but it never evaluates to true. If the sensor signal is ON for a longer time, the condition should be false.

UnlockOK (#!Door_Unlock_Input1 - #Door_Unlock_Input1)<5

Am i doing something wrong?



Following Richard’s instructions on the motion sensor and light, implemented the same to my logic.

This may help people looking to program.


tUnlockon - Unlock button pressed
tUnlockoff - Unlock button released

cUnlockdoor tUnlockoff AND (tUnlockon;tUnlockoff<5>2)


Deadbolt unlock

This scenario is to make sure that the signal comes on positively and turns off within 5sec to eliminate noise and potential malicious signal if it stays on for a longer time thereby locking out the deadbolt.