Lights - simultaneous automatic and manual control

I have a fairly straightforward problem I think, but so far the solution has eluded me:

I have a light set to turn on when there is motion, and off again after some period when there is no longer motion. This works as expected.

However…

I would also like the light to stay on when I manually use the switch to turn it on. How can I achieve this without deleting the app used for automation?

here’s my use case:

I have a motion detector in front of the house that will turn on lights in the driveway when it’s dark. This is great for arrival/departures at night.

Occasionally, I am outside or have some guests outside as well when it’s dark. If we aren’t dancing around like lunatics, the lights keep shutting off (no motion).

Any suggestions would be appreciated.

You could make a mode for outside “play” and make different rules for that same light during the new mode. then just use hello home to change modes when you know you will be entertaining outside. You can even schedule that mode if it would be every Friday and Saturday night for example.

Don’t forget to make sure you don’t run your normal rules in all modes, just the modes other than outside play mode or whatever you want to call it.

@orangehexagonsun

To me this should be the default action. If I manually turn on the switch, it should ignore the motion trigger until I switch it off.

I agree.

Which SmartApp are you using to turn the light on with motion?

@storageanarchy

I would assume @orangehexagonsun is using Light Turn on Motion which is the default in the dashboard under Lights & Switches. I tried using it but abandoned it because I also had the need to do a manual override. Is there a solution to this because I haven’t seen it.

I’ve been meaning to do this one for a while.

I have been using “Smart NightLight” for my outdoor security lights. I have 5 lights, each associated with a different motion sensor, and like Greg, I wanted to be able to override them on occasion.

I whipped this together based on the Smart NightLight code, but I have not yet debugged it (I’ll do that tonight). It has a limitation (like the original Light Turn on Motion applet) of supporting only a single light, but that works for my purposes.

Until I debug it, I haven’t shared it in the IDE, but it is here in my GitHub if you are daring enough to try it:

One note - the app does not prohibit OTHER apps from turning off the light - this is intentional. This way, you can manually turn on the light and still have a Hello, Home Action (e.g. Goodnight!) turn off the light when you go to sleep.

TTFN!

2 Likes

Is this supported? The ability to detect input from the switch vs. input from an app? Then this could be supported with a simple conditional.

I’d love to try it out once you’ve posted it to the community.

@storageanarchy

Thanks for the app. It covers pretty much everything for a typical security light. I find 100 luminance works best for my Aeon Multisensor but that is easy for me to adjust.

For internal lights it basically needs your manual override added to Light Turn on Motion. Inside you want to specify what times motion triggers it, not just on sunrise/sunset.

Will manual override work when the light is already on? I can’t tell from the code.

Unfortunately, I can’t find the source code for Light Turn on Motion - it doesn’t seem to be published anywhere, and I’m not in to re-creating it from scratch. If you can find it, point me at it, and I’ll fix 'er up.

As for this version - yes, if the light is turned on by a physical event before the motion event, it will override the app. If you want to override it AFTER the motion event turns on the light, you’ll have to manually turn it off, then manually turn it back on (I may still need to tweak a couple of variables to make this work right).

Also, note: I am assuming that all switch devices report .isPhysical() - they are supposed to, according to ST, but I can’t guarantee it. So this may not work for all switches…so, I’m considering adding a double-tap-on event handler that will override the motion sensors as well. That’s for later, though…

Meanwhile, if you try it, let me know what works and what doesn’t…

Daniel -

If the switch device implements the .isPhysical property (as it is supposed to), we can tell when it is manually turned on/off.

I have not found a reliable way to tell which app sends an on/off command, though.

But since I’ve trapped all the internal on/off initiators, however, I can assume if it’s NOT .isPhysical, then the on/off event must be from another application.

@storageanarchy

Thanks for explaining how it works. I’ve set up my porch light to use this app. I’ll test it out tonight with a “real world” instead of contrived test.

Thanks again.

A few minor tweaks had to be added. You can now double-tap ON when the light is on, or single-tap ON if it’s not on, and you will lock it on until something else turns it off (or it gets light/sun rises).

Still to do: double-tap OFF to lock the light off until something turns it on, the mode changes, or it gets dark (I think I can make that happen - just not tonight).

Is now available in the IDE Shared Apps, and on my Github (above).

@storageanarchy

Nice! Good enhancements.

Wow and you added a configurable lux value!

You asked for that, didn’t you?

We all loves you @storageanarchy. Just to get mushy and all. (SMILE)

Now back to our original television show.

All finished (I think).

Based on preferences, you can:

  • Override motion control by turning on the lights manually while they are off
  • Override motion time-out by manually Double Tapping ON while the lights are on
  • Override motion ON by Double Tapping OFF, locking the lights off until:
    • it gets light/sunrise
    • someone manually turns ON the lights
    • another application turns ON the lights

If you want to return to motion-controlled lights now (instead of tomorrow), simply turn the lights off manually (once).

Also added the option to specify the Lux level for on/off control

I suspect the code is a little convoluted, but it seems to work…

Enjoy!

It isn’t often you get what you ask for.

I’ve got another that you might find a challenge if I can push my luck…

I now must have a couple of dozen GE switches and receptacles. However, at night the LEDs light up the room. How about an app that toggles them on when there is motion, otherwise they stay off. They serve no use when no one is in the room. It just seems like such a waste, however, my wife loves them as night lights.

Anyway, this sounds like a tweak of your Smart NightLight code, yet in ways different than anything else.

That one will have to go on the backlog, since I don’t need it and I’m working on a few other projects that have priority (e.g., Home on Code Unlock integration with Smart Alarm, and a new Green Smart HW Recirculator).

The Smart Security Light was on that backlog too, just felt like a good project for yesterday, since I needed it myself. Still, it might not take long to get to it.

FWIW, this is a GREAT project for someone to learn ST programming, since it’s basically (detect lack of motion, send Indicator Off command to lots of switches, detect motion, turn the indicators back on).