(Solved) Help Needed in PLEG timestamp function

Guys,

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?

thanks

Dilepa

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

This may help people looking to program.

Triggers:

tUnlockon - Unlock button pressed
tUnlockoff - Unlock button released

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

Actions

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.