SmartThings Community

Anyway to not Turn On/Off Light Connected to Switch on a Press?


(Mark Vickstrom) #1

Hello,

Does anyone know if you can stop a Z-wave switch from turning on/off the connected load when the rocker is pressed?

My situation is that I have a porch light connected to a z-wave switch and a lamp connected to a z-wave outlet. The porch light is programmed to turn on at sunset and off at sunrise so I never use the physical switch. My wife does not like the idea of using an app or schedule to turn on/off the lamp so my thought was to use the physical switch for the porch light to control the z-wave outlet for the lamp. I’ve been able to write an app similar to the Double Tap app that can turn on/off the lamp when it senses a physical press of the switch but it still toggles state for the porch light which is not desired.

Is there any way to not toggle power to the load on the z-wave switch without remembering the state programmatically then changing it back to the original state after the button is pressed?

Thanks!

def initialize() {
	subscribe(triggerSwitch,"switch",triggerSwitchPressed,[filterEvents: false])
}

def triggerSwitchPressed(evt){
	log.debug evt
	if (evt.isPhysical()) {
		if (evt.value == "on") {
			log.debug "swtich pressed On"
			switchesToControl.on()
            //would need to recall state of triggerSwitch here and flip it back to the original state
		} else if (evt.value == "off") {
        	log.debug "swtich pressed Off"
       	    switchesToControl.off()
            //would need to recall state of triggerSwitch here and flip it back to the original state
		}
	}
	else {
		log.trace "Skipping digital on/off event"
	}
}

(Barry) #2

Simple - in your new switch app, as the last thing before exiting/returning, simply turn on the porch light if it’s after sunset, and turn it off if it’s after sunrise. SUre, it will flick on/off, but you’ll have what you want!


(Chrisb) #3

Another option, if you wanted to, get a microcontroller relay for the porch light. Then “bypass” the switch for the porch light entirely. The switch would connect to no load. Then you just use the switch to turn on/off the table lamp and use the microcontroller to setup your schedule in the MobileApp.

I’ve done similar in a couple of areas were I had “dead switches.” One used to control an outdoor lamp post I think… long since gone when we bought the house. The other switch was weird… it hooked up to some lights in the back of the basement, but also happened to be the line that the door bell transformer was on. Really a strange setup… so I rewired the lines in the basement a little bit and added a switch in the basement room and took the transformer off that line. But this left a new “dead switch” by my side door. That switch now is tied up as a wireless 3-way with my back door light.


(Mark Vickstrom) #4

Thanks!

That was the logic I was looking for. I added a check for the sunset time and the porch light will sometimes change state twice but goes back to the desired state.


(Barry) #5

Happy to help, Mark!