A cool way to use zwave scenes - automatically disable motion control

(I also posted this on the inovelli message boards)

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 (switches and dimmers with scene capability) 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 touches 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.

This works with any zwave dimmer or switch that supports transmitting scenes.

Items and rules sample below (thanks to @chris for the great work on the zwave binding and @rlkoshak for the original expire DP)

zwave.items

Dimmer	    bathroomLights "Bathroom Light [%d %%]"			{channel="zwave:device:057c652b:node8:switch_dimmer"}
Number      bathroomLightsScene "Bathroom Light Scene"	    {channel="zwave:device:057c652b:node8:scene_number"}

expire.items

Switch bathroomLightsDimmerPause                       { expire="1h,command=OFF" }

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)
		}

		case "2.3": //2x tap up
		{
            //Do something
		}	


		case "1.3": //2x tap down
		{
            //Do something
		}        


	}
	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

Thanks for posting! I’ve moved this to the Tutorials and Examples: Solutions category which is more appropriate I think.

1 Like

Great post!
This part is in my opinion not necessary, when you send the command ON it’ll reset.

Ah, thanks for the feedback!

Yes, I wasn’t sure about the exact behavior of the expire binding. Will test out to see if it resets on its own

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