I created an app that is an alternative to the Motion Lighting app to address some of my unique needs, and I thought I would share.
It's not as full featured as the Motion Lighting app, but it does offer these features that the Motion Lighting app doesn't:
- Multiple separate dimmer / switch configurations
- The Motion Lighting app only allows configuring the same levels / on commands for all dimmers / switches, but what if I want one set of dimmers to come on to 50%, one set to come on to 75%, and one set to operate in vacancy mode at a particular time of day? This app allows for that.
- Ability to only turn a dimmer / switch on if another device is on
- I use this for my bedroom lamps at bedtime. My wife and I usually come upstairs and go to bed between 10 and 12, and we want the bedroom lamps to turn on when we walk into our room, but not once we've gone to sleep, so during that time, the bedroom lamps only turn on if the stairway lights (also motion controlled) are on when motion is detected in the bedroom.
- Ability to use a dimmer or switch as a virtual occupancy sensor
- I use this as a way to turn on my Hue lamps only when my Lutron RadioRA 2 occupancy sensor detects occupancy AND insufficient ambient light. Lutron doesn't expose the ambient light level from their sensors, but I can configure the RA 2 software to turn on a virtual switch only when occupancy is detected AND ambient light is low, and I can then use that switch as a virtual occupancy sensor in this app instead of the occupancy sensor itself, which always triggers an event in Hubitat regardless of ambient light level.
- Ability to designate a group dimmer / switch as the control mechanism for a set of dimmers / switches
- This was a necessity due to the way Hue groups work. I like that Hue synchronizes bulbs when controlled via the group, but unfortunately, the groups don't show as on unless all bulbs in them are on, and I didn't want the app to turn on devices and change levels if even one bulb / lamp was already on.
- Less confusing setup (IMO)
- When I first got the Hubitat, I had a heck of a time getting the Motion Lighting app working correctly because (I know now that) it assumes it will be the only thing controlling the lights, and if you turn a light off manually without configuring the "Switches to turn off light" option, it wreaks havoc on its logic. This app assumes from the start that you might control the lights via other means.
- Speed
- Okay, the Motion Lighting App is pretty fast, so this one is a bit unfair, but this app does turn things on about 50 ms quicker.
As for the basic logic of the app...
- Devices will be turned on when the first occupancy sensor reports motion, but only if none of the devices are already on
- Devices will be turned off once all occupancy sensors report no motion
Note: The app has no delay until off setting because it's meant to be used with occupancy sensors that have their own delay until off setting, not basic motion sensors. I use it with Luton RadioRA 2 occupancy sensors. I might add this feature if enough people want it, but I mainly made this app for myself, so you can probably get faster results by modifying my code yourself.
https://github.com/gtg465x2/hubitat-public/tree/master/Apps%20Code/Occupancy%20Control