Need help turning a light off based on motion, after a door is opened


#1

I have a light switch in my garage with a GE smart switch. I also have a motion detector in there and a door contact sensor. When the light is turned on from the opening of the door, it never shuts off. If the light is turned on from the motion sensor, it shuts off after 5 min. as programmed.

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


#2

In the first IF, you have TCP set to never. (The small red N).
In the second IF you haven’t. Set the second IF’s TCP to never.

BTW. I have to ask, why have you put everything into variables? Is there a need to do that

EDIT: Oh i see why you have done that now.

Forget the TCP change.
Change the second IF from changes to Inactive, to is inactive.
OR remains inactive for 5 minutes and then delete the wait 5 minutes.


#3

Thanks. Made the changes you recommended and will test.

As for the variables, that’s how I see a lot of scripts written, just trying to follow suit.


#4

I don’t know the distance between your motion sensor & door, but in your code, there’s no mention of:
“turn off the light when the garage door closes”

In other words, if the door is opened (and if you are able to keep outside the range of the motion sensor) the light will never turn off.


You could resolve this by adding this block to the end of the piston:

If {theGarageDoor}'s contact remains closed for 5 minutes
then
    with {theLight}
    do Turn off
end if

Side Note :
When testing my pistons, I often save time by reducing my timers to 20 seconds.
It makes testing quick & easy, and once I am happy, I return them to the proper durations…