Comparison of Variables as a Trigger


#1

1) Give a description of the problem
Appologies if this question has been asked many times before, I searched and didn’t find a specific response.

I’m trying to use a condition as a trigger, i.e. I have a global variable, let’s call it $OffTime. When $Now > $OffTime I want to trigger an event. I can use a conditional statement such as:

I get the warning that will never run on it’s own, even though it is a trigger…

2) What is the expected behavior?
Would be great if this executed as a trigger - i.e. a change in this comparison acted as a trigger.

3) What is happening/not happening?
Is there a better way to make this happen?

**4) Post a Green Snapshot of the piston!
Here is my current work around but would much rather this be interrupt driven rather than a polled behavior.


#2

I use:

Every day at @globalTime
  Do stuff
End every

But one important distinction I must make. The piston will not see any changes you have made to the global variable until it actually runs.

To circumvent this, we can add a few empty blocks to that piston. These extra blocks do nothing but update the wake up schedule to the new @globalTime.

temp

If your @globalTime changes too frequently, you may have to rethink your programming, or be forced to poll more often.


#3

A variation of this works with motion sensors:

If motion sensor changes to active               <-- Trigger
Then
    If time is between @globalOn and @globalOff  <-- Condition
    Then do stuff
    End If
End If

The reason this works is because we have a static trigger (motion changing to active), and when that happens, it then checks the current global variables.