1) Give a description of the problem
I’m trying to create a piston to change the mode of the house and do a bunch of things if any of three things happen - a switch is turned on, the mode is changed, or the time becomes a certain time of day. Morning mode, for example, which can be triggered by turning on the Morning Mode switch, or by a Routine that changes the mode to Morning, or at 60 minutes after sunrise.
2) What is the expected behavior?
If the house isn’t currently in the desired mode, then if the mode’s switch is turned on, or SmartThings mode changes to that mode, or the time reaches a threshold, then run all of the tasks (some of which include waits). If the house is already in that mode and the switch changes or the time is reached, or the switch is already on and the mode changes or the time is reached, or the timer is reached and the mode is already correct and the switch is on, then do nothing. Tasks scheduled by the piston should always complete once they’ve been scheduled.
Since the piston can be triggered in multiple ways, some of the actions change the triggers to the “correct” values for that mode. So, if you use the switch to change the mode, one of the actions will set the mode. Since setting the mode is a trigger, this will trigger the piston again. The piston should not do anything if it reenters in this way.
3) What is happening/not happening?
I’ve set the main “if” to TCP=Never, but tasks that have been scheduled by the first run-through (when the switch was turned on), are cancelled when the piston triggers again (even though the restrictions prevent it from running) because the mode changed in the first run-through. That is unexpected. Perhaps I have an incorrect understanding of “Never”? What I’m looking for is an answer to why, specifically, that 10 minute wait (#22), is getting cancelled. Thanks in advance, all.
4) Post a Green Snapshot of the piston![image|45x37]
5) Attach any logs (From ST IDE and by turning logging level to Full)
22/2018, 6:39:38 AM +542ms
+0ms ╔Received event [Aptos Home].mode = Morning with a delay of 130ms
+9818ms ║RunTime Analysis CS > 18ms > PS > 9630ms > PE > 171ms > CE
+9819ms ║Piston waited at a semaphore for 9573ms
+9821ms ║Runtime (47334 bytes) successfully initialized in 9630ms (v0.3.000.20180224) (9820ms)
+9822ms ║╔Execution stage started
+9835ms ║║Comparison (enum) on is (string) off = false (2ms)
+9837ms ║║Condition #42 evaluated false (9ms)
+9842ms ║║Comparison (string) Morning is_not (string) Morning = false (1ms)
+9843ms ║║Cancelling condition #43's schedules...
+9844ms ║║Condition #43 evaluated false (7ms)
+9845ms ║║Cancelling condition #null's schedules...
+9846ms ║║Condition group #null evaluated false (state changed) (20ms)
+9847ms ║║Piston execution aborted due to restrictions in effect
+9854ms ║║Comparison (string) Morning is (string) Night = false (2ms)
+9855ms ║║Cancelling condition #4's schedules...
+9864ms ║║Cancelling condition #32's schedules...
+9867ms ║║Comparison (string) :3e0a642731dafac63a189f7896422f57: changes_to (string) :3e0a642731dafac63a189f7896422f57: = true (0ms)
+9869ms ║║Cancelling condition #33's schedules...
+9870ms ║║Cancelling condition #2's schedules...
+9924ms ║║Comparison (time) 23988413 happens_daily_at (time) 1521727680000 = false (0ms)
+9925ms ║║Cancelling statement #41's schedules...
+9930ms ║║Requesting time schedule wake up at Thu, Mar 22 2018 @ 8:08:00 AM PDT
+9932ms ║║Cancelling condition #1's schedules...
+9956ms ║║Comparison (enum) on is (string) on = true (2ms)
+9990ms ║╚Execution stage complete. (168ms)
+9991ms ║Setting up scheduled job for Thu, Mar 22 2018 @ 8:08:00 AM PDT (in 5291.467s)
+10001ms ╚Event processed successfully (10001ms)
3/22/2018, 6:39:38 AM +79ms
+2ms ╔Received event [Morning Mode].switch = on with a delay of 176ms
+222ms ║RunTime Analysis CS > 30ms > PS > 62ms > PE > 129ms > CE
+225ms ║Runtime (47263 bytes) successfully initialized in 62ms (v0.3.000.20180224) (221ms)
+226ms ║╔Execution stage started
+236ms ║║Comparison (enum) on is (string) off = false (2ms)
+238ms ║║Cancelling condition #42's schedules...
+239ms ║║Condition #42 evaluated false (7ms)
+244ms ║║Comparison (string) Night is_not (string) Morning = true (2ms)
+246ms ║║Condition #43 evaluated true (6ms)
+247ms ║║Condition group #null evaluated true (state did not change) (16ms)
+255ms ║║Comparison (string) Night is (string) Night = true (1ms)
+256ms ║║Condition #4 evaluated true (6ms)
+262ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+263ms ║║Cancelling condition #32's schedules...
+264ms ║║Condition #32 evaluated true (6ms)
+265ms ║║Cancelling condition #44's schedules...
+266ms ║║Condition group #44 evaluated true (state changed) (9ms)
+268ms ║║Cancelling condition #2's schedules...
+268ms ║║Condition group #2 evaluated true (state changed) (18ms)
+270ms ║║Cancelling condition #1's schedules...
+270ms ║║Condition group #1 evaluated true (state changed) (21ms)
+273ms ║║Cancelling statement #17's schedules...
+279ms ║║Executed virtual command sendNotification (3ms)
+345ms ║║Executed virtual command setLocationMode (63ms)
+366ms ║║Executed virtual command setAlarmSystemStatus (17ms)
+369ms ║║Cancelling statement #29's schedules...
+373ms ║║Skipped execution of physical command [Morning Mode].on([]) because it would make no change to the device. (0ms)
+374ms ║║Executed [Morning Mode].on (2ms)
+377ms ║║Cancelling statement #10's schedules...
+385ms ║║Skipped execution of physical command [Day Mode].off([]) because it would make no change to the device. (4ms)
+386ms ║║Executed [Day Mode].off (6ms)
+392ms ║║Skipped execution of physical command [Evening Mode].off([]) because it would make no change to the device. (2ms)
+392ms ║║Executed [Evening Mode].off (4ms)
+629ms ║║Executed physical command [Night Mode].off() (234ms)
+630ms ║║Executed [Night Mode].off (236ms)
+633ms ║║Cancelling statement #19's schedules...
+642ms ║║Skipped execution of physical command [Drawer Washer].on([]) because it would make no change to the device. (4ms)
+643ms ║║Executed [Drawer Washer].on (5ms)
+650ms ║║Skipped execution of physical command [Garage Door Master Switch].on([]) because it would make no change to the device. (4ms)
+651ms ║║Executed [Garage Door Master Switch].on (4ms)
+845ms ║║Executed physical command [Kitchen Sink Lights].on() (192ms)
+846ms ║║Executed [Kitchen Sink Lights].on (192ms)
+852ms ║║Skipped execution of physical command [Washer].on([]) because it would make no change to the device. (4ms)
+853ms ║║Executed [Washer].on (5ms)
+856ms ║║Cancelling statement #21's schedules...
+862ms ║║Executed virtual command [Den Lamp, Entry Hall Lamp].wait (0ms)
+864ms ║║Requesting a wake up for Thu, Mar 22 2018 @ 6:49:38 AM PDT (in 600.0s)
+877ms ║║Comparison (enum) on is (string) on = true (1ms)
+878ms ║║Condition #27 evaluated true (9ms)
+879ms ║║Condition group #24 evaluated true (state did not change) (11ms)
+882ms ║║Cancelling statement #25's schedules...
+904ms ║║Executed physical command [Hot Water Pump].on() (19ms)
+905ms ║║Executed [Hot Water Pump].on (20ms)
+908ms ║║Cancelling statement #5's schedules...
+925ms ║║Executed physical command [Master Bedroom Lamp].on() (13ms)
+926ms ║║Executed [Master Bedroom Lamp].on (15ms)
+938ms ║║Executed physical command [Master Bedroom Lamp].setColor([[hex: #00008B, hue:67, saturation:100, level:27]]) (8ms)
+939ms ║║Executed [Master Bedroom Lamp].setColor (11ms)
+964ms ║║Executed physical command [Master Bedroom Lamp].setLevel([100]) (13ms)
+987ms ║║Executed virtual command [Master Bedroom Lamp].fadeLevel (42ms)
+989ms ║║Requesting a wake up for Thu, Mar 22 2018 @ 6:44:39 AM PDT (in 300.1s)
+1021ms ║╚Execution stage complete. (796ms)
+1032ms ║Setting up scheduled job for Thu, Mar 22 2018 @ 6:39:51 AM PDT (in 11.938s), with 28 more jobs pending
+1047ms ╚Event processed successfully (1046ms)