SmartApp for Leak Gopher Z-Wave Valve (close the valve)

Hi guys!

Some of you may have chosen to go with the Leak Gopher Z-Wave Water Valve.

I can’t speak to whether or not this device will ever see an official integration, but it does pair with the SmartThings Hub as a Z-Wave Switch. The Valve is shut if the Switch is set to “Off” and open if the Switch is set to “On”.

Here’s a SmartApp that’ll let you close your Leak Gopher Valve if one of your Moisture Sensors gets wet:

 *  Close Leak Gopher Valve
 *  Copyright 2015 SmartThings
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
    name: "Close Leak Gopher Valve",
    namespace: "smartthings",
    author: "Chris",
    description: "Turns switch off based on moisture sensor input.",
    category: "Safety & Security",
    iconUrl: "",
    iconX2Url: ""

preferences {
	section("When water is sensed...") {
		input "sensor", "capability.waterSensor", title: "Where?", required: true, multiple: true
	section("Close Leak Gopher Valve...") {
		input "valve", "capability.switch", title: "Which?", required: true
    section("Send Push Notification") {
    	input "sendPush", "bool", required: false
        	title: "Send Push Notification?"
    section("Notify via SMS (optional)") {
    	input "textMessage", "text", title: "Send this message", multiple: false, required: false
       	input("recipients", "contact", title: "Send notifications to") {
        	input "phone", "phone", title: "To this phone", multiple: false, required: false

def installed() {
	subscribe(sensor, "water.dry", waterHandler)
	subscribe(sensor, "water.wet", waterHandler)

def updated() {
	subscribe(sensor, "water.dry", waterHandler)
	subscribe(sensor, "water.wet", waterHandler)

def waterHandler(evt) {
	log.debug "Sensor says ${evt.value}"
	if (evt.value == "wet") {
        if (location.contactBookEnabled) {
            sendNotificationToContacts(textMessage ?: "A leak has been detected and your valve has been closed", recipients)
        else {
            if (phone) {
                sendSms(phone, textMessage ?: "A leak has been detected and your valve has been closed")

I hope this helps someone out there! PM me with any issues about this specific SmartApp.

If you have any unrelated questions, please make sure to direct those to



CHris, I just bought this valve and have installed it… I am going to play around with it for a bit. Seems your app does not use mode as a condition? Im not much of a coder but couldnt find a mode reference here. It would be nice to have the valve shut if a leak sensor is triggerd only when u were away and on vacation. And only a notication or alarm if u were at home. SHM does not seem to have this option either…


we’ve actually released an official integration!

You can find it in Marketplace -> Things -> Valves

Chris, I see the official integration, but it seems that you cannot set the valve to shutoff in a specific mode. For example, notify for all modes, but shut off only for away mode. It would be awesome if someone were to write that in. I’m not a coder, but can you or someone in your team add the mode dependencies? Or is there another smart app that works?


With no trouble at all I successfully paired a Fibaro FGFS-101 Flood Sensor and a “Leak Intelligence” a.k.a. Leak Gopher Z-Wave water valve. SmartThings recognized both items with no fuss.

What I can’t figure out how to do is automate the water valve so it will close when the flow sensor detects a leak.

I have other automation functions working using the SmartThings app on iPhone. To accomplish this I used a section in the app called “Smart Lighting”.

I’m not sure where to start to automate the Z-Wave of water valve.

Your answer is above…WebCoRE…do a search and it will bring up the discussion…<<

I have no idea what WebCoRE is. I ended up making it work using the SmartThings iPhone app with the following:
Smart Home Monitor > Leaks. There is a option to Close Valves. Can also alert you, turn on lights, etc.

There was an option to have the valve close if any moisture sensor detects water. I did this.

Initially, I was going to use the FGFS-101 Flood Sensor, they do not have a handler for SmartThings. I’m looking at the Aeotec Water Sensor, it DOES have a SmartThings handler.

Thank you for helping.

I appreciate that ST has an official integration. But the problem is I bought the Gopher leak system as a valve to control my pool cleaner/pool. I guess everybody “assumes” that you are using it as a leak detector. Anyway, I want it to act as a switch so I can set it to turn on and turn off on a certain schedule. But now that ST as integrated it… it only shows up as a valve in the ST app… with no smart apps to control it other than in security using it with a “water detector”… this sucks. If I exclude it and then put your code in as a device handler will it join as a “switch” so I can schedule it ? or will it ignore the device handler and go to the same state?

Dude! I understand that you are some sycophant for “Webcore” but stop trolling and get a life. When I google webcore here is the first page I find in ST community:
"CoRE (now WebCore) is a very powerful community – created rules engine for SmartThings. It allows you to set up stacked conditionals like “If A then B but only while C and not if D.”

Setting it up can be quite complex, but there are many community members who will be glad to help you."

Ok, if doing what I asked above works, it would be a lot easier than learning a whole new “quite complex” interface to do one task!! … Can you answer my original question? if not bugger off …