Feature Request: Virtual Water Sensor

Doing this on my phone - modifying a virtual motion sensor posted by @cwwilson08, so I hope it's correct. I think it is:

metadata {
	definition (name: "Virtual water sensor with Switch", namespace: "cw", author: "cwwilson08") {
		capability "Sensor"
		capability "Water Sensor"
        capability "Switch"
	}   
}

def on() {
    sendEvent(name: "water", value: "wet")
    sendEvent(name: "switch", value: "on")
}

def off() {
    sendEvent(name: "water", value: "dry")
    sendEvent(name: "switch", value: "off")
}

def installed() {
}

Edit: Tested it - it works as designed.

6 Likes