Motion Lighting

For those who have the need for lights controlled by motion sensors, who want different brightness for different modes, and want it to work now instead of waiting for ST to debug Smart Lights, “Motion Lighting” performs these functions (and works!).


Just installed Motion Lighting. It seems to be closer to what I describe but still sets a single % for all of the “child” dimmer switches. Or did I miss something?

Also, a small bug - picking a Mode is required. It does not allow selection of “All Modes”


You are correct. This too only supports a single dimmer level between the master and slave dimmers for a given mode for a single instance of the app. To get more dimmer levels for the same mode, you would need more than one instance. It actually used to support multiple dimmer levels, but I found it very cumbersome. I use one instance of this for each lighting area, of which some rooms have more than one. But, for my lighting, I didn’t need multiple dimmer levels within one lighting area.

Edited: About the mode selections: If you want a single dimmer level for all modes, simply select you main mode and set its level. Other modes will be disregarded, and use the same level.

Thanks for the quick reply.

When I leave the Mode Option “blank” … which is click to set defaulted to “All Modes” … the app throws an error when I click next. It seems to require that a mode (or modes) are selected. May be by design

Yes, you must specify the modes you want to set levels for, and there must be at least one. If you only pick one mode, the levels will be the same for all modes. Any mode not selected is simply ignored when it comes to changing the dimmer levels. Just pick your main mode if you want the lights to stay at one level. The app will automatically select the mode you are in when you install it as the initial default mode, but you can select as many as you want.

superState is your friend


Trying that next thanks!

Looking up superstate … do you mean the :“beta v1.1”?

Correct. Follow the instructions on GitHub, and you’ll be set.

I would love to have a version of your app that does not use dimmers. My kitchen lighting is on zwave switches. I tried to modify your code but the IDE seems to be on the blink at the moment for creating new apps.

What is it that you want? The motion control? Obviously the dimmer levels per mode is irrelevant. If it’s just switches activated by motion, for on and off, that is totally doable with Smart Lights.

Smart lights has a bug. If you select turn off 2 minutes after motion stops and there is a motion off event it will turn the lights off after this initial motion off event. It does not reset the timer if another motion event occurs after motion stops during this 2 minute timer.
I’ve discussed this at length in some other threads.
Before Smart Lighting I had my kitchen lighting setup to turn off X minutes after the motion stops. It worked perfectly and never turned off while motion was present.

Got it. I’ve heard about that bug. I wrote a little app to handle “Turn off after motion stops” that does that function (reliably – :grinning:). Just use Smart Lights to turn things on the way you want, and use this app to turn them off after motion stops (instead of Smart Lights doing it). That should get you around the bug until they fix it.

Go to this thread:

Thanks Bruce! That fixed my undercabinet lighting.

1 Like

Hi @bravenel – just starting using this code and it seems to be working great, one option that would be really helpful though would be to have the ability to set philips hue color when turning on a set of lights. The dimmer option works great, how easy would it be to implement the color option also?

James, I don’t have any Hue bulbs, so I haven’t messed with color AT ALL. It should be possible to extend the app to use color, but I haven’t looked at it. This is not on my list of things to do right now. Maybe someday…

1 Like

I had a little play around with the code and actually managed to get it working.

For anyone who may want to do this you just need to do the following:

Find def switchesOn() and within that replace



master.setColor([hue: 23, saturation: 56, level: state.dimLevel])
slaves?.setColor([hue: 23, saturation: 56, level: state.dimLevel])

This is obviously a very basic change (with a hardcoded color) and will need additional tweaking to be able to select a color from the app.

I’m trying this app in place of RE because of delay issues. I can get it to work great with my GE Link bulbs but my Cree’s won’t dim after turning on the first time. The first time they do go to the correct value. Using Wackware GE Link Bulb as the device type (same as on the working GE bulbs) tried the generic Dimmer Switch as well as a Cree device type knowing it wouldn’t work, it didn’t. Any thoughts on what device type to use for the virtual switch?

I don’t know what RE is, or what delay issues you are referring to. I’m using Motion Lighting with Cree bulbs, using the first Device Type published by ST for the Cree bulbs, called “My Cree Bulb beta”. That works fine for me, and I’m able to control my Crees just like any other dimmer I have.

Which virtual switch are you asking about?

Ha, sorry was thinking rule machine while reading about an engine, brain short circuit. Rule machine takes between two and three seconds to bring a light on from a motion sensor. Takes half that time when processed local.

My setup is two cree or ge smart bulbs in a single fixture. Since ST doesn’t do groups that I’ve found, I have a dummy switch that controls both real bulbs, hence using RM, Dim with Me, or Motion Lighting. The ge bulbs work with motion lighting and the dummy switch when device type of the dummy is the wackware ge link bulb.

I’m guessing I need a virtual device type similar to that but with the correct Cree coding.

Obviously I could just tie one bulb to the other in motion lighting but that would break some of my rules that use each light brightness individually from one another.