Open front door, light turns on


#1

1) Give a description of the problem
I would like the front door multipurpose to trigger a light on when it opens. I have set the piston so that the motion sensor adjacent to the interior of the front door must be inactive so that this occurs only when returning home and not turn on a light when the front door is opened to leave.

2) What is the expected behaviour?
Return home and open front door and turn on the light dimmer controlling the light.

3) What is happening/not happening?
Light is not turning on.

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full
10/29/2020, 1:04:30 PM +489ms
+1ms ╔Received event [MP Front Door].contact = closed with a delay of 88ms
+65ms ║RunTime Analysis CS > 23ms > PS > 6ms > PE > 35ms > CE
+67ms ║Runtime (37622 bytes) successfully initialized in 6ms (v0.3.110.20191009) (65ms)
+68ms ║╔Execution stage started
+508ms ║║Comparison (enum) active was (string) inactive = false (429ms)
+509ms ║║Cancelling condition #3’s schedules…
+510ms ║║Condition #3 evaluated false (438ms)
+511ms ║║Condition group #1 evaluated false (state did not change) (440ms)
+513ms ║╚Execution stage complete. (446ms)
+514ms ╚Event processed successfully (514ms)
10/29/2020, 1:04:23 PM +106ms
+2ms ╔Received event [MP Front Door].contact = open with a delay of 93ms
+67ms ║RunTime Analysis CS > 25ms > PS > 5ms > PE > 37ms > CE
+70ms ║Runtime (37618 bytes) successfully initialized in 5ms (v0.3.110.20191009) (67ms)
+70ms ║╔Execution stage started
+422ms ║║Duration 2933526ms for is >= 180000ms threshold = true
+423ms ║║Comparison (enum) inactive was (string) inactive = true (341ms)
+425ms ║║Cancelling condition #3’s schedules…
+426ms ║║Condition #3 evaluated true (351ms)
+429ms ║║Comparison (enum) open changes_to (string) open = false (1ms)
+430ms ║║Cancelling condition #10’s schedules…
+431ms ║║Condition #10 evaluated false (5ms)
+432ms ║║Condition group #1 evaluated false (state did not change) (358ms)
+434ms ║╚Execution stage complete. (364ms)
+435ms ╚Event processed successfully (435ms)
10/29/2020, 12:15:15 PM +79ms
+1ms ╔Received event [MP Front Door].contact = closed with a delay of 56ms
+52ms ║RunTime Analysis CS > 18ms > PS > 4ms > PE > 30ms > CE
+55ms ║Runtime (37620 bytes) successfully initialized in 4ms (v0.3.110.20191009) (52ms)
+55ms ║╔Execution stage started
+196ms ║║Comparison (enum) active was (string) inactive = false (129ms)
+197ms ║║Condition #3 evaluated false (138ms)
+198ms ║║Condition group #1 evaluated false (state did not change) (139ms)
+200ms ║╚Execution stage complete. (145ms)
+201ms ╚Event processed successfully (201ms)
10/29/2020, 12:15:01 PM +73ms
+2ms ╔Received event [MP Front Door].contact = open with a delay of 73ms
+59ms ║RunTime Analysis CS > 16ms > PS > 5ms > PE > 38ms > CE
+62ms ║Runtime (37618 bytes) successfully initialized in 5ms (v0.3.110.20191009) (59ms)
+63ms ║╔Execution stage started
+332ms ║║Comparison (enum) active was (string) inactive = false (259ms)
+334ms ║║Condition #3 evaluated false (266ms)
+335ms ║║Condition group #1 evaluated false (state did not change) (268ms)
+336ms ║╚Execution stage complete. (274ms)
+337ms ╚Event processed successfully (337ms)
10/29/2020, 12:14:45 PM +571ms
+1ms ╔Received event [MP Front Door].contact = closed with a delay of 85ms
+64ms ║RunTime Analysis CS > 23ms > PS > 7ms > PE > 34ms > CE
+66ms ║Runtime (37620 bytes) successfully initialized in 7ms (v0.3.110.20191009) (64ms)
+67ms ║╔Execution stage started
+454ms ║║Comparison (enum) active was (string) inactive = false (375ms)
+455ms ║║Condition #3 evaluated false (384ms)
+456ms ║║Condition group #1 evaluated false (state did not change) (385ms)
+458ms ║╚Execution stage complete. (391ms)
+459ms ╚Event processed successfully (459ms)
10/29/2020, 12:14:37 PM +581ms
+1ms ╔Received event [MP Front Door].contact = open with a delay of 54ms
+55ms ║RunTime Analysis CS > 20ms > PS > 4ms > PE > 30ms > CE
+57ms ║Runtime (37618 bytes) successfully initialized in 4ms (v0.3.110.20191009) (55ms)
+58ms ║╔Execution stage started
+244ms ║║Comparison (enum) active was (string) inactive = false (174ms)
+245ms ║║Condition #3 evaluated false (182ms)
+246ms ║║Condition group #1 evaluated false (state did not change) (184ms)
+248ms ║╚Execution stage complete. (190ms)
+249ms ╚Event processed successfully (249ms)
10/29/2020, 11:29:03 AM +371ms
+1ms ╔Received event [MP Front Door].contact = closed with a delay of 78ms
+62ms ║RunTime Analysis CS > 22ms > PS > 5ms > PE > 34ms > CE
+64ms ║Runtime (37617 bytes) successfully initialized in 5ms (v0.3.110.20191009) (62ms)
+65ms ║╔Execution stage started
+369ms ║║Comparison (enum) active was (string) inactive = false (292ms)
+371ms ║║Cancelling condition #3’s schedules…
+373ms ║║Condition #3 evaluated false (304ms)
+374ms ║║Cancelling condition #1’s schedules…
+376ms ║║Condition group #1 evaluated false (state changed) (306ms)
+379ms ║╚Execution stage complete. (313ms)
+380ms ╚Event processed successfully (380ms)
10/29/2020, 11:28:54 AM +621ms
+1ms ╔Received event [MP Front Door].contact = open with a delay of 50ms
+60ms ║RunTime Analysis CS > 27ms > PS > 5ms > PE > 29ms > CE
+62ms ║Runtime (37620 bytes) successfully initialized in 5ms (v0.3.110.20191009) (61ms)
+63ms ║╔Execution stage started
+297ms ║║Duration 1273916ms for is >= 180000ms threshold = true
+298ms ║║Comparison (enum) inactive was (string) inactive = true (224ms)
+300ms ║║Cancelling condition #3’s schedules…
+301ms ║║Condition #3 evaluated true (233ms)
+305ms ║║Comparison (enum) open changes_to (string) open = true (0ms)
+306ms ║║Cancelling condition #10’s schedules…
+307ms ║║Condition #10 evaluated true (6ms)
+308ms ║║Cancelling condition #1’s schedules…
+309ms ║║Condition group #1 evaluated true (state changed) (242ms)
+311ms ║║Cancelling statement #4’s schedules…
+322ms ║║Executed physical command [Light Dining Dimmer].on() (8ms)
+323ms ║║Executed [Light Dining Dimmer].on (10ms)
+337ms ║║Executed physical command [Light Dining Dimmer].setLevel([100]) (7ms)
+338ms ║║Executed virtual command [Light Dining Dimmer].adjustLevel (12ms)
+341ms ║╚Execution stage complete. (277ms)
+342ms ╚Event processed successfully (341ms)
10/29/2020, 11:07:26 AM +119ms
+1ms ╔Received event [MP Front Door].contact = closed with a delay of 83ms
+60ms ║RunTime Analysis CS > 22ms > PS > 5ms > PE > 32ms > CE
+62ms ║Runtime (37622 bytes) successfully initialized in 5ms (v0.3.110.20191009) (60ms)
+63ms ║╔Execution stage started
+398ms ║║Comparison (enum) active was (string) inactive = false (323ms)
+399ms ║║Condition #3 evaluated false (332ms)
+400ms ║║Condition group #1 evaluated false (state did not change) (333ms)
+402ms ║╚Execution stage complete. (340ms)
+403ms ╚Event processed successfully (403ms)
10/29/2020, 11:07:19 AM +390ms
+2ms ╔Received event [MP Front Door].contact = open with a delay of 85ms
+65ms ║RunTime Analysis CS > 24ms > PS > 6ms > PE > 35ms > CE
+67ms ║Runtime (37620 bytes) successfully initialized in 6ms (v0.3.110.20191009) (65ms)
+68ms ║╔Execution stage started
+410ms ║║Comparison (enum) active was (string) inactive = false (331ms)
+411ms ║║Condition #3 evaluated false (339ms)
+412ms ║║Condition group #1 evaluated false (state did not change) (340ms)
+414ms ║╚Execution stage complete. (346ms)
+415ms ╚Event processed successfully (415ms)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

