Brighten the porch when someone is near the door, then set back to special color. Halp?


#1

1) Give a description of the problem
I cobbled together a repeat do until statement that isn’t working consistently. #62-#67 is where I’m having problems. It doesn’t consistently set the color.

2) What is the expected behaviour?
Keep waiting 3 more minutes until motion sensor 8 is not active, then run statement #66 to set the bulb color

3) What is happening/not happening?
#66 doesn’t run

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full

12/6/2021, 6:00:12 PM +813ms
+0ms ╔Received event [Home].time = 1638835211612 with a delay of 1201ms
+132ms ║RunTime Analysis CS > 57ms > PS > 7ms > PE > 68ms > CE
+135ms ║Runtime (46101 bytes) successfully initialized in 7ms (v0.3.110.20191009) (134ms)
+136ms ║╔Execution stage started
+137ms ║╚Execution stage complete. (1ms)
+138ms ╚Event processed successfully (138ms)
12/6/2021, 5:57:41 PM +593ms
+1ms ╔Received event [Front Door].motion = inactive with a delay of 93ms
+99ms ║RunTime Analysis CS > 18ms > PS > 7ms > PE > 74ms > CE
+101ms ║Runtime (46094 bytes) successfully initialized in 7ms (v0.3.110.20191009) (99ms)
+102ms ║╔Execution stage started
+111ms ║║Comparison (boolean) false is (boolean) false = true (1ms)
+113ms ║║Condition #49 evaluated true (5ms)
+122ms ║║Comparison (enum) on is (string) on = true (1ms)
+123ms ║║Condition #80 evaluated true (10ms)
+127ms ║║Comparison (enum) inactive changes_to (string) active = false (1ms)
+129ms ║║Cancelling condition #2's schedules...
+129ms ║║Condition #2 evaluated false (5ms)
+130ms ║║Cancelling condition #1's schedules...
+131ms ║║Condition group #1 evaluated false (state changed) (25ms)
+138ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+140ms ║║Condition #71 evaluated false (6ms)
+141ms ║║Condition group #68 evaluated false (state did not change) (8ms)
+143ms ║╚Execution stage complete. (41ms)
+144ms ╚Event processed successfully (144ms)
12/6/2021, 5:57:11 PM +436ms
+1ms ╔Received event [Front Door].motion = active with a delay of 88ms
+94ms ║RunTime Analysis CS > 21ms > PS > 7ms > PE > 65ms > CE
+96ms ║Runtime (46099 bytes) successfully initialized in 7ms (v0.3.110.20191009) (94ms)
+97ms ║╔Execution stage started
+107ms ║║Comparison (boolean) false is (boolean) false = true (2ms)
+108ms ║║Condition #49 evaluated true (6ms)
+118ms ║║Comparison (enum) on is (string) on = true (1ms)
+120ms ║║Condition #80 evaluated true (11ms)
+124ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+125ms ║║Cancelling condition #2's schedules...
+126ms ║║Condition #2 evaluated true (5ms)
+134ms ║║Comparison (enum) off is (string) off = true (1ms)
+136ms ║║Condition #48 evaluated true (8ms)
+137ms ║║Cancelling condition #1's schedules...
+138ms ║║Condition group #1 evaluated true (state changed) (36ms)
+140ms ║║Cancelling statement #26's schedules...
+152ms ║║Executed physical command [Front Porch sengled].setColorTemperature([2700]) (7ms)
+153ms ║║Executed [Front Porch sengled].setColorTemperature (8ms)
+165ms ║║Skipped execution of physical command [Front Porch sengled].setLevel([100]) because it would make no change to the device. (9ms)
+166ms ║║Executed [Front Porch sengled].setLevel (11ms)
+170ms ║║Cancelling statement #64's schedules...
+173ms ║║Executed virtual command wait (0ms)
+175ms ║║Requesting a wake up for Mon, Dec 6 2021 @ 6:00:11 PM CST (in 180.0s)
+180ms ║╚Execution stage complete. (82ms)
+181ms ║Setting up scheduled job for Mon, Dec 6 2021 @ 6:00:11 PM CST (in 179.996s)
+189ms ╚Event processed successfully (189ms)
12/6/2021, 5:44:08 PM +442ms
+0ms ╔Starting piston... (v0.3.110.20191009)
+365ms ║╔Subscribing to devices...
+428ms ║║Subscribing to Front Door.motion...
+588ms ║║Subscribing to Front Porch sengled...
+589ms ║╚Finished subscribing (243ms)
+621ms ║Comparison (boolean) false is (boolean) false = true (2ms)
+632ms ║Comparison (enum) on is (string) on = true (2ms)
+659ms ║Comparison (enum) off is (string) off = true (2ms)
+687ms ║Comparison (enum) inactive is_not (string) active = true (2ms)
+700ms ║Comparison (boolean) false is (boolean) true = false (1ms)
+710ms ║Comparison (enum) on is (string) on = true (1ms)
+711ms ║Cancelling condition #81's schedules...
+733ms ║Comparison (enum) off is (string) off = true (2ms)
+759ms ║Comparison (enum) inactive is_not (string) active = true (2ms)
+772ms ╚Piston successfully started (772ms)
12/6/2021, 5:43:10 PM +728ms
+1ms ╔Received event [Home].test = 1638834190728 with a delay of 0ms
+92ms ║RunTime Analysis CS > 19ms > PS > 7ms > PE > 66ms > CE
+95ms ║Runtime (46097 bytes) successfully initialized in 7ms (v0.3.110.20191009) (93ms)
+97ms ║╔Execution stage started
+108ms ║║Comparison (boolean) false is (boolean) false = true (1ms)
+109ms ║║Condition #49 evaluated true (7ms)
+119ms ║║Comparison (enum) on is (string) on = true (1ms)
+121ms ║║Condition #80 evaluated true (11ms)
+140ms ║║Condition #2 evaluated false (18ms)
+141ms ║║Condition group #1 evaluated false (state did not change) (40ms)
+150ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+151ms ║║Condition #71 evaluated false (7ms)
+153ms ║║Condition group #68 evaluated false (state did not change) (8ms)
+157ms ║╚Execution stage complete. (61ms)
+158ms ╚Event processed successfully (158ms)

