Timed wait not working well, getting cancelled


#1

1) Give a description of the problem
I have a pool pump schedule which turns on my pool pump for 1 hr in winter, 2 hrs in Spring and Autumn, and 3 hrs in Summer, every day. The season is set through another piston and that works well. I have three if conditions that trigger the pool pump at certain times of day and those too work well.

At the end of the piston, I have a short statement whose work is simply to wait 60 minutes, then turn the pump off again. This because I want the pump to stay on for just 60 minutes every time it is started by a piston. Of course, I can do that in a different piston, but I wanted everything that has to do with the pool pump to be in the same piston.

It’s not working well for me though, and if I understand the log well, the wait is getting cancelled every time the piston is triggered - even if the triggering conditions end up being false.

2) What is the expected behaviour?
Expected behaviour would be for the statement at the end to just wait, and not to get cancelled by any triggering of the piston. To this end, I enabled parallelism on the piston in order to avoid triggers running in sequence, and then I set the IF statement to “Never cancel”, but to no avail.

3) What is happening/not happening?
As described above, it seems that the wait is getting cancelled. Conseuently, the pool pump remains on until I have to switch it off manually.

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

5) Attach logs after turning logging level to Full

3/30/2021, 2:29:59 PM +70ms

+0ms ╔Received event [Home].time = 1617107400000 with a delay of -930ms
+59ms ║RunTime Analysis CS > 15ms > PS > 3ms > PE > 41ms > CE
+62ms ║Runtime (47521 bytes) successfully initialized in 3ms (v0.3.113.20210203) (61ms)
+63ms ║╔Execution stage started
+77ms ║║Cancelling statement #161’s schedules…
+82ms ║║Executed virtual command setVariable (2ms)
+85ms ║║Executed virtual command setVariable (1ms)
+89ms ║║Comparison (time) 52199157 happens_daily_at (time) 43200000 = false (0ms)
+90ms ║║Condition #177 evaluated false (3ms)
+94ms ║║Cancelling statement #177’s schedules…
+97ms ║║Requesting time schedule wake up at Wed, Mar 31 2021 @ 12:00:00 PM CEST
+99ms ║║Condition group #176 evaluated false (state did not change) (12ms)
+103ms ║║Comparison (time) 52199171 happens_daily_at (time) 39600000 = false (1ms)
+104ms ║║Condition #179 evaluated false (3ms)
+112ms ║║Cancelling statement #179’s schedules…
+115ms ║║Requesting time schedule wake up at Wed, Mar 31 2021 @ 11:00:00 AM CEST
+118ms ║║Comparison (time) 52199187 happens_daily_at (time) 50400000 = false (0ms)
+120ms ║║Cancelling condition #180’s schedules…
+121ms ║║Condition #180 evaluated false (4ms)
+122ms ║║Cancelling statement #180’s schedules…
+125ms ║║Requesting time schedule wake up at Wed, Mar 31 2021 @ 2:00:00 PM CEST
+127ms ║║Cancelling condition #178’s schedules…
+127ms ║║Condition group #178 evaluated false (state changed) (26ms)
+132ms ║║Comparison (time) 52199200 happens_daily_at (time) 37800000 = false (0ms)
+133ms ║║Condition #188 evaluated false (3ms)
+134ms ║║Cancelling statement #188’s schedules…
+137ms ║║Requesting time schedule wake up at Wed, Mar 31 2021 @ 10:30:00 AM CEST
+141ms ║║Comparison (time) 52199209 happens_daily_at (time) 45000000 = false (1ms)
+142ms ║║Condition #189 evaluated false (3ms)
+143ms ║║Cancelling statement #189’s schedules…
+146ms ║║Requesting time schedule wake up at Wed, Mar 31 2021 @ 12:30:00 PM CEST
+150ms ║║Comparison (time) 52199218 happens_daily_at (time) 52200000 = true (1ms)
+151ms ║║Time restriction check passed
+152ms ║║Cancelling condition #190’s schedules…
+153ms ║║Condition #190 evaluated true (5ms)
+154ms ║║Cancelling statement #190’s schedules…
+157ms ║║Requesting time schedule wake up at Wed, Mar 31 2021 @ 2:30:00 PM CEST
+159ms ║║Cancelling condition #187’s schedules…
+160ms ║║Condition group #187 evaluated true (state changed) (31ms)
+165ms ║║Comparison (string) Spring is (string) Summer = false (1ms)
+166ms ║║Condition #192 evaluated false (4ms)
+167ms ║║Condition group #191 evaluated false (state did not change) (5ms)
+173ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+174ms ║║Cancelling condition #201’s schedules…
+175ms ║║Condition #201 evaluated false (5ms)
+176ms ║║Cancelling condition #200’s schedules…
+177ms ║║Condition group #200 evaluated false (state changed) (7ms)
+216ms ║╚Execution stage complete. (153ms)
+225ms ║Setting up scheduled job for Wed, Mar 31 2021 @ 10:30:00 AM CEST (in 72000s), with 5 more jobs pending
+235ms ╚Event processed successfully (235ms)

3/30/2021, 1:59:59 PM +51ms

