So, I have a water sensor. I have the security section in Leaks set up to turn on some lights. But, I want it to also turn off items. Mainly, I have an Intermatic CA3750 Z-Wave 220v contactor that is hooked to my pool’s pump. The pump and all equipment are indoors. I want the sensor to turn off the Intermatic switch when it detects water, so that 30gpm of water doesn’t go into the house while there’s a leak! I can’t find any way to have it turn stuff OFF, just ON.
This might help as it turns off a switch when a leak is detected. Just add a new smartapp and copy in the code below…
definition(
name: “Leak prevention”,
namespace: “Ghilen”,
author: “Trevor Williams”,
description: “Turn of switch on leak detection”,
category: “My Apps”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)
preferences {
section(“Turn off when water is detected:”) {
input “thewater”, “capability.waterSensor”, required: true, title: “Where?”
}
section(“Turn off this switch”) {
input “theswitch”, “capability.switch”, required: true
}
}
def installed() {
initialize()
}
def updated() {
unsubscribe()
initialize()
}
def initialize() {
subscribe(thewater, “water.wet”, waterDetectedHandler)
subscribe(thewater, “water.dry”, waterStoppedHandler)
}
def waterDetectedHandler(evt) {
log.debug "waterDetectedHandler called: $evt"
theswitch.off()
}
def waterStoppedHandler(evt) {
log.debug “waterStoppedHandler called: $evt”
}
Hey Trevor,
I was in a bit of a hurry to get this working, so after I did not hear anything for a day I went ahead and wrote my own code. I don’t like writing code, but can do so if pushed into the requirement. I even think I found some other code you wrote to use as an example.
So, I have it set so that anytime water is sensed in that equipment room, it turns off the pump and the salt water chlorine generator, sends an alert to both of our cell phones, and turns on the bedroom and kitchen light if it were to happen at night, it will wake me up and light my way to teh room so I can see what happened.
Hey Guys,
I was surprised this did not exist already. I just set it up and it works well. So Trevor thanks for the code and Tim for the initial ask.
Can you post your code, Tim? Would like to see it.
Thanks again.
Pat
This worked perfectly… thank you. I used it to command my Utilitech to command an outlet/plug to be turned off if rain was sensed. The only improvement would be for it to have the option of turning off multiple switches, but I didn’t mind having to create a couple different rules for this.