Setting global variables to run routines at specific time of day/when conditions met


I have tinkered with this for quite a while, and never been able to get it to run. With ST either depreciating or outright breaking the modes that used to be associated with it, Ive lost a lot of processing based on what mode ST was in, i.e. Away, Home, Night etc.

Essentially I have modified my routines to be centered around the variable at the beginning and this routine to set the variables, however, it never runs, and I have tried multiple different iterations.

Not sure where to go with this one, but the logic is fairly simple.


If we look at the left margin, we can see that this piston only runs when Bedtime’s switch changes to on… If you also want it to run at sunrise, condense lines 33-35 into one trigger:
IF Time happens daily at sunrise

Likewise, to trigger this at sunset, change line 15 to:
IF Time happens daily at sunset

Pro Tip:

ASYNC does nothing in this piston, so I would change those back to standard IFs…


I’ve actually tried that already, and it never ran. I thought for sure that would have worked, but I can give it another shot.


The Location Modes (which default to Home, Away and Night) haven’t changed. It is the old Alarm System modes that were used by SHM which eventually stopped working.


Sure, they haven’t changed, but they certainly aren’t working anymore and haven’t been for a while.


Well I have updated the piston per @WCmore suggestion, we will see if it fires this evening.


Hopefully, your latest version has exactly 3 lightning bolts in the left margin. (Sunrise, sunset & switch)