+0ms ╔Received event [Home].time = 1617105600000 with a delay of -950ms
+81ms ║RunTime Analysis CS > 21ms > PS > 3ms > PE > 57ms > CE
+84ms ║Runtime (47528 bytes) successfully initialized in 3ms (v0.3.113.20210203) (82ms)
+84ms ║╔Execution stage started
+102ms ║║Cancelling statement #161’s schedules…
+106ms ║║Executed virtual command setVariable (2ms)
+109ms ║║Executed virtual command setVariable (1ms)
+114ms ║║Comparison (time) 50399163 happens_daily_at (time) 43200000 = false (0ms)
+116ms ║║Condition #177 evaluated false (4ms)
+120ms ║║Cancelling statement #177’s schedules…
+123ms ║║Requesting time schedule wake up at Wed, Mar 31 2021 @ 12:00:00 PM CEST
+125ms ║║Condition group #176 evaluated false (state did not change) (13ms)
+130ms ║║Comparison (time) 50399179 happens_daily_at (time) 39600000 = false (1ms)
+131ms ║║Condition #179 evaluated false (3ms)
+138ms ║║Cancelling statement #179’s schedules…
+141ms ║║Requesting time schedule wake up at Wed, Mar 31 2021 @ 11:00:00 AM CEST
+145ms ║║Comparison (time) 50399194 happens_daily_at (time) 50400000 = true (1ms)
+146ms ║║Time restriction check passed
+147ms ║║Cancelling condition #180’s schedules…
+148ms ║║Condition #180 evaluated true (5ms)
+149ms ║║Cancelling statement #180’s schedules…
+152ms ║║Requesting time schedule wake up at Wed, Mar 31 2021 @ 2:00:00 PM CEST
+155ms ║║Cancelling condition #178’s schedules…
+155ms ║║Condition group #178 evaluated true (state changed) (27ms)
+161ms ║║Comparison (string) Spring is (string) Spring = true (2ms)
+162ms ║║Condition #182 evaluated true (4ms)
+163ms ║║Condition group #181 evaluated true (state did not change) (6ms)
+166ms ║║Cancelling statement #184’s schedules…
+172ms ║║Executed virtual command [Pool Main Pump].setVariable (2ms)
+181ms ║║Executed virtual command [Pool Main Pump].executePiston (4ms)
+184ms ║║Executed virtual command [Pool Main Pump].setVariable (1ms)
+189ms ║║Comparison (time) 50399239 happens_daily_at (time) 37800000 = false (0ms)
+191ms ║║Condition #188 evaluated false (3ms)
+192ms ║║Cancelling statement #188’s schedules…
+194ms ║║Requesting time schedule wake up at Wed, Mar 31 2021 @ 10:30:00 AM CEST
+198ms ║║Comparison (time) 50399248 happens_daily_at (time) 45000000 = false (0ms)
+200ms ║║Cancelling condition #189’s schedules…
+200ms ║║Condition #189 evaluated false (4ms)
+202ms ║║Cancelling statement #189’s schedules…
+204ms ║║Requesting time schedule wake up at Wed, Mar 31 2021 @ 12:30:00 PM CEST
+208ms ║║Comparison (time) 50399257 happens_daily_at (time) 52200000 = false (0ms)
+209ms ║║Condition #190 evaluated false (3ms)
+211ms ║║Cancelling statement #190’s schedules…
+213ms ║║Requesting time schedule wake up at Tue, Mar 30 2021 @ 2:30:00 PM CEST
+216ms ║║Cancelling condition #187’s schedules…
+216ms ║║Condition group #187 evaluated false (state changed) (29ms)
+222ms ║║Comparison (boolean) true is (boolean) true = true (2ms)
+223ms ║║Cancelling condition #201’s schedules…
+224ms ║║Condition #201 evaluated true (5ms)
+225ms ║║Cancelling condition #200’s schedules…
+226ms ║║Condition group #200 evaluated true (state changed) (8ms)
+228ms ║║Cancelling statement #174’s schedules…
+232ms ║║Executed virtual command [Pool Main Pump].setVariable (1ms)
+235ms ║║Executed virtual command [Pool Main Pump].wait (1ms)
+236ms ║║Requesting a wake up for Tue, Mar 30 2021 @ 2:59:59 PM CEST (in 3600.0s)
+273ms ║╚Execution stage complete. (189ms)
+283ms ║Setting up scheduled job for Tue, Mar 30 2021 @ 2:30:00 PM CEST (in 1800s), with 6 more jobs pending
+291ms ╚Event processed successfully (291ms)

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


#2

You certainly need the TCP set to ‘Never Cancel’ but you should set that either on the action (on the with) or the task (the wait). You can set the TCP on the if but I’ve never seen any explanation of what it actually achieves when you do, and plenty of evidence it is not a good idea.

I don’t think enable parallelism is gaining you anything.


#3

Oh wow, that was quick, thank you. And such a small change…

I will certainly try that out and check that it works and let you know. Many thanks!

EDIT

Just tried to set TCP to ‘Never Cancel’ on each of the individual tasks, but can’t find that option for any of the tasks. I therefore set it on the whole “with” statement… Will wait for my 15:00hrs and see whether that works… If there is any way to set it also on the individual tasks, would appreciate if you let me know how.


#4

Thank you - your answer works (as usual :slight_smile: )

The pump stopped at 15:00hrs as expected after I set the “with…” statement to Never cancel tasks. I have not removed parallelism, as yet, but I will also remove that as I believe it serves no purpose in this particular case, since the time windows where the pool pump is expected to be on will of course never overlap.

IN any case - thanks, appreciate your help!