Trying to compare two times. Is this correct?


#1

1) Give a description of the problem
I want part of a piston to only run if it hasn’t run in the last two minutes

2) What is the expected behavior?
I get a notification

3) What is happening/not happening?
I’m not getting a notification

4) Post a Green Snapshot of the pistonimage

As you can see, the expression I’m using is:

le(addMinutes(lastRun, 2), $now)

but apparently that’s wrong. What am I missing?


#2

virtual device -> Date & Time is greater than the left hand expression

though, since you set lastRun to now immediately before this comparison this if condition will always be true.


#3

I’m not sure I understood your first sentence. However, DUH, setting lastRun right before the comparison was a silly mistake.


#4

sorry … change the if statement to use this condition if le(…) is not working

if virtual device -> Date & Time is greater than addMinutes(…)