A cool way to use scenes - automatically disable motion control (openHAB)

Anyone who’s been in home automation for a while quickly learns some of the common limitations.

A good example of a common problem is the inability to quickly and temporarily disable motion-activated lights in a user-friendly way (i.e. disable motion lighting when someone manually turns the switch on/off). Before switches with scene capability existed, one of the only ways to solve this would have been to use a complex set of proxy items and logic.

Now that I’ve been using inovelli’s for a while, I’ve adjusted my openHAB rules to use the expire binding and trigger an “automation pause” timer for that room whenever someone pushes a switch manually. In this example, pushing the switch either on or off will create a timer for 1 hour. The lighting rules check if the timer is running or not. If not, proceed with usual automation.

Sample below (pardon the hard to read formatting. this message board strips everything out). This sample is written for openHAB, but the same concept should be applicable to any hub.

expire.items

Switch bathroomLightsDimmerPause { expire=“1h,command=OFF” } //requires expire binding

scenes.rules

rule “Bathroom Light Scenes”
when
Item bathroomLightsScene changed
then

val String bathroomscene = bathroomLightsScene.state.toString

switch bathroomscene {
case “2.0”: //1x tap up
{
bathroomLights.sendCommand(100)
//check existing timer
if(bathroomLightsDimmerPause.state == ON) {
// cancel existing Timer
bathroomLightsDimmerPause.postUpdate(OFF)
}
//Start timer to disable auto lights
bathroomLightsDimmerPause.sendCommand(ON)
}
case “1.0”: //1x tap down
{
bathroomLights.sendCommand(0)
//check existing timer
if(bathroomLightsDimmerPause.state == ON) {
// cancel existing Timer
bathroomLightsDimmerPause.postUpdate(OFF)
}
//Start timer to disable auto lights
bathroomLightsDimmerPause.sendCommand(ON)
}
}
bathroomLightsScene.sendCommand(99) //reset to neutral
end

rule “Bathroom Lights ON”
when
Item bathroomMotionSensor changed to OPEN
then
if (bathroomLightsDimmerPause.state!=ON) {
bathroomLights.sendCommand(100)
}
end

2 Likes

I know this post is about a year old, but I do something very similar in Home Assistant.

For each room where I have motion-controlled lights, I create a “Toggle” helper, which is basically a configuration setting that can be controlled from the dashboard. This is the “auto-off enabled” toggle.

I have a rule set up so that when motion ceases, if auto-off is enabled, the light turns off.

To disable the motion control, you just have to double-tap “on”. This sends a scene command that disables the auto-off toggle. (I went with double-tap, but single would work too)

A single tap of the “off” button re-enables auto-off.

Finally, there’s an automation that re-enables the auto-off once no motion has been detected for 2 hours.

This works really nicely, especially for areas like the basement where or garage where the motion detectors have blind spots and where it gets really dark if the lights suddenly turn off. A double-tap when entering the area will leave the lights on for at least two hours (unless turned off manually), and even intermittently-detected motion will reset the 2-hour timeout.

And as an added bonus, I can also control the auto-off settings from my dashboard, providing an extra layer of control beyond the local switch.

1 Like