This probably won’t change anything, but move your contact sensor above your motion sensor in your IF.


#3

Quickly reading the log, it appears that the contact closed event may be cancelling the piston. A quick way to check would be to hold the door open to see if the light comes on. If that works then you need to change the piston execution options to not cancel on condition change.


#4

That would be my suggestion too. The piston evaluates ‘contact changes to open’ based on the value in the current event, and what that value was last time it saw it. When the motion condition is false the default behaviour of the piston is to not bother evaluating the contact trigger condition as it doesn’t make any difference, and my belief is that means the piston doesn’t ‘see’ the value.

So my interpretation of what is going on is:

11:07:19 Door opens with motion active.
On departure the door is opened while motion is active. The piston does not cache the open event.
11:07:26 Door closes with motion active.
On departure the door is closed while motion is still active. The piston does not cache the close event.
11:28:54 Arrival: Door opens with motion inactive. Light turned on.
On arrival the door is opened and motion is inactive. The piston apparently believes the last event was a close and so sees a change to open and caches the open event.
11:29:03 Door closes with motion active.
On arrival the door is closed with motion having been activated. The piston does not cache the close event. It still considers the last event was an open.
12:14:37 Door opens with motion active.
Door opens on departure. The piston does not cache the open event. It still considers the last event was an open.
12:15:15 Door is closed with motion active.
Door closes on departure. The piston does not cache the close event. It still considers the last event was an open.
1:04:23 Door is opened with motion inactive. Change to open not recognised.
Door opens on arrival. Because the piston thinks the last event was an open it doesn’t see ‘changes to open’ as true. The piston caches the open event.
1:04:30 Door is closed with motion now active.
On arrival the door is closed with motion having been activated. The piston does not cache the close event. It still considers the last event was an open.

The piston is now in a state where it will never see the door as having closed and so will always evaluate ‘changes to open’ as false.