My First Piston - Turn on light upon entry


#1

1) Give a description of the problem
Just looking for feedback on my first attempt to create a Piston

2) What is the expected behavior?
I have a Door Open/Close Sensor with a Motion Sensor on the inside. I want to turn on the light if I come in, but not do anything when I leave. I have a separate device with a luminance sensor that I am using to see if it is dusk/dark.

3) What is happening/not happening?
It seems to be working - I am just looking for feedback as to whether it could be improved.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
’ |+2ms|╔Received event [Front Entry].contact = closed with a delay of 71ms|
| — | — |
|+167ms|â•‘RunTime Analysis CS > 17ms > PS > 134ms > PE > 15ms > CE|
|+169ms|â•‘Runtime (38866 bytes) successfully initialized in 134ms (v0.3.109.20181207) (166ms)|
|+170ms|â•‘â•”Execution stage started|
|+181ms|â•‘â•‘Comparison (enum) closed changes_to (string) open = false (1ms)|
|+183ms|║║Cancelling condition #2’s schedules…|
|+184ms|â•‘â•‘Condition #2 evaluated false (7ms)|
|+186ms|║║Cancelling condition #1’s schedules…|
|+187ms|â•‘â•‘Condition group #1 evaluated false (state changed) (11ms)|
|+190ms|║╚Execution stage complete. (19ms)|
|+191ms|╚Event processed successfully (191ms)|
|1/14/2019, 6:31:19 PM +991ms|
|+1ms|â•”Received event [Front Entry].contact = open with a delay of 82ms|
|+144ms|â•‘RunTime Analysis CS > 17ms > PS > 114ms > PE > 13ms > CE|
|+146ms|â•‘Runtime (38871 bytes) successfully initialized in 114ms (v0.3.109.20181207) (144ms)|
|+147ms|â•‘â•”Execution stage started|
|+158ms|â•‘â•‘Comparison (enum) open changes_to (string) open = true (1ms)|
|+160ms|║║Cancelling condition #2’s schedules…|
|+161ms|â•‘â•‘Condition #2 evaluated true (8ms)|
|+162ms|║║Cancelling condition #1’s schedules…|
|+163ms|â•‘â•‘Condition group #1 evaluated true (state changed) (10ms)|
|+178ms|â•‘â•‘Comparison (enum) inactive is (string) inactive = true (2ms)|
|+180ms|â•‘â•‘Condition #5 evaluated true (12ms)|
|+181ms|â•‘â•‘Condition group #4 evaluated true (state did not change) (14ms)|
|+193ms|â•‘â•‘Comparison (integer) 0 is_less_than_or_equal_to (integer) 150 = true (2ms)|
|+195ms|â•‘â•‘Condition #8 evaluated true (11ms)|
|+196ms|â•‘â•‘Condition group #7 evaluated true (state did not change) (14ms)|
|+198ms|â•‘â•‘Condition group #3 evaluated true (state did not change) (31ms)|
|+201ms|║║Cancelling statement #9’s schedules…|
|+660ms|â•‘â•‘Executed physical command [Entry].on() (455ms)|
|+662ms|â•‘â•‘Executed [Entry].on (457ms)|
|+666ms|║╚Execution stage complete. (519ms)|
|+668ms|╚Event processed successfully (668ms)|’ indent preformatted text by 4 spaces


#2

Hi @Bruce_Young

My experience with LUX sensors wasn’t that great so I gave up on that idea (because they don’t report fast enough etc)

I was just wondering, how do you turn the light OFF??


#3

The intent is that I would manually turn the light off. The switch is right there and we may want to leave it on or turn it off as soon as we leave the entryway where the light is located. That is our current behavior - But if it is really dark when we come in, it is nice to have the light come on automatically.

Regarding the lux sensors - I will just have to wait and see how it works. The lux sensor is in a HomeSeer FLS100+ Floodlight sensor outside on the other side of the house. I know it only reports every 10 minutes, but that should be good enough. The other option would be to set a time range based on sunset/sunrise, but this seemed more elegant.


#4

I see,
Now since the piston is working it’s all good:))
I am just brainstorming (lets see if we can even shorten it)

Why do you need motion sensors as a condition then?
You want it to work only coming from outside…
That means, inside is dark, that means no one is inside anyway??? right??

or do you have pets???
I just didn’t understand motion sensor part because you want to make sure no MOTION is the condition…


#5

The reason for the motion sensor is that I don’t want the light to come on when I am leaving, just when I am coming in. Remember that the Motion Sensor is on the inside of the door, not the outside. The thinking behind checking the motion sensor for both inactive and only a short period of active is that I wasn’t sure if I could really be sure that the contact sensor notification would beat the motion sensor notification. If I wanted to spend more time experimenting, I could maybe eliminate the active for less than 5 seconds check. And regarding the pets question, pets on the inside would mess this up as there could be activity from pets inside as the door is opened which would then keep it from turning on the light.

Also note that the lux sensor is in a different motion sensor that is outside. So I am just using that for a simple way of checking to see if it is dark outside, not whether or not it is dark inside.