Garage Lighting Automation


1) Give a description of the problem
I just added lots of Lithonia LED overhead lights in the garage; a magnetic switch garage door position sensor; an Aeotec Door/Window Sensor 7 (DWS7) using dry contacts from the garage door sensor; and a Honeywell Z-Wave wall switch to control the LED lights (not a dimmer). I need to automate the LED lighting (see #2).

2) What is the expected behaviour?
a) When I turn the LED lights on using the Z-Wave wall switch, they should stay on until I manually turn the wall switch off. They should NOT go off on a timer. If I manually turned the lights on with the wall switch, the lights should not change state if the garage door goes open or closed.
b) When I open the garage door, the magnetic switch activates the Aeotec DWS7 which should turn the LED lights on for 15 minutes ONLY IF the lights were off when the DWS7 activated. If the LED lights were already on, the DWS7 should not change the LED light state nor should it activate the timer.

3) What is happening/not happening?
Nothing yet. I haven’t tried writing the piston yet.

**4) Post a Green Snapshot of the piston.
No prototype piston yet. Need help getting started.

Any help on design ideas to get started would be helpful. I searched the Community but didn’t find a similar design challenge. Thanks in advance for any help!


We can start with the piston and i’m sure if we get stuck someone will jump in and help.
3 questions:
1 - for this the work as you want, you need to be able to see all involved devices in Webcore.
Are you able to see them all in webcore?
2 - Are you comfortable using variables?
3 - Zwave wall switch, this is only switch you want to use right? No regular wall switch is involved.


I think this thread can be helpful…

Where you see “Motion Sensor”, just replace it with your “Contact Sensor”


Thanks, WC. This looks promising and is a good starting point.



I reviewed Bangali’s “Motion Based Light EXCEPT when Manually turned On” piston and I had a hard time understanding the timing and interaction of the variables. So I stripped it down to what I thought would be the bare essence – detect the sensor going closed to turn on the light for some time period when the light is initially off. See piston below. Ignore the two variables and the “Set variable” commands - they are not used and are left over from where I started with Bengali’s work.

Note that the Aeotec DWS7 requires the use of a Normally Open contact on the sensor. Therefore, the contact in the DWS7 is OPEN when the door is closed and changes to CLOSED when the door goes open. That’s why the first line reads “Contact Sensor 1’s contact changes to closed”.

This piston successfully turns the light on when the door goes open. But the timer does not work – the light does not get turned off. Why doesn’t the timer work?



Hi, Ike. I started using the piston that WCMore referenced. To answer your questions:

  1. Yes, I can see both the sensor and the wall switch in webCore
  2. Yes, I am comfortable with variables. Although using them in real-time stateful systems often leaves me confused, especially when different logic blocks are consuming or setting the variables.
  3. Yes, I want to use only the one Z-Wave wall switch. There are only two Z-Wave devices - the magnetic switch sensor on the door (it is Normally Open, i.e., OPEN when the door is CLOSED and it goes CLOSED when the door OPENS) and the wall switch.


Is the piston working or do you need more help?
Since Wcmore is the pro, when he started helping I thought it was already done.


The WITH on line 27 should have TCP set to Never for the WAIT to work correctly… Otherwise, after the 45 seconds, the contact sensor is no longer changing to closed, so the rest of the logic aborts


I set TCP to Never and now get unexpected behavior. The lights take about 12 seconds to go on, but don’t reliably go on. When they do go and and then time out, they will go on when the door closes and the switch goes open. If I turn the lights off manually while the countdown timer is operative, the timer turns the lights back on when it expires. Weirdness.


Forgot to mention that, when I use the “Power Allowance” feature in ST (not using webCoRE) I get the lights to reliably go on about 1/2 second after actuating the door to go up and the light reliably goes off after the timer expires. But I saw weird behavior there, too. Sometimes the light goes on when the door closes.

I think I have a problem with the magnetic reed switch bouncing. I think I see this in the Trace log.


This part sounds like network congestion and/or semaphore delays…

This sounds like the exact opposite of your code above. Did you make any changes to the code since your last JPG 4 days ago? If so, we’d need to see a fresh green snapshot.

The only turn on code is the very first command. This means the piston started all over at the top when this happened. (or maybe, your code has changed)

Furthur debugging would require logging set to Full highlighing an error event.
(and a new green snapshot)