Override motion lights?


#1

Hello all, I hope that someone might be able to offer advice on how to solve the following use case:

I have a guest bedroom with a GE light switch hooked up to a light as well as a motion sensor. When a guest walks into the room, the GE light switch turns on the light. I then have an app that turns off the light after 5 min’s of no motion. I needed a way to override the motion sensor so if a guest was going to bed they could turn the light off at the GE light switch and motion would stop reactivating the light. I found a smart app on this board that works perfectly for this using a virtual switch, the only issue is it stops motion from turning the light on until someone manually turns the light back on at the GE switch.

What I would like to do is modify this override smartapp to include times. I only want the override to happen after dark, so I want to be able to say the override app will only function after a set time (configurable variable) and then I would want it to disable itself at another set time. So lets say a guest turned the light off manually, the smartapp would disable to motion sensor for the night…but come a set time in the morning, lets say 9AM, the app would enable motion to turn on the light again until a guest turned the light off manually again.

Any advice would be much appreciated!

Here is the code I am using currently to override motion:

definition(
name: “Override Motion Light With Button”,
namespace: “smartthings”,
author: “SmartThings”,
description: “Override Motion Light”,
category: “SmartThings Labs”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
singleInstance: true
)
preferences {
section(“When this real switch is turned off…”) {
input “realSwitch”, “capability.switch”, title: “Guest Bedroom”, required: true
}
section(“This virtual switch helper will disable motion…”) {
input “virtual”, “capability.switch”, title: “Guest Bedroom Virtual Switch”, required: true
}
}

def installed() {
initialize()
}

def updated() {
unsubscribe()
initialize()
}

def initialize() {
subscribe(virtual, “switch.on”, virtualOnHandler)
subscribe(virtual, “switch.off”, virtualOffHandler)
state.motionEnabled = true
}

def virtualOffHandler(evt) {
state.motionEnabled = realSwitch.currentSwitch == "on"
if(state.motionEnabled) realSwitch.off()
}

def virtualOnHandler(evt) {
if(state.motionEnabled) realSwitch.on()
}


(Fast, Good, Cheap...pick two.) #2

If using CoRE this is pretty easily doable.

I do this now with Alexa in fact using virtual switches for each room (Boolean can also work if you prefer)

With virtual switch I always leave them on. I then tell Alexa to turn off living room light and it turns off the light and the virtual switch.

Because the on command is only true if the virtual switch is on motion will not turn the light on until I tell Alexa to turn the lights back on.

For your use case just substitute voice command with time constraint and the is physical function (unless its a dimmer?)

There is a few ways to do this. Admittedly the virtual switch way is old school but because I already had things setup this way it made things easy for me.

Hope this helps


(Ben W) #3

I use modes to trigger switches. Once going to Night the motion activation stops and you have to manually (gag) turn off the light.

I am thinking about putting a pressure pad under the mattress to once it feels pressure it will not execute motion rules anymore.

If you have a Aeon remote, you can use that to trigger the virtual switch to turn off the lights. I keep one by my bedside.


(Bobby) #4

I use Smart Lighting and uDTHs configured for luminance to achieve the override. You can schedule times when the uDTH to flip on or off, this allows for great control, not only based on times.

Thanks @mike_maxwell …btw where is your super garage door lool


(Mike Maxwell) #5

I’m having a fit of writers block at the moment…


(Bobby) #6

Could this unleash your brain power? :slight_smile:

We are here to help when you need it :slight_smile: