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:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*
*/
definition(
name: "Close Leak Gopher Valve",
namespace: "smartthings",
author: "Chris",
description: "Turns switch off based on moisture sensor input.",
category: "Safety & Security",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Developers/dry-the-wet-spot.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Developers/dry-the-wet-spot@2x.png"
)
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() {
unsubscribe()
subscribe(sensor, "water.dry", waterHandler)
subscribe(sensor, "water.wet", waterHandler)
}
def waterHandler(evt) {
log.debug "Sensor says ${evt.value}"
if (evt.value == "wet") {
valve.off()
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 support@smartthings.com
Cheers,