Open door, turn lights on with door contact, pass control to motion sensor


#1

1) Give a description of the problem
Just a bit of help here, am I close with this piston?, what I want to do, is when the wife comes home from work in the dark, when she opens the back door (kitchen) it turns the under unit lights on, it then passes control over to a motion sensor

2) What is the expected behavior?
Door gets opened - Under unit lights come on
Door gets closed, under unit lights stay on until there is no motion - then turn off with no motion and back on with motion

3) What is happening/not happening?
Testing right now - Logic check required

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

5) Attach any logs (From ST IDE and by turning logging level to Full)
`(+1ms
╔Received event [Back Door].contact = closed with a delay of 253ms
+104ms
║RunTime Analysis CS > 14ms > PS > 28ms > PE > 61ms > CE
+114ms
║Runtime (38619 bytes) successfully initialized in 28ms (v0.2.0ff.20171129) (112ms)
+115ms
║╔Execution stage started
+120ms
║║Condition group #34 evaluated true (state did not change) (1ms)
+121ms
║║Condition group #3 evaluated true (state did not change) (2ms)
+153ms
║║Comparison (time) 78088975 is_between (datetime) 1512921060000 … (time) 3600000 = true (4ms)
+153ms
║║Time restriction check passed
+155ms
║║Condition #37 evaluated true (33ms)
+158ms
║║Comparison (enum) closed changes_to (string) open = false (1ms)
+159ms
║║Cancelling condition #38’s schedules…
+160ms
║║Condition #38 evaluated false (4ms)
+160ms
║║Cancelling condition #35’s schedules…
+161ms
║║Condition group #35 evaluated false (state changed) (39ms)
+162ms
║║Cancelling condition #3’s schedules…
+162ms
║║Condition group #3 evaluated false (state changed) (41ms)
+170ms
║║Condition #21 evaluated false (5ms)
+171ms
║║Condition group #15 evaluated false (state did not change) (6ms)
+177ms
║║Condition #43 evaluated false (4ms)
+178ms
║║Condition group #39 evaluated false (state did not change) (6ms)
+180ms
║╚Execution stage complete. (65ms)
+224ms
╚Event processed successfully (223ms)
09/12/2017, 21:41:23 +711ms
+1ms
╔Received event [Back Door].contact = open with a delay of 262ms
+103ms
║RunTime Analysis CS > 20ms > PS > 26ms > PE > 57ms > CE
+116ms
║Runtime (38615 bytes) successfully initialized in 26ms (v0.2.0ff.20171129) (115ms)
+117ms
║╔Execution stage started
+122ms
║║Condition group #34 evaluated true (state did not change) (1ms)
+123ms
║║Cancelling condition #3’s schedules…
+123ms
║║Condition group #3 evaluated true (state changed) (2ms)
+153ms
║║Comparison (time) 78083836 is_between (datetime) 1512921060000 … (time) 3600000 = true (5ms)
+154ms
║║Time restriction check passed
+155ms
║║Condition #37 evaluated true (30ms)
+158ms
║║Comparison (enum) open changes_to (string) open = true (0ms)
+159ms
║║Cancelling condition #38’s schedules…
+160ms
║║Condition #38 evaluated true (4ms)
+161ms
║║Cancelling condition #35’s schedules…
+162ms
║║Condition group #35 evaluated true (state changed) (37ms)
+162ms
║║Condition group #3 evaluated true (state did not change) (38ms)
+164ms
║║Cancelling statement #29’s schedules…
+169ms
║║Skipped execution of physical command [Under Unit Lights].on([]) because it would make no change to the device. (3ms)
+170ms
║║Executed [Under Unit Lights].on (4ms)
+178ms
║║Cancelling condition #21’s schedules…
+179ms
║║Condition #21 evaluated false (6ms)
+180ms
║║Cancelling condition #15’s schedules…
+180ms
║║Condition group #15 evaluated false (state changed) (8ms)
+187ms
║║Cancelling condition #43’s schedules…
+188ms
║║Condition #43 evaluated false (5ms)
+188ms
║║Cancelling condition #39’s schedules…
+189ms
║║Condition group #39 evaluated false (state changed) (7ms)
+191ms
║╚Execution stage complete. (74ms)
+206ms
╚Event processed successfully (205ms)
09/12/2017, 21:41:21 +494ms
+2ms
╔Received event [Motion Kitchen].motion = active with a delay of 104ms
+108ms
║RunTime Analysis CS > 16ms > PS > 34ms > PE > 58ms > CE
+134ms
║Runtime (38628 bytes) successfully initialized in 34ms (v0.2.0ff.20171129) (132ms)
+135ms
║╔Execution stage started
+140ms
║║Condition group #34 evaluated true (state did not change) (1ms)
+141ms
║║Cancelling condition #3’s schedules…
+141ms
║║Condition group #3 evaluated true (state changed) (2ms)
+191ms
║║Comparison (time) 78081637 is_between (datetime) 1512921060000 … (time) 3600000 = true (4ms)
+192ms
║║Time restriction check passed
+193ms
║║Condition #37 evaluated true (50ms)
+201ms
║║Condition #38 evaluated false (7ms)
+202ms
║║Condition group #35 evaluated false (state did not change) (59ms)
+203ms
║║Cancelling condition #3’s schedules…
+204ms
║║Condition group #3 evaluated false (state changed) (61ms)
+208ms
║║Comparison (enum) active changes_to (string) active = true (0ms)
+209ms
║║Cancelling condition #21’s schedules…
+210ms
║║Condition #21 evaluated true (4ms)
+211ms
║║Cancelling condition #15’s schedules…
+212ms
║║Condition group #15 evaluated true (state changed) (6ms)
+213ms
║║Cancelling statement #18’s schedules…
+218ms
║║Skipped execution of physical command [Under Unit Lights].on([]) because it would make no change to the device. (2ms)
+219ms
║║Executed [Under Unit Lights].on (3ms)
+222ms
║╚Execution stage complete. (86ms)
+232ms
╚Event processed successfully (232ms)

Logging level `

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


#2

I sort of already do this. I simply have the lights turn on when either one of us comes home and it’s dark out. I also have a motion sensor in the kitchen to turn the light on with motion when it’s dark out, set a timer for 5 minutes and turn it off if there’s no motion. That’s it!


#3

Cool, could you post a sample of your piston please

Thanks


#4

Sorry for the delay. I had to wait to get back to my desk.

It’s actually two separate pistons. One turns the lights on when we get home and does not turn them off. They get turned off by the Good Night routine when things settle down.

The second piston (which I think we’re going to wear out since we use it so much) just turns the kitchen lights on and turns them off after 5 minutes of inactivity. I have to set the color temperature because I use that light for other notifications (traffic, weather, turn it pink when my wife gets home, etc).

Editing to add: Motion Sensor 1 is in the kitchen. Temperature Sensor 1 is actually the weather tile. @lux_trigger is a global variable I’m using for a few other pistons when it’s dark (landscape lights, living room lamp, etc). Currently I have it set at 650 lux. RGB Bulb 2 is my under-cabinet LED strips. White Bulb 1 is a dimmer for the Island Light.



#5

Thanks a lot
Just looking your pistons, I think I might go the same way and use two pistons instead of one like you have

Nice one