See attached green Piston for randomizing lights when we are on Vacation or Away from the house:
-
When I arrive home and change Mode from Vacation to Home, the lights keep going on and off. Should this Piston cancel pending jobs when we come home and I set Mode = Home? If yes, what code do I use to determine the Mode has changed to Home and how do I cancel pending jobs?
-
You will see multiple IF/THENs to randomize seven lights. The first of the seven lights (IF #21) seems to get executed more than the others. With the logic shown, will all seven IFs be executed about the same number of times (depends on how “random” evaluates, of course). Do ALL the IFs (21, 24, 29, 36, 41, 59, 67) get evaluated on every pass through async IF / THEN and each get a unique value of Random? If more than one of the IFs evaluate to true, do multiple jobs get scheduled? Or, if IF #21 evaluates to TRUE, do the succeeding IFs not get evaluated?
2/29/2020, 10:32:30 PM +114ms
+1ms ╔Received event [Hayden Lake].time = 1583044350496 with a delay of -382ms
+161ms ║RunTime Analysis CS > 53ms > PS > 57ms > PE > 51ms > CE
+164ms ║Runtime (53148 bytes) successfully initialized in 57ms (v0.3.110.20191009) (162ms)
+165ms ║╔Execution stage started
+184ms ║║Comparison (time) 81150291 is_before (time) 80400000 = false (6ms)
+186ms ║║Cancelling condition #4's schedules...
+187ms ║║Condition #4 evaluated false (11ms)
+188ms ║║Cancelling condition #2's schedules...
+189ms ║║Condition group #2 evaluated false (state changed) (13ms)
+202ms ║║Comparison (time) 81150305 is_between (time) 85500000 .. (time) 3600000 = false (8ms)
+203ms ║║Condition #74 evaluated false (12ms)
+204ms ║║Condition group #72 evaluated false (state did not change) (13ms)
+207ms ║║Cancelling statement #97's schedules...
+211ms ║╚Execution stage complete. (46ms)
+212ms ║Setting up scheduled job for Sat, Feb 29 2020 @ 11:02:30 PM PST (in 1800.17s)
+219ms ╚Event processed successfully (218ms)
2/29/2020, 10:26:42 PM +105ms
+1ms ╔Received event [Hayden Lake].time = 1583044002800 with a delay of -695ms
+133ms ║RunTime Analysis CS > 25ms > PS > 46ms > PE > 61ms > CE
+136ms ║Runtime (53150 bytes) successfully initialized in 46ms (v0.3.110.20191009) (134ms)
+137ms ║╔Execution stage started
+189ms ║║Executed physical command [LR table lamp - recliner].off() (13ms)
+191ms ║║Executed virtual command [LR table lamp - recliner].toggle (17ms)
+206ms ║║Calculating (decimal) 0.21207601199029613 > (decimal) 0.6 >> (boolean) false
+212ms ║║Comparison (boolean) false is (boolean) true = false (2ms)
+215ms ║║Condition #42 evaluated false (19ms)
+217ms ║║Condition group #41 evaluated false (state did not change) (21ms)
+230ms ║║Calculating (decimal) 0.16253374156811573 > (decimal) 0.6 >> (boolean) false
+237ms ║║Comparison (boolean) false is (boolean) true = false (3ms)
+239ms ║║Condition #60 evaluated false (18ms)
+241ms ║║Condition group #59 evaluated false (state did not change) (20ms)
+254ms ║║Calculating (decimal) 0.9434372551526559 > (decimal) 0.6 >> (boolean) true
+261ms ║║Comparison (boolean) true is (boolean) true = true (2ms)
+263ms ║║Cancelling condition #68's schedules...
+265ms ║║Condition #68 evaluated true (19ms)
+266ms ║║Cancelling condition #67's schedules...
+267ms ║║Condition group #67 evaluated true (state changed) (23ms)
+270ms ║║Cancelling statement #69's schedules...
+281ms ║║Executed virtual command [BR 4 bed lamp Teri].waitRandom (1ms)
+282ms ║║Requesting a wake up for Sat, Feb 29 2020 @ 10:48:59 PM PST (in 1336.868s)
+309ms ║╚Execution stage complete. (171ms)
+312ms ║Setting up scheduled job for Sat, Feb 29 2020 @ 10:32:30 PM PST (in 348.08s), with 2 more jobs pending
+320ms ╚Event processed successfully (320ms)
2/29/2020, 10:20:39 PM +143ms
+0ms ╔Received event [Hayden Lake].time = 1583043640799 with a delay of -1657ms
+182ms ║RunTime Analysis CS > 65ms > PS > 63ms > PE > 54ms > CE
+185ms ║Runtime (53154 bytes) successfully initialized in 63ms (v0.3.110.20191009) (184ms)
+186ms ║╔Execution stage started
+223ms ║║Executed physical command [LR table lamp - chairs].off() (15ms)
+224ms ║║Executed virtual command [LR table lamp - chairs].toggle (20ms)
+234ms ║║Calculating (decimal) 0.8112793423744061 > (decimal) 0.6 >> (boolean) true
+240ms ║║Comparison (boolean) true is (boolean) true = true (2ms)
+242ms ║║Cancelling condition #28's schedules...
+243ms ║║Condition #28 evaluated true (16ms)
+245ms ║║Cancelling condition #24's schedules...
+246ms ║║Condition group #24 evaluated true (state changed) (18ms)
+249ms ║║Cancelling statement #25's schedules...
+259ms ║║Executed virtual command [LR table lamp - front door].waitRandom (1ms)
+260ms ║║Requesting a wake up for Sat, Feb 29 2020 @ 10:47:34 PM PST (in 1614.666s)
+288ms ║╚Execution stage complete. (102ms)
+290ms ║Setting up scheduled job for Sat, Feb 29 2020 @ 10:26:42 PM PST (in 363.367s), with 2 more jobs pending
+300ms ╚Event processed successfully (300ms)
2/29/2020, 10:02:30 PM +189ms
+0ms ╔Received event [Hayden Lake].time = 1583042550496 with a delay of -308ms
+458ms ║RunTime Analysis CS > 209ms > PS > 203ms > PE > 46ms > CE
+460ms ║Runtime (53156 bytes) successfully initialized in 203ms (v0.3.110.20191009) (459ms)
+461ms ║╔Execution stage started
+477ms ║║Comparison (time) 79350659 is_before (time) 80400000 = true (5ms)
+478ms ║║Time restriction check passed
+479ms ║║Condition #4 evaluated true (9ms)
+673ms ║║Comparison (time) 79350669 is_after (time) 1583026320000 = true (6ms)
+674ms ║║Time restriction check passed
+676ms ║║Condition #93 evaluated true (195ms)
+676ms ║║Condition group #91 evaluated true (state did not change) (196ms)
+677ms ║║Condition group #2 evaluated true (state did not change) (207ms)
+685ms ║║Calculating (decimal) 0.8075488683549018 > (decimal) 0.6 >> (boolean) true
+688ms ║║Comparison (boolean) true is (boolean) true = true (1ms)
+689ms ║║Condition #23 evaluated true (10ms)
+690ms ║║Condition group #21 evaluated true (state did not change) (11ms)
+692ms ║║Cancelling statement #3's schedules...
+700ms ║║Executed virtual command [LR table lamp - chairs].waitRandom (1ms)
+701ms ║║Requesting a wake up for Sat, Feb 29 2020 @ 10:20:40 PM PST (in 1089.908s)
+706ms ║║Cancelling statement #97's schedules...
+709ms ║╚Execution stage complete. (248ms)
+710ms ║Setting up scheduled job for Sat, Feb 29 2020 @ 10:20:40 PM PST (in 1089.9s), with 2 more jobs pending
+720ms ╚Event processed successfully (719ms)
2/29/2020, 9:59:20 PM +73ms
+1ms ╔Received event [Hayden Lake].time = 1583042360704 with a delay of -632ms
+101ms ║RunTime Analysis CS > 32ms > PS > 24ms > PE > 45ms > CE
+104ms ║Runtime (53147 bytes) successfully initialized in 24ms (v0.3.110.20191009) (102ms)
+105ms ║╔Execution stage started
+133ms ║║Executed physical command [LR table lamp - chairs].off() (9ms)
+134ms ║║Executed virtual command [LR table lamp - chairs].toggle (13ms)
+142ms ║║Calculating (decimal) 0.3301408435373101 > (decimal) 0.6 >> (boolean) false
+146ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+148ms ║║Cancelling condition #28's schedules...
+149ms ║║Condition #28 evaluated false (12ms)
+150ms ║║Cancelling condition #24's schedules...
+150ms ║║Condition group #24 evaluated false (state changed) (14ms)
+158ms ║║Calculating (decimal) 0.3168594015369691 > (decimal) 0.6 >> (boolean) false
+162ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+164ms ║║Cancelling condition #32's schedules...
+165ms ║║Condition #32 evaluated false (11ms)
+166ms ║║Cancelling condition #29's schedules...
+167ms ║║Condition group #29 evaluated false (state changed) (13ms)
+175ms ║║Calculating (decimal) 0.8082029132705655 > (decimal) 0.6 >> (boolean) true
+179ms ║║Comparison (boolean) true is (boolean) true = true (1ms)
+180ms ║║Condition #37 evaluated true (11ms)
+181ms ║║Condition group #36 evaluated true (state did not change) (12ms)
+183ms ║║Cancelling statement #38's schedules...
+191ms ║║Executed virtual command [LR table lamp - recliner].waitRandom (1ms)
+192ms ║║Requesting a wake up for Sat, Feb 29 2020 @ 10:26:42 PM PST (in 1642.534s)
+213ms ║╚Execution stage complete. (108ms)
+215ms ║Setting up scheduled job for Sat, Feb 29 2020 @ 10:02:30 PM PST (in 190.209s), with 1 more job pending
+225ms ╚Event processed successfully (225ms)
2/29/2020, 9:38:43 PM +56ms
+1ms ╔Received event [Hayden Lake].time = 1583041123565 with a delay of -509ms
+89ms ║RunTime Analysis CS > 16ms > PS > 24ms > PE > 49ms > CE
+92ms ║Runtime (53149 bytes) successfully initialized in 24ms (v0.3.110.20191009) (90ms)
+93ms ║╔Execution stage started
+126ms ║║Executed physical command [LR table lamp - front door].off() (7ms)
+127ms ║║Executed virtual command [LR table lamp - front door].toggle (11ms)
+137ms ║║Calculating (decimal) 0.6015662111694186 > (decimal) 0.6 >> (boolean) true
+141ms ║║Comparison (boolean) true is (boolean) true = true (2ms)
+143ms ║║Cancelling condition #32's schedules...
+143ms ║║Condition #32 evaluated true (12ms)
+145ms ║║Cancelling condition #29's schedules...
+145ms ║║Condition group #29 evaluated true (state changed) (15ms)
+148ms ║║Cancelling statement #30's schedules...
+156ms ║║Executed virtual command [LR table lamps - stairs].waitRandom (1ms)
+157ms ║║Requesting a wake up for Sat, Feb 29 2020 @ 10:05:30 PM PST (in 1606.907s)
+164ms ║╚Execution stage complete. (71ms)
+166ms ║Setting up scheduled job for Sat, Feb 29 2020 @ 9:59:20 PM PST (in 1237.483s), with 2 more jobs pending
+173ms ╚Event processed successfully (173ms)
2/29/2020, 9:32:30 PM +235ms
+1ms ╔Received event [Hayden Lake].time = 1583040750496 with a delay of -261ms
+139ms ║RunTime Analysis CS > 35ms > PS > 47ms > PE > 57ms > CE
+143ms ║Runtime (53150 bytes) successfully initialized in 47ms (v0.3.110.20191009) (138ms)
+144ms ║╔Execution stage started
+166ms ║║Comparison (time) 77550392 is_before (time) 80400000 = true (7ms)
+167ms ║║Time restriction check passed
+169ms ║║Condition #4 evaluated true (13ms)
+236ms ║║Comparison (time) 77550407 is_after (time) 1583026320000 = true (11ms)
+238ms ║║Time restriction check passed
+241ms ║║Condition #93 evaluated true (70ms)
+243ms ║║Condition group #91 evaluated true (state did not change) (72ms)
+245ms ║║Condition group #2 evaluated true (state did not change) (88ms)
+258ms ║║Calculating (decimal) 0.7098979535644087 > (decimal) 0.6 >> (boolean) true
+264ms ║║Comparison (boolean) true is (boolean) true = true (2ms)
+267ms ║║Condition #23 evaluated true (19ms)
+269ms ║║Condition group #21 evaluated true (state did not change) (22ms)
+273ms ║║Cancelling statement #3's schedules...
+287ms ║║Executed virtual command [LR table lamp - chairs].waitRandom (1ms)
+289ms ║║Requesting a wake up for Sat, Feb 29 2020 @ 9:59:20 PM PST (in 1610.179s)
+298ms ║║Cancelling statement #97's schedules...
+304ms ║╚Execution stage complete. (160ms)
+307ms ║Setting up scheduled job for Sat, Feb 29 2020 @ 9:38:43 PM PST (in 373.024s), with 2 more jobs pending
+316ms ╚Event processed successfully (316ms)
2/29/2020, 9:27:07 PM +207ms
+0ms ╔Received event [Hayden Lake].time = 1583040427690 with a delay of -484ms
+123ms ║RunTime Analysis CS > 35ms > PS > 35ms > PE > 54ms > CE
+126ms ║Runtime (53153 bytes) successfully initialized in 35ms (v0.3.110.20191009) (125ms)
+127ms ║╔Execution stage started
+179ms ║║Executed physical command [LR table lamp - chairs].off() (20ms)
+180ms ║║Executed virtual command [LR table lamp - chairs].toggle (25ms)
+189ms ║║Calculating (decimal) 0.6673984712390288 > (decimal) 0.6 >> (boolean) true
+193ms ║║Comparison (boolean) true is (boolean) true = true (2ms)
+195ms ║║Cancelling condition #28's schedules...
+196ms ║║Condition #28 evaluated true (12ms)
+197ms ║║Cancelling condition #24's schedules...
+198ms ║║Condition group #24 evaluated true (state changed) (14ms)
+200ms ║║Cancelling statement #25's schedules...
+208ms ║║Executed virtual command [LR table lamp - front door].waitRandom (0ms)
+209ms ║║Requesting a wake up for Sat, Feb 29 2020 @ 9:38:43 PM PST (in 696.148s)
+234ms ║╚Execution stage complete. (107ms)
+236ms ║Setting up scheduled job for Sat, Feb 29 2020 @ 9:32:30 PM PST (in 323.054s), with 1 more job pending
+243ms ╚Event processed successfully (243ms)
2/29/2020, 9:02:43 PM +461ms
+0ms ╔Received event [Hayden Lake].time = 1583038950496 with a delay of 12964ms
+650ms ║RunTime Analysis CS > 319ms > PS > 272ms > PE > 59ms > CE
+653ms ║Runtime (53160 bytes) successfully initialized in 272ms (v0.3.110.20191009) (652ms)
+654ms ║╔Execution stage started
+673ms ║║Comparison (time) 75764126 is_before (time) 80400000 = true (5ms)
+674ms ║║Time restriction check passed
+676ms ║║Condition #4 evaluated true (10ms)
+949ms ║║Comparison (time) 75764139 is_after (time) 1583026320000 = true (7ms)
+951ms ║║Time restriction check passed
+953ms ║║Condition #93 evaluated true (275ms)
+954ms ║║Condition group #91 evaluated true (state did not change) (277ms)
+955ms ║║Condition group #2 evaluated true (state did not change) (290ms)
+965ms ║║Calculating (decimal) 0.891487504203996 > (decimal) 0.6 >> (boolean) true
+969ms ║║Comparison (boolean) true is (boolean) true = true (1ms)
+970ms ║║Cancelling condition #23's schedules...
+971ms ║║Condition #23 evaluated true (13ms)
+972ms ║║Cancelling condition #21's schedules...
+973ms ║║Condition group #21 evaluated true (state changed) (16ms)
+976ms ║║Cancelling statement #3's schedules...
+984ms ║║Executed virtual command [LR table lamp - chairs].waitRandom (0ms)
+991ms ║║Requesting a wake up for Sat, Feb 29 2020 @ 9:27:07 PM PST (in 1463.237s)
+996ms ║║Cancelling statement #97's schedules...
+999ms ║╚Execution stage complete. (345ms)
+1001ms ║Setting up scheduled job for Sat, Feb 29 2020 @ 9:27:07 PM PST (in 1463.229s), with 1 more job pending
+1007ms ╚Event processed successfully (1007ms)
2/29/2020, 8:48:08 PM +101ms
+0ms ╔Received event [Hayden Lake].time = 1583038089251 with a delay of -1151ms
+133ms ║RunTime Analysis CS > 41ms > PS > 45ms > PE > 47ms > CE
+137ms ║Runtime (53157 bytes) successfully initialized in 45ms (v0.3.110.20191009) (135ms)
+138ms ║╔Execution stage started
+183ms ║║Executed physical command [LR table lamp - recliner].on() (13ms)
+184ms ║║Executed virtual command [LR table lamp - recliner].toggle (17ms)
+193ms ║║Calculating (decimal) 0.40657306996344966 > (decimal) 0.6 >> (boolean) false
+196ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+198ms ║║Condition #42 evaluated false (11ms)
+199ms ║║Condition group #41 evaluated false (state did not change) (11ms)
+207ms ║║Calculating (decimal) 0.49749139272904463 > (decimal) 0.6 >> (boolean) false
+210ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+212ms ║║Condition #60 evaluated false (11ms)
+213ms ║║Condition group #59 evaluated false (state did not change) (11ms)
+221ms ║║Calculating (decimal) 0.3327220508592985 > (decimal) 0.6 >> (boolean) false
+225ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+226ms ║║Condition #68 evaluated false (11ms)
+227ms ║║Condition group #67 evaluated false (state did not change) (12ms)
+230ms ║╚Execution stage complete. (92ms)
+232ms ║Setting up scheduled job for Sat, Feb 29 2020 @ 9:02:30 PM PST (in 862.164s)
+240ms ╚Event processed successfully (240ms)