Restore after Motion Help


#1

1) Give a description of the problem
Stair 1 & 2 are not returning to their orginal state

2) What is the expected behaviour?
Stairs 1 & 2 to return to original state after 10 seconds of inactive from both motion sensors

3) What is happening/not happening?
The stair lights remain on

12/2/2020, 12:38:58 PM +57ms
+1ms ╔Received event [Home].time = 1606934339841 with a delay of -1784ms
+233ms ║RunTime Analysis CS > 16ms > PS > 191ms > PE > 25ms > CE
+235ms ║Runtime (45861 bytes) successfully initialized in 191ms (v0.3.110.20191009) (234ms)
+236ms ║╔Execution stage started
+259ms ║║Cancelling condition #30's schedules...
+260ms ║║Condition #30 evaluated true (1ms)
+261ms ║║Cancelling condition #29's schedules...
+261ms ║║Condition group #29 evaluated true (state changed) (3ms)
+263ms ║║Cancelling statement #31's schedules...
+279ms ║║Executed virtual command [Stairs 1].loadStateLocally (1ms)
+281ms ║║Executed virtual command [Stairs 2].loadStateLocally (1ms)
+284ms ║╚Execution stage complete. (47ms)
+285ms ╚Event processed successfully (285ms)


12/2/2020, 12:38:49 PM +682ms
+1ms ╔Received event [Hue Motion Sensor Upstairs].motion = inactive with a delay of 72ms
+102ms ║RunTime Analysis CS > 22ms > PS > 58ms > PE > 21ms > CE
+104ms ║Runtime (45869 bytes) successfully initialized in 58ms (v0.3.110.20191009) (102ms)
+105ms ║╔Execution stage started
+117ms ║║Comparison (enum) inactive changes_to (string) active = false (0ms)
+118ms ║║Cancelling condition #2's schedules...
+119ms ║║Condition #2 evaluated false (10ms)
+120ms ║║Cancelling condition #1's schedules...
+121ms ║║Condition group #1 evaluated false (state changed) (12ms)
+130ms ║║Comparison (enum) inactive changes_to (string) active = false (1ms)
+131ms ║║Cancelling condition #12's schedules...
+132ms ║║Condition #12 evaluated false (9ms)
+133ms ║║Condition group #11 evaluated false (state did not change) (10ms)
+142ms ║║Comparison (enum) inactive changes_to (string) active = false (0ms)
+143ms ║║Cancelling condition #22's schedules...
+144ms ║║Condition #22 evaluated false (9ms)
+145ms ║║Condition group #21 evaluated false (state did not change) (10ms)
+155ms ║║Comparison (enum) inactive stays (string) inactive = true (2ms)
+157ms ║║Comparison (enum) inactive stays (string) inactive = true (1ms)
+159ms ║║Adding a timed trigger schedule for condition 30
+161ms ║║Condition #30 evaluated false (14ms)
+162ms ║║Condition group #29 evaluated false (state did not change) (15ms)
+164ms ║╚Execution stage complete. (59ms)
+165ms ║Setting up scheduled job for Wed, Dec 2 2020 @ 12:38:59 PM CST (in 9.994s)
+174ms ╚Event processed successfully (174ms)


12/2/2020, 12:38:39 PM +901ms
+2ms ╔Received event [Hue Motion Sensor Upstairs].motion = active with a delay of 72ms
+101ms ║RunTime Analysis CS > 18ms > PS > 60ms > PE > 23ms > CE
+104ms ║Runtime (45866 bytes) successfully initialized in 60ms (v0.3.110.20191009) (102ms)
+106ms ║╔Execution stage started
+119ms ║║Comparison (enum) active changes_to (string) active = true (0ms)
+121ms ║║Cancelling condition #2's schedules...
+122ms ║║Condition #2 evaluated true (11ms)
+153ms ║║Comparison (time) 45520024 is_between (time) 1606912920000 .. (time) 1606948380000 = true (9ms)
+155ms ║║Time restriction check passed
+156ms ║║Condition #3 evaluated true (34ms)
+161ms ║║Comparison (string) :6621ba72b7bb391bf4347524875c94c3: is_not (string) :1536fd0f83572e449ccc2436cfbd6363: = true (2ms)
+163ms ║║Condition #4 evaluated true (5ms)
+172ms ║║Comparison (enum) off is (string) off = true (1ms)
+174ms ║║Condition #5 evaluated true (10ms)
+175ms ║║Cancelling condition #1's schedules...
+176ms ║║Condition group #1 evaluated true (state changed) (66ms)
+178ms ║║Cancelling statement #6's schedules...
+196ms ║║Executed virtual command [Stairs 1].saveStateLocally (13ms)
+212ms ║║Executed virtual command [Stairs 2].saveStateLocally (14ms)
+221ms ║║Executed physical command [Stairs 1].setColorTemperature([2700]) (6ms)
+222ms ║║Executed [Stairs 1].setColorTemperature (8ms)
+229ms ║║Executed physical command [Stairs 2].setColorTemperature([2700]) (6ms)
+230ms ║║Executed [Stairs 2].setColorTemperature (7ms)
+241ms ║║Executed physical command [Stairs 1].setLevel([100]) (8ms)
+242ms ║║Executed [Stairs 1].setLevel (9ms)
+256ms ║║Executed physical command [Stairs 2].setLevel([100]) (12ms)
+257ms ║║Executed [Stairs 2].setLevel (14ms)
+264ms ║║Skipped execution of physical command [Stairs 1].on([]) because it would make no change to the device. (4ms)
+264ms ║║Executed [Stairs 1].on (6ms)
+274ms ║║Executed physical command [Stairs 2].on() (8ms)
+275ms ║║Executed [Stairs 2].on (10ms)
+285ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+287ms ║║Cancelling condition #12's schedules...
+288ms ║║Condition #12 evaluated true (10ms)
+300ms ║║Comparison (time) 45520190 is_between (time) 1606948380000 .. (time) 1606912920000 = false (9ms)
+302ms ║║Condition #13 evaluated false (14ms)
+303ms ║║Condition group #11 evaluated false (state did not change) (25ms)
+313ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+315ms ║║Cancelling condition #22's schedules...
+316ms ║║Condition #22 evaluated true (11ms)
+320ms ║║Comparison (string) :6621ba72b7bb391bf4347524875c94c3: is (string) :1536fd0f83572e449ccc2436cfbd6363: = false (1ms)
+321ms ║║Condition #23 evaluated false (4ms)
+322ms ║║Condition group #21 evaluated false (state did not change) (17ms)
+333ms ║║Comparison (enum) inactive stays (string) inactive = true (2ms)
+335ms ║║Comparison (enum) active stays (string) inactive = false (1ms)
+337ms ║║Cancelling any timed trigger schedules for condition 30
+338ms ║║Cancelling statement #30's schedules...
+339ms ║║Cancelling condition #30's schedules...
+340ms ║║Condition #30 evaluated false (15ms)
+341ms ║║Cancelling condition #29's schedules...
+342ms ║║Condition group #29 evaluated false (state changed) (18ms)
+344ms ║╚Execution stage complete. (239ms)
+345ms ╚Event processed successfully (345ms)

#2

I have never been impressed with “capture/restore attributes”…
I tend to store that data into variables, and restore from there. IE:

define
    integer bulb8Level = (no value set)
    integer bulb9Level = (no value set)
    integer bulb8ColTemp = (no value set)
    integer bulb9ColTemp = (no value set)
    string bulb8Switch = (no value set)
    string bulb9Switch = (no value set)
end define

Also note that your first three IF blocks can be combined into one.
(using nested IFs)


#3

I’m struggling learning how to work with variables to capture/restore attributes.


#4

I don’t usually do custom work off the clock, but I took a gamble with your request.
(time invested = about an hour)

Here is your entire piston re-created from scratch, using all of your parameters.

You should be able to import it, and point to the two motion sensors and two bulbs.
(I added comments (in green) and a few logs to help you to see what is going on here)


Note:

I usually recommend new users AVOID using ELSE blocks, but in this strict format, it should work well.
(Although adding more logic or triggers can easily break them)


Edited piston to add another variable.
Now, commands will not be sent while the room remains occupied.
(only when first entering, and 10 min after vacating)


Edit 2:

Line 18 {bulbB} should point to your “White Bulb 9” so the condition check (on line 57) matches up.


#5

You are amazing! Thank you sooo much. I’ve watched so many videos and tutorials on how to use variables and this helps the most.