Parallelism and Variables


#1

1) Give a description of the problem
I’ve got a HomeSeer WD-200 switch, and I’m using the 7 LEDs on the switch to notify me if my kids aren’t going to bed after bedtime. The theory is that when motion is detected, some of the LEDs turn on flashing for a minute, then solid for a few minutes, then shutdown after 5 minutes of no motion. Because I knew I’d be tweaking the pistons for a while to get them going the way I want, I set it up with a initiator piston that monitors the relevant motion sensors, then calls and passes the device name to a notification piston. Finally, a shutdown piston turns off the notification LEDs when activity quiets down.

2) What is the expected behaviour?
For the most part, things work as I desire. Kid gets out of bed, I get a flashing notifier, then a solid notifier, then it shuts off when things quiet back down. If the kid gets out of bed again before the LED shuts down, I’d like the routine to start over (flash a minute, then solid for 4 minutes, then off).

3) What is happening/not happening?
However, if one kid gets up, then during the flashing light period (1 minute) the other kid gets up, the first kid’s notifier lights never progress from flashing to solid. They simply flash the whole time until the shutdown piston turns them off when things have quieted down.

I can see in the logs that the first firing sets a scheduled wake-up for a minute later, then when the second piston fires, it schedules again for another minute later. I thought parallelism would prevent the second instance from killing the schedules and actions of the first instance. But I clearly don’t understand something.

4) Post a Green Snapshot of the pistonimage


5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)
9/23/2019, 9:33:42 PM +88ms
+0ms ╔Received event [Home].time = 1569288823223 with a delay of -1136ms
+126ms ║RunTime Analysis CS > 26ms > PS > 40ms > PE > 60ms > CE
+128ms ║Runtime (42328 bytes) successfully initialized in 40ms (v0.3.10f.20190822) (127ms)
+129ms ║╔Execution stage started
+145ms ║║Evaluating switch with values [[i:19:null:0, v:[t:device, v:[:90e51437e569dfb320d1add3fc5b70ab:], vt:string]]]
+148ms ║║Comparison (dynamic) Eden’s Room Light is (string) Eden’s Room Light = true (1ms)
+167ms ║║Cancelling statement #16’s schedules…
+2402ms ║║Executed physical command [Master Bedroom Overhead Light].setStatusLed([5, 4, 0]) (2227ms)
+2403ms ║║Executed [Master Bedroom Overhead Light].setStatusLed (2229ms)
+2408ms ║║Cancelling statement #16’s schedules…
+2429ms ║║Executed physical command [Master Bedroom Overhead Light].setStatusLed([6, 4, 0]) (15ms)
+2430ms ║║Executed [Master Bedroom Overhead Light].setStatusLed (17ms)
+2435ms ║║Cancelling statement #16’s schedules…
+2456ms ║║Executed physical command [Master Bedroom Overhead Light].setStatusLed([7, 4, 0]) (14ms)
+2456ms ║║Executed [Master Bedroom Overhead Light].setStatusLed (16ms)
+2487ms ║╚Execution stage complete. (2357ms)
+2497ms ╚Event processed successfully (2497ms)
9/23/2019, 9:32:42 PM +806ms
+0ms ╔Received event [Home].execute = :697d233ca14672d3cde0dad5fda3c5f8: with a delay of 59ms
+97ms ║RunTime Analysis CS > 19ms > PS > 33ms > PE > 45ms > CE
+100ms ║Runtime (42348 bytes) successfully initialized in 33ms (v0.3.10f.20190822) (99ms)
+101ms ║╔Execution stage started
+105ms ║║Cancelling statement #30’s schedules…
+117ms ║║Calculating (integer) 36 - (integer) 2 >> (integer) 34
+122ms ║║Executed virtual command setVariable (3ms)
+127ms ║║Eden’s Room Light
+128ms ║║Executed virtual command log (1ms)
+131ms ║║Evaluating switch with values [[i:19:null:0, v:[t:device, v:[:90e51437e569dfb320d1add3fc5b70ab:], vt:string]]]
+135ms ║║Comparison (dynamic) Eden’s Room Light is (string) Eden’s Room Light = true (1ms)
+137ms ║║Cancelling statement #22’s schedules…
+142ms ║║Eden Match
+143ms ║║Executed virtual command log (1ms)
+148ms ║║Executed virtual command setVariable (2ms)
+154ms ║║Executed virtual command setVariable (2ms)
+158ms ║║Executed virtual command setVariable (2ms)
+165ms ║║Cancelling statement #7’s schedules…
+352ms ║║Executed physical command [Master Bedroom Overhead Light].setStatusLed([5, 4, 1]) (179ms)
+353ms ║║Executed [Master Bedroom Overhead Light].setStatusLed (181ms)
+358ms ║║Cancelling statement #7’s schedules…
+380ms ║║Executed physical command [Master Bedroom Overhead Light].setStatusLed([6, 4, 1]) (16ms)
+380ms ║║Executed [Master Bedroom Overhead Light].setStatusLed (18ms)
+385ms ║║Cancelling statement #7’s schedules…
+408ms ║║Executed physical command [Master Bedroom Overhead Light].setStatusLed([7, 4, 1]) (17ms)
+409ms ║║Executed [Master Bedroom Overhead Light].setStatusLed (19ms)
+412ms ║║Cancelling statement #13’s schedules…
+415ms ║║Executed virtual command wait (0ms)
+416ms ║║Requesting a wake up for Mon, Sep 23 2019 @ 9:33:43 PM EDT (in 60.0s)
+448ms ║╚Execution stage complete. (347ms)
+457ms ║Setting up scheduled job for Mon, Sep 23 2019 @ 9:33:43 PM EDT (in 59.96s)
+469ms ╚Event processed successfully (469ms)
9/23/2019, 9:32:05 PM +901ms
+1ms ╔Received event [Home].execute = :697d233ca14672d3cde0dad5fda3c5f8: with a delay of 59ms
+100ms ║RunTime Analysis CS > 19ms > PS > 32ms > PE > 49ms > CE
+103ms ║Runtime (42349 bytes) successfully initialized in 32ms (v0.3.10f.20190822) (101ms)
+104ms ║╔Execution stage started
+108ms ║║Cancelling statement #30’s schedules…
+120ms ║║Calculating (integer) 36 - (integer) 2 >> (integer) 34
+125ms ║║Executed virtual command setVariable (2ms)
+130ms ║║Jude’s Room Light
+131ms ║║Executed virtual command log (1ms)
+134ms ║║Evaluating switch with values [[i:19:null:0, v:[t:device, v:[:240d6922a5353e6d0372aac3babe12d6:], vt:string]]]
+137ms ║║Comparison (dynamic) Jude’s Room Light is (string) Eden’s Room Light = false (1ms)
+140ms ║║Comparison (dynamic) Jude’s Room Light is (string) Jude’s Room Light = true (1ms)
+142ms ║║Cancelling statement #24’s schedules…
+147ms ║║jude match
+148ms ║║Executed virtual command log (1ms)
+153ms ║║Executed virtual command setVariable (2ms)
+158ms ║║Executed virtual command setVariable (1ms)
+162ms ║║Executed virtual command setVariable (2ms)
+168ms ║║Cancelling statement #7’s schedules…
+216ms ║║Executed physical command [Master Bedroom Overhead Light].setStatusLed([1, 3, 1]) (41ms)
+217ms ║║Executed [Master Bedroom Overhead Light].setStatusLed (43ms)
+222ms ║║Cancelling statement #7’s schedules…
+241ms ║║Executed physical command [Master Bedroom Overhead Light].setStatusLed([2, 3, 1]) (13ms)
+242ms ║║Executed [Master Bedroom Overhead Light].setStatusLed (14ms)
+247ms ║║Cancelling statement #7’s schedules…
+264ms ║║Executed physical command [Master Bedroom Overhead Light].setStatusLed([3, 3, 1]) (12ms)
+265ms ║║Executed [Master Bedroom Overhead Light].setStatusLed (12ms)
+268ms ║║Cancelling statement #13’s schedules…
+270ms ║║Executed virtual command wait (0ms)
+272ms ║║Requesting a wake up for Mon, Sep 23 2019 @ 9:33:06 PM EDT (in 60.0s)
+306ms ║╚Execution stage complete. (203ms)
+316ms ║Setting up scheduled job for Mon, Sep 23 2019 @ 9:33:06 PM EDT (in 59.957s)
+327ms ╚Event processed successfully (327ms)

Thanks for reading.


#2

(Bump)