[RELEASE] Occupancy Control

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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

2 Likes

I use motion lighting for a number of automations & have found it quite flaky at times --- I will give this a go this weekend to see if it helps!

1 Like

Hi @graysoncarr, I currently use the built-in motion lighting app, however like you, there are some missing features, which your app provides. The multiple seperate dimmer control is one feature that 'shines' in your app.

Can I suggest a couple more features, which I would like to see added to your app:-

  1. LUX Levels to control when lighting is turned on or off, based on occupancy. I realise you can set a virtual switch based on there being insufficient ambient light, however it would be perfect if you could set this up within the app.

  2. Time settings, in addition to modes, to allow lighting to be turned on or off i.e Sunset and Sunrise, based on occupancy.

  3. The ability to set the off delay time per mode.

I realise that I'm asking for more or less the same feature set as the built in motion lighting app, but I am also finding this a bit flaky and would like to use an alternative.

Added off delay per mode, so now those with regular motion sensors can use it as opposed to just those with occupancy sensors.

If you installed it when I first posted this, you'll probably lose a few settings and will need to set things up again because I rewrote a lot of code to make it cleaner, which should make it easier to add features in the future.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.