Garage Lights on with Doors and then off if motion sensor inactive


#1

1) Give a description of the problem
Garage lights won’t turn off

2) What is the expected behavior?
I have a smartthings multi sensor setup as a tilt sensor on my garage door. A contact sensor on my interior garage/laundry room door. A GE light switch controlling the garage lights and a GE motion sensor on my back wall in the garage.

Ultimately, I want the garage lights to turn on if either door opens. I want the lights to stay on if one or both of those doors is open. I want the lights to turn off in 5 minutes if both doors are closed but only if the motion sensor does not see motion, otherwise that means I’m in there working. The problem is that sometimes when I open the interior door to grab something or put something away it doesn’t always activate the motion sensor because of where it needs to be mounted (plus the response time is much slower than the door sensors). I don’t want the motion sensor to turn on the lights because the cold and warm drafts have a tendency to trigger motion sensor in a garage so I only want it to sense my presence once I’m there. (except maybe to turn the lights back on if they’ve only been shut off for under 30 seconds… say if I was sitting and reading something, etc… then I could just wave my hand and have them come back on).

3) What is happening/not happening?
I’ve tried building a number of pistons but there’s always some part not working right. Usually it is that the lights won’t turn off at some point… as is the case with this more basic piston I’m posting.


#2

Not related to the light issue, but out of curiosity, why are you using contact sensor 1 orientation? Is not open/closed good enough.


#3

Looking at it, it should work.
Can you post logs please when you have an issue.


#4

Because last night was the first time I’ve tried using webcore lol. I figured since I’m using the 3 axis sensor in the Smartthings brand multi sensor as a tilt sensor (not as a contact sensor) that I had to be accurate with the code. Your right, open/closed would be easier.


#5

Also, on a side note, what is the proper use of “pause piston” and “resume piston”? Can you use those sort of like “wait” but until other actions occur instead of a set amount of time? If so, where do you place the pause and resume commands? Thanks


#6

Pistons can pause themselves, but (hopefully this is obvious) once they are paused they cannot resume themselves. Piston A can pause and resume Piston B though (and vice-versa). So if you want to create a pause/resume scenario it’s best to have a master piston which pauses the rest of them.

A good use might be when you’re going on vacation and you want to disable some stuff…or let’s say you’re doing maintenance on your system and you need things to stop for a while. You can have a piston pause all (or some of) the other pistons and then you can have it resume them at a later point.

Generally I would use Wait significantly more frequently than Pause. Pause would be a special case in my opinion.


#7

So for what I’m trying to do I could make a piston that turns the light on and pause it. make a 2nd piston that unpauses if a motion detector in the garage senses movement and then pauses. and then a 3rd piston that turns the lights off if all the door sensors are closed and no motion is detected? would that be an easier way to do what I need instead of trying to have all that happen in a single piston? I understand the pause and resume i think but not sure how to execute it… if I even need that type of program. Thanks. Jordan


#8

I would not advise pausing and un-pausing pistons like that. Besides, I don’t think that’s even necessary.

Give this piston a try, I think it will work. I even added your 30 second motion based trigger into the mix so only when the motion is within the last 30 seconds of the lights going off is motion allowed to turn the lights back on again. Adjust the time value (the addSeconds part) if you need to modify that at all.

I’m using three triggers here…they’re all independent of each other so there should not be any conflicts, and the way the Turn off section is written now will likely get around the issue you were having before where the lights were not turning off (which was probably because the tasks were getting cancelled…but don’t worry about that with this way).


#9

Thanks so much, I will give it a try on my next day off. This is what I need in order to wrap my head around how webcore works. I can look at the code and break it down and analyze how each part works… I’m a visual learner so it will really help me with figuring it out. Thanks again - Jordan


#10

Mike,
I tried out your piston and its been working great until I had to do work in the garage. It kept turning the lights off after 5 min. I went into the piston and it didn’t seem to reset the 5 min countdown timer if motion was detected. After 5 min of the door being closed the light would shut off and motion would turn then back on. Did you experience this if so how did you solve?

Webcore really need an if motion stays inactive for x time setting.

I just added a wait 5 min before the "Set variable {MotionTrigger} = {addsSeconds($now,30)};


#11

Like this?


#12

Wow! that was quick.

Wait! Damn not an option for this case.


#13

Scroll down to triggers. (unless you are using a condition)


#14

Its a restriction. Line 32 from the code above.


#15

How about this?


#16

You are amazing!