Garage light doesn't turn off


#1

1) Give a description of the problem
I have one piston that turns the garage light on if any door opens or there is motion. If the motion sensor is what turns the light on, it never turns off. If I hit the physical switch, turn the light on in the app, or any of the door sensors open, the light will turn off after X seconds like it should.

2) What is the expected behaviour?
Garage light turns off if no motion for X seconds

3) What is happening/not happening?
Light will only turn off if it was not the motion sensor that turned the light on in the first place.

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

5) Attach logs after turning logging level to Full
6/2/2020, 7:42:22 P M +506ms
+2ms â•”Received event [Garage Motion 1].motion = inactive with a delay of 92ms
+119ms â•‘RunTime Analysis CS > 22ms > PS > 46ms > PE > 50ms > CE
+121ms â•‘Runtime (37348 bytes) successfully initialized in 46ms (v0.3.110.20191009) (119ms)
+122ms â•‘â•”Execution stage started
+132ms â•‘â•‘Condition #2 evaluated false (6ms)
+133ms â•‘â•‘Condition group #1 evaluated false (state did not change) (7ms)
+134ms ║╚Execution stage complete. (12ms)
+135ms ╚Event processed successfully (135ms)
6/2/2020, 7:42:03 PM +995ms
+1ms â•”Received event [Garage Motion 1].motion = active with a delay of 82ms
+117ms â•‘RunTime Analysis CS > 24ms > PS > 46ms > PE > 47ms > CE
+119ms â•‘Runtime (37346 bytes) successfully initialized in 46ms (v0.3.110.20191009) (117ms)
+120ms â•‘â•”Execution stage started
+130ms â•‘â•‘Condition #2 evaluated false (6ms)
+131ms â•‘â•‘Condition group #1 evaluated false (state did not change) (8ms)
+132ms ║╚Execution stage complete. (13ms)
+133ms ╚Event processed successfully (134ms)
6/2/2020, 7:41:00 PM +164ms
+1ms â•”Received event [Garage Motion 1].motion = inactive with a delay of 87ms
+128ms â•‘RunTime Analysis CS > 21ms > PS > 60ms > PE > 48ms > CE
+130ms â•‘Runtime (37348 bytes) successfully initialized in 60ms (v0.3.110.20191009) (128ms)
+131ms â•‘â•”Execution stage started
+140ms â•‘â•‘Condition #2 evaluated false (5ms)
+141ms â•‘â•‘Condition group #1 evaluated false (state did not change) (7ms)
+143ms ║╚Execution stage complete. (11ms)
+144ms ╚Event processed successfully (143ms)
6/2/2020, 7:40:38 PM +207ms
+2ms â•”Received event [Garage Motion 1].motion = active with a delay of 88ms
+116ms â•‘RunTime Analysis CS > 19ms > PS > 48ms > PE > 49ms > CE
+118ms â•‘Runtime (37346 bytes) successfully initialized in 48ms (v0.3.110.20191009) (116ms)
+119ms â•‘â•”Execution stage started
+130ms â•‘â•‘Condition #2 evaluated false (7ms)
+131ms â•‘â•‘Condition group #1 evaluated false (state did not change) (8ms)
+133ms ║╚Execution stage complete. (14ms)
+134ms ╚Event processed successfully (134ms)
6/2/2020, 7:40:00 PM +591ms
+1ms â•”Received event [Garage Motion 1].motion = inactive with a delay of 52ms
+103ms â•‘RunTime Analysis CS > 23ms > PS > 29ms > PE > 52ms > CE
+105ms â•‘Runtime (37348 bytes) successfully initialized in 29ms (v0.3.110.20191009) (104ms)
+106ms â•‘â•”Execution stage started
+115ms â•‘â•‘Condition #2 evaluated false (5ms)
+116ms â•‘â•‘Condition group #1 evaluated false (state did not change) (6ms)
+118ms ║╚Execution stage complete. (12ms)
+119ms ╚Event processed successfully (119ms)
6/2/2020, 7:39:39 PM +405ms
+1ms â•”Received event [Garage Motion 1].motion = active with a delay of 59ms
+107ms â•‘RunTime Analysis CS > 17ms > PS > 48ms > PE > 41ms > CE
+109ms â•‘Runtime (37346 bytes) successfully initialized in 48ms (v0.3.110.20191009) (107ms)
+110ms â•‘â•”Execution stage started
+119ms â•‘â•‘Condition #2 evaluated false (6ms)
+120ms â•‘â•‘Condition group #1 evaluated false (state did not change) (7ms)
+121ms ║╚Execution stage complete. (11ms)
+122ms ╚Event processed successfully (122ms)
6/2/2020, 7:38:04 PM +759ms
+1ms â•”Received event [Garage Motion 1].motion = inactive with a delay of 85ms
+283ms â•‘RunTime Analysis CS > 24ms > PS > 212ms > PE > 48ms > CE
+285ms â•‘Runtime (37350 bytes) successfully initialized in 212ms (v0.3.110.20191009) (283ms)
+286ms â•‘â•”Execution stage started
+297ms â•‘â•‘Condition #2 evaluated false (6ms)
+298ms â•‘â•‘Condition group #1 evaluated false (state did not change) (7ms)
+299ms ║╚Execution stage complete. (13ms)
+300ms ╚Event processed successfully (300ms)
6/2/2020, 7:37:26 PM +317ms
+0ms â•”Received event [Garage Motion 1].motion = active with a delay of 51ms
+98ms â•‘RunTime Analysis CS > 19ms > PS > 38ms > PE > 42ms > CE
+101ms â•‘Runtime (37345 bytes) successfully initialized in 38ms (v0.3.110.20191009) (99ms)
+101ms â•‘â•”Execution stage started
+111ms â•‘â•‘Condition #2 evaluated false (5ms)
+112ms â•‘â•‘Condition group #1 evaluated false (state did not change) (6ms)
+113ms ║╚Execution stage complete. (12ms)
+114ms ╚Event processed successfully (114ms)
6/2/2020, 7:28:15 PM +520ms
+0ms â•”Received event [Garage Motion 1].motion = inactive with a delay of 59ms
+88ms â•‘RunTime Analysis CS > 18ms > PS > 28ms > PE > 43ms > CE
+90ms â•‘Runtime (37347 bytes) successfully initialized in 28ms (v0.3.110.20191009) (89ms)
+91ms â•‘â•”Execution stage started
+100ms â•‘â•‘Condition #2 evaluated false (5ms)
+101ms â•‘â•‘Condition group #1 evaluated false (state did not change) (7ms)
+103ms ║╚Execution stage complete. (12ms)
+104ms ╚Event processed successfully (104ms)
6/2/2020, 7:27:54 PM +428ms
+2ms â•”Received event [Garage Motion 1].motion = active with a delay of 94ms
+121ms â•‘RunTime Analysis CS > 26ms > PS > 47ms > PE > 48ms > CE
+123ms â•‘Runtime (37346 bytes) successfully initialized in 47ms (v0.3.110.20191009) (121ms)
+124ms â•‘â•”Execution stage started
+134ms â•‘â•‘Condition #2 evaluated false (6ms)
+135ms â•‘â•‘Condition group #1 evaluated false (state did not change) (7ms)
+137ms ║╚Execution stage complete. (13ms)
+138ms ╚Event processed successfully (138ms)
6/2/2020, 7:27:47 PM +682ms
+1ms â•”Received event [Garage Motion 1].motion = inactive with a delay of 162ms
+117ms â•‘RunTime Analysis CS > 31ms > PS > 39ms > PE > 47ms > CE
+119ms â•‘Runtime (37349 bytes) successfully initialized in 39ms (v0.3.110.20191009) (117ms)
+120ms â•‘â•”Execution stage started
+130ms â•‘â•‘Condition #2 evaluated false (5ms)
+131ms â•‘â•‘Condition group #1 evaluated false (state did not change) (7ms)
+133ms ║╚Execution stage complete. (13ms)
+134ms ╚Event processed successfully (134ms)
6/2/2020, 7:27:27 PM +68ms
+0ms â•”Received event [Garage Motion 1].motion = active with a delay of 63ms
+89ms â•‘RunTime Analysis CS > 19ms > PS > 30ms > PE > 41ms > CE
+91ms â•‘Runtime (37345 bytes) successfully initialized in 30ms (v0.3.110.20191009) (90ms)
+92ms â•‘â•”Execution stage started
+101ms â•‘â•‘Condition #2 evaluated false (5ms)
+102ms â•‘â•‘Condition group #1 evaluated false (state did not change) (6ms)
+104ms ║╚Execution stage complete. (12ms)
+105ms ╚Event processed successfully (105ms)
6/2/2020, 7:01:22 PM +514ms
+1ms â•”Received event [Garage Motion 1].motion = inactive with a delay of 56ms
+92ms â•‘RunTime Analysis CS > 16ms > PS > 27ms > PE > 48ms > CE
+94ms â•‘Runtime (37342 bytes) successfully initialized in 27ms (v0.3.110.20191009) (93ms)
+95ms â•‘â•”Execution stage started
+104ms ║║Cancelling condition #2’s schedules…
+105ms â•‘â•‘Condition #2 evaluated false (7ms)
+106ms ║║Cancelling condition #1’s schedules…
+107ms â•‘â•‘Condition group #1 evaluated false (state changed) (9ms)
+108ms ║╚Execution stage complete. (14ms)
+110ms ╚Event processed successfully (109ms)
6/2/2020, 7:00:49 PM +56ms
+1ms â•”Received event [Garage Light].switch = on with a delay of 56ms
+90ms â•‘RunTime Analysis CS > 17ms > PS > 29ms > PE > 44ms > CE
+93ms â•‘Runtime (37339 bytes) successfully initialized in 29ms (v0.3.110.20191009) (91ms)
+93ms â•‘â•”Execution stage started
+100ms â•‘â•‘Comparison (enum) on changes_to (string) on = true (1ms)
+102ms ║║Cancelling condition #2’s schedules…
+102ms â•‘â•‘Condition #2 evaluated true (5ms)
+103ms ║║Cancelling condition #1’s schedules…
+104ms â•‘â•‘Condition group #1 evaluated true (state changed) (7ms)
+113ms â•‘â•‘Comparison (enum) active stays (string) inactive = false (1ms)
+115ms â•‘â•‘Cancelling any timed trigger schedules for condition 4
+115ms ║║Cancelling statement #4’s schedules…
+116ms ║║Cancelling condition #4’s schedules…
+117ms â•‘â•‘Condition #4 evaluated false (11ms)
+118ms ║║Cancelling condition #3’s schedules…
+119ms â•‘â•‘Condition group #3 evaluated false (state changed) (13ms)
+121ms ║╚Execution stage complete. (28ms)
+122ms ╚Event processed successfully (122ms)
6/2/2020, 7:00:48 PM +508ms
+2ms â•”Received event [Garage Motion 1].motion = active with a delay of 74ms
+105ms â•‘RunTime Analysis CS > 18ms > PS > 40ms > PE > 47ms > CE
+107ms â•‘Runtime (37347 bytes) successfully initialized in 40ms (v0.3.110.20191009) (105ms)
+108ms â•‘â•”Execution stage started
+117ms â•‘â•‘Condition #2 evaluated false (5ms)
+118ms â•‘â•‘Condition group #1 evaluated false (state did not change) (6ms)
+120ms ║╚Execution stage complete. (12ms)
+121ms ╚Event processed successfully (121ms)
6/2/2020, 6:34:17 PM +639ms
+1ms â•”Received event [Garage Light].switch = off with a delay of 76ms
+105ms â•‘RunTime Analysis CS > 21ms > PS > 37ms > PE > 47ms > CE
+107ms â•‘Runtime (37335 bytes) successfully initialized in 37ms (v0.3.110.20191009) (104ms)
+107ms â•‘â•”Execution stage started
+114ms â•‘â•‘Comparison (enum) off changes_to (string) on = false (1ms)
+115ms ║║Cancelling condition #2’s schedules…
+116ms â•‘â•‘Condition #2 evaluated false (5ms)
+117ms ║║Cancelling condition #1’s schedules…
+118ms â•‘â•‘Condition group #1 evaluated false (state changed) (7ms)
+120ms ║╚Execution stage complete. (13ms)
+121ms ╚Event processed successfully (121ms)
6/2/2020, 6:34:17 PM +31ms
+1ms â•”Received event [Home].time = 1591140856994 with a delay of 37ms
+124ms â•‘RunTime Analysis CS > 24ms > PS > 48ms > PE > 51ms > CE
+126ms â•‘Runtime (37337 bytes) successfully initialized in 48ms (v0.3.110.20191009) (124ms)
+127ms â•‘â•”Execution stage started
+135ms ║║Cancelling condition #4’s schedules…
+136ms â•‘â•‘Condition #4 evaluated true (2ms)
+137ms ║║Cancelling condition #3’s schedules…
+138ms â•‘â•‘Condition group #3 evaluated true (state changed) (4ms)
+140ms ║║Cancelling statement #5’s schedules…
+186ms â•‘â•‘Executed physical command [Garage Light].off() (41ms)
+188ms â•‘â•‘Executed [Garage Light].off (43ms)
+192ms ║╚Execution stage complete. (65ms)
+194ms ╚Event processed successfully (193ms)


#2

Both of your IFs are triggers (precise moments in time), so they can not normally both be true at the same millisecond. (notice the lightning bolts in the left margin)

Here is how I would code it:

execute
    IF Sensor's motion stays inactive for 2 minutes
    Then
        Turn off Switch 6
    END IF
end execute

This solves every scenario except one:
If you manually turn on the light, and somehow avoid the motion sensor, the light will remain on (until shortly after someone walks past it).

If you want to program for this event, then a separate block should be added for that.


#3

I’ve recently been working on the same thing, here is what I’ve got so far.

Basically it will come on with motion if its off, and turn off again after 15 minutes- but if its on manually then I want it to stay on indefinitely.

So if I’m working in the garage and want the light to stay on I can just toggle it off and back on and it will stick on.