#2

All of your triggers (lightning bolts) point to “Sensor 8’s motion”. This is good, although it means whenever that device turns active OR inactive, the piston will start over at the top. (as seen at 5:57:41 PM)

This often affects currently running loops.


Normally this is accomplished in a piston that only subscribes to one device (like yours):

IF Sensor 8's motion stays inactive for 3 minutes
    Then Set Bulb 5's RGB to X Y Z
END IF

This snippet can be added anywhere (at top level), and works great if your default color is consistent. That same concept can be used to restore colorTemp… but keep in mind that restoring color and colorTemp are often contradictory. (only choose one) Same concept with RGB.

My personal preference (for most bulbs) is to capture and restore RGB (and sometimes level). I ignore color and colorTemp for everything except my reading lights, or perhaps circadian lights. If I go with colorTemp, then I will ignore RBG and color.


TL;DR

Choose one (and only one):
color or colorTemp, or RGB color.


#3

It’s worth noting that line 22 and 50 are identical… with only lines 18 & 46 different. I’d likely combine logic into one larger IF, with an indented IF inside, and a small IF at the bottom to restore. Maybe something like:

IF Sensor 8's motion changes to active         <-- Trigger
   and
   Switch 11 is on                             <-- Condition
   and
   Switch 6 is off                             <-- Condition
   Then
      IF @globalVariable is true               <-- Condition Indented
      Then 
         do Capture RGB (or colorTemp)
      Else 
         Set Bulb 5's to 2700K at 100% level
      END IF
END IF

IF Sensor 8's motion stays inactive for 3 min  <-- Trigger
    Then Set Bulb 5's RGB (or colorTemp) to X Y Z
END IF

Notice there’s no loops, no repeats, and no timers, other that the built-in STAY.


#4

Thanks for your help. I’m not too great at this stuff, but I’m stubbornly persistent.