Need help with simple piston which turns light off after a fixed interval of time


#1

1) Give a description of the problem
2) What is the expected behaviour?
The core premise is simple enough I think - turn on when motion is detected and no other lights are on, wait for 1 minute and turn off. The light turns on as expected based on all the conditions and restrictions in effect. However, it does not turn off after 1 mins.

3) What is happening/not happening?
From the logs I see that it asks for a wake up request after 1 minute. However, when the wakeup request is received, nothing happens.

**4) Post a Green Snapshot of the piston

5) Attach logs after turning logging level to Full

9/9/2020, 6:53:09 AM +118ms
+0ms â•”Received event [Home].time = 1599655990158 with a delay of -1040ms
+123ms â•‘RunTime Analysis CS > 27ms > PS > 52ms > PE > 44ms > CE
+126ms â•‘Runtime (41724 bytes) successfully initialized in 52ms (v0.3.110.20191009) (125ms)
+127ms â•‘â•”Execution stage started
+128ms â•‘â•šExecution stage complete. (1ms)
+129ms â•šEvent processed successfully (129ms)

9/9/2020, 6:52:15 AM +89ms
+1ms â•”Received event [Front Door].contact = closed with a delay of 72ms
+94ms â•‘RunTime Analysis CS > 19ms > PS > 41ms > PE > 34ms > CE
+96ms â•‘Runtime (41727 bytes) successfully initialized in 41ms (v0.3.110.20191009) (94ms)
+97ms â•‘â•”Execution stage started
+137ms â•‘â•‘Comparison (time) 24735189 is_between (time) 1599700680000 .. (time) 1599654960000 = true (8ms)
+138ms â•‘â•‘Time restriction check passed
+140ms â•‘â•‘Condition #1 evaluated true (40ms)
+141ms â•‘â•‘Condition group #null evaluated true (state did not change) (41ms)
+145ms â•‘â•‘Comparison (enum) closed changes_to (string) open = false (0ms)
+147ms â•‘â•‘Cancelling condition #3's schedules...
+147ms â•‘â•‘Condition #3 evaluated false (5ms)
+150ms â•‘â•‘Conditional ladder step failed due to a timeout
+151ms â•‘â•‘Cancelling statement #9's schedules...
+152ms â•‘â•‘Condition group #9 evaluated false (state did not change) (3ms)
+152ms â•‘â•‘Cancelling condition #2's schedules...
+153ms â•‘â•‘Condition group #2 evaluated false (state changed) (11ms)
+155ms â•‘â•šExecution stage complete. (58ms)
+156ms â•šEvent processed successfully (156ms)

9/9/2020, 6:52:09 AM +943ms
+1ms â•”Received event [Front Door].contact = open with a delay of 6117ms
+76ms â•‘RunTime Analysis CS > 14ms > PS > 32ms > PE > 30ms > CE
+79ms â•‘Runtime (41734 bytes) successfully initialized in 32ms (v0.3.110.20191009) (77ms)
+80ms â•‘â•”Execution stage started
+114ms â•‘â•‘Comparison (time) 24730026 is_between (time) 1599700680000 .. (time) 1599654960000 = true (8ms)
+115ms â•‘â•‘Time restriction check passed
+117ms â•‘â•‘Condition #1 evaluated true (34ms)
+118ms â•‘â•‘Condition group #null evaluated true (state did not change) (35ms)
+122ms â•‘â•‘Comparison (enum) open changes_to (string) open = true (1ms)
+123ms â•‘â•‘Cancelling condition #3's schedules...
+124ms â•‘â•‘Condition #3 evaluated true (5ms)
+125ms â•‘â•‘Cancelling condition #2's schedules...
+126ms â•‘â•‘Condition group #2 evaluated true (state changed) (7ms)
+160ms â•‘â•‘Comparison (enum) off is (string) off = true (1ms)
+162ms â•‘â•‘Comparison (enum) off is (string) off = true (1ms)
+164ms â•‘â•‘Comparison (enum) off is (string) off = true (1ms)
+167ms â•‘â•‘Comparison (enum) off is (string) off = true (1ms)
+169ms â•‘â•‘Comparison (enum) off is (string) off = true (1ms)
+171ms â•‘â•‘Comparison (enum) off is (string) off = true (1ms)
+173ms â•‘â•‘Condition #13 evaluated true (44ms)
+174ms â•‘â•‘Condition group #12 evaluated true (state did not change) (46ms)
+176ms â•‘â•‘Cancelling statement #4's schedules...
+209ms â•‘â•‘Executed physical command [Passage Light (Hallway)].setLevel([50]) (30ms)
+210ms â•‘â•‘Executed [Passage Light (Hallway)].setLevel (32ms)
+213ms â•‘â•‘Executed virtual command [Passage Light (Hallway)].wait (1ms)
+214ms â•‘â•‘Requesting a wake up for Wed, Sep 9 2020 @ 6:53:10 AM MDT (in 60.0s)
+218ms â•‘â•šExecution stage complete. (139ms)
+220ms â•‘Setting up scheduled job for Wed, Sep 9 2020 @ 6:53:10 AM MDT (in 59.996s)
+228ms â•šEvent processed successfully (228ms)

#2

Hi, I’m not sure about all your conditions to switch the light on, they seem quite complex, but I assume they’re ok as the light comes on/

I suspect the turn off fails as the piston will be cancelled if any of the triggers occur again. To get round this you need to change the task cancellation to never on the with statement. Its available if you edit the with and then click the gear icon at the bottom


#3

Yeah, it’s a long-winded way of saying that turn the light at the entrance on only if it’s dark :confused:
Thanks for pointing me to the Task Cancellation Policy. I set it to never cancel and it worked.
I also found some more information about how TCP works here: How TCP is set to NEVER - when WAIT is not working in your piston