Door turns on light but motion turns it off


#1

I’ve been working on the guts of this Piston getting it to work before adding other conditions/restrictions. What I’m trying to do is when I open the door from the house into the garage I want the lights to come on and stay on while I’m in the garage. Then turn off after no motion for a set time. I can’t make it just motion based for a few reasons and one of them is the position of the motion sensor wouldn’t allow the lights to come on until you were 4 feet into a pitch black garage down the steps. I also need a no motion buffer because part of my workbench is out of the motion detectors line of sight. so if I step out of the view for a few minutes I don’t want to be standing there in the dark with lots of sharp objects around me.

Here is one version I put together last night that works but I feel is inefficient. It also runs the loop 3 times ie I get 3 push messages each time on the turn off. It’s 3 every time too so I’m guess it’s a timing issue before the loop registers the exit flag.

Would the use of Piston states work better than a Boolean variable? any suggestions for making this better more efficient?

There’s lot of other features I’d like to add to this at some point too, like manual switch on disables motion off, if the door opens and there is no motion or very short lived motion the lights turn off faster (we have a shelf right on the inside of the door we place things like tools and such on to put away later) and also having the lights turn on with just motion but no door in case I’m in there and the lights go out or I come in from the other door.


#2

Would this less complicated version work for you. You can put the notifications in the DO.
IF
Door changes to open.
WITH
Light
DO
Turn on light

New expression.
IF
Motion detector stays inactive for 5 minutes.
WITH
Light
DO
Turn Off

Edit.
You could also put another if in.
IF
Door stays open for less than 1 minute.
WITH
Light
DO
Turn Off.
This would cover your quick open and close of the door.


#3

I tried something like this in my first pass but I could not get the light to turn off reliably. They would often turnoff earlier than expected to the point I started building in warnings by flashing the lights in the garage right before they turned off in order to stop it.

I also plan on adding additional conditions that wouldn’t function well with just the motion inactivity turning it off. For example I want off evaluation to check if the garage doors are open and if so don’t turn off the lights. I also wanted to add a manual switch trigger to override the motion inactivity time out as well. This way if I’m working in the yard or under the car where motion won’t capture me I can override it.


#4

@LCSteve I wanted a Piston with pretty much the same logic as you describe in this thread. Basically I have the same issue as you of the motion not turning on the light soon enough as I stepped into the garage. I think this does most of what you want. If you like it you can play with it and add more stuff to your liking. I copied @bengali’s initial piston called Motion Based Light EXCEPT when Manually turned On which has two boolean variables that keep track of the light being on via manual switch activation/phone app activation or via the motion sensor and went on from there to add a door trigger and other logic

Here is what it does:

  1. Turns on light when either:
    a. garage door from the kitchen opens
    or
    b. motion is detected in the garage (i.e. if a car, or someone, comes in from opening the actual garage door)

  2. If the kitchen door to the garage is opened and then the person decides to NOT go into the garage (i.e. motion in the garage is not activated), once the door is closed again the light immediately turns off.

  3. If the kitchen door to the garage opens, as mentioned before the light immediately turns on. As someone goes into the garage, the motion then takes over the Piston and light stays on for xxx seconds/minutes after motion is deactivated.

  4. If, after going through the Kitchen door into garage and then coming back into the kitchen, you can manually turn off the light from the zwave switch next to the door (or via your phone app) and it will go off immediately. Meaning it will then override the motion side of things. You do not have to do this, but then the light will stay on through the time you have set in the Piston for the Motion deactivation.

  5. If at any time you want to manually override and just want the light to stay on for as long as you want, all you have to do is turn on the garage light from the zwave switch located next to the garage door in the kitchen or via your phone app. This will then disable the kitchen to garage door switch and motion activation. If you have already gone into the garage first and activated the door switch and motion activation you can disable it by flipping the manual zwave switch off, then on again (or with your phone app by doing the same). This then puts it into manual mode until you manually turn it off.

Hope this helps you. Really works well! Took a long frickin time to figure out. I’m not that savvy a WebCore guy but had a great head start. :smile: