Help--vacation lighting piston doesn't turn off at set time


#1

1) Give a description of the problem
Switch 2, 4, and 5 continue to operate randomly after 11:46pm.

2) What is the expected behavior?
I have tried to design this piston such that switches 2, 4, and 5 turn off at 11:46pm even though my SmartThings hub remains in “away” mode constantly while I am on vacation for days at a time.

3) What is happening/not happening?
-Switch 1 operates properly–it turns on at sunset every day and turns off at 11:31pm every day while the SmartThings hub remains in away mode for days at a time while I am on vacation
-Switches 2, 4, and 5 are not operating properly–they are supposed to start turning on randomly at sunset and then all turn off at 11:46pm every day while the SmartThings hub remains in away mode for days at a time while I am on vacation. Currently, they do turn on at sunset everyday while in away mode but then they keep turning on and off randomly way past 11:46pm–this is not the desired behavior as described.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach any logs (From ST IDE and by turning logging level to Full)
I will see if I can post some logs later as I don't have any yet but perhaps someone will see my mistake/help me without the logs?

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

I don’t know why it’s not working as you want it to, but here is another way of skinning the cat.


#3

Ok, so it did the same thing tonight as the night before–at 11:53pm, switch 4 turned on randomnly–this random behavior should have cut off at 11:45pm per the code as I read it…any ideas? Below is the log showing the successful command to turn everything off at 11:45pm and then the random turning on of switch 4 at 11:53pm for reasons I don’t understand:

Also, should this timer be counting down all the time when it is outside the active time range of sunset to 11:46pm (SThings hub remains in away mode to simulate me being on vacation):


#4

This one should resolve your issue with things continuing to occur beyond 11:46pm (done by adding a “cancel all pending tasks” line.

The reason your piston triggered again after 11:46pm is because the last time it processed “wait randomly between 1 and 29 minutes” it set the wait time so it executed at 11:53pm.

To answer your question on the countdown… the timer on the piston will only show when it’s counting down to its next timed trigger - either a “happens daily at/every xx minutes” trigger or the time the piston scheduled to wake itself up last time it ran.


#5

Michicago–this is SO HELPFUL–I greatly appreciate you taking time out of your day to help me :+1::ok_hand::blush:. Your explanation makes perfect sense as you can see from the accompanying log below–just as you stated, the piston executed any previously processed events before the “kill time” of 11:46pm: once these previously processed events were complete there was no more activity for the rest of the night despite my SmartThings hub remaining in away mode. Thanks again–I would have NEVER been able to divine that critical “cancel all pending tasks” code without your help.


#6

Glad to help, @NS123! Your appreciation makes it more than worthwhile. :slight_smile: