mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-26 21:04:08 +00:00
Compare commits
1 Commits
MSA-2112-2
...
MSA-2118-8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ca07ce9db |
@@ -1,439 +0,0 @@
|
|||||||
/**
|
|
||||||
* FortrezZ Flow Meter Interface
|
|
||||||
*
|
|
||||||
* Copyright 2016 FortrezZ, LLC
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
metadata {
|
|
||||||
definition (name: "FortrezZ Flow Meter Interface", namespace: "fortrezz", author: "Daniel Kurin") {
|
|
||||||
capability "Battery"
|
|
||||||
capability "Energy Meter"
|
|
||||||
capability "Image Capture"
|
|
||||||
capability "Temperature Measurement"
|
|
||||||
capability "Sensor"
|
|
||||||
capability "Water Sensor"
|
|
||||||
|
|
||||||
attribute "gpm", "number"
|
|
||||||
attribute "cumulative", "number"
|
|
||||||
attribute "alarmState", "string"
|
|
||||||
attribute "chartMode", "string"
|
|
||||||
attribute "lastThreshhold", "number"
|
|
||||||
|
|
||||||
|
|
||||||
command "chartMode"
|
|
||||||
command "zero"
|
|
||||||
command "setHighFlowLevel", ["number"]
|
|
||||||
|
|
||||||
fingerprint deviceId: "0x2101", inClusters: "0x5E, 0x86, 0x72, 0x5A, 0x73, 0x71, 0x85, 0x59, 0x32, 0x31, 0x70, 0x80, 0x7A"
|
|
||||||
}
|
|
||||||
|
|
||||||
simulator {
|
|
||||||
// TODO: define status and reply messages here
|
|
||||||
}
|
|
||||||
|
|
||||||
preferences {
|
|
||||||
input "gallonThreshhold", "decimal", title: "High Flow Rate Threshhold", description: "Flow rate (in gpm) that will trigger a notification.", defaultValue: 5, required: false, displayDuringSetup: true
|
|
||||||
input("registerEmail", type: "email", required: false, title: "Email Address", description: "Register your device with FortrezZ", displayDuringSetup: true)
|
|
||||||
}
|
|
||||||
|
|
||||||
tiles(scale: 2) {
|
|
||||||
carouselTile("flowHistory", "device.image", width: 6, height: 3) { }
|
|
||||||
valueTile("battery", "device.battery", inactiveLabel: false, width: 2, height: 2) {
|
|
||||||
state "battery", label:'${currentValue}%\nBattery', unit:""
|
|
||||||
}
|
|
||||||
valueTile("temperature", "device.temperature", width: 2, height: 2) {
|
|
||||||
state("temperature", label:'${currentValue}°',
|
|
||||||
backgroundColors:[
|
|
||||||
[value: 31, color: "#153591"],
|
|
||||||
[value: 44, color: "#1e9cbb"],
|
|
||||||
[value: 59, color: "#90d2a7"],
|
|
||||||
[value: 74, color: "#44b621"],
|
|
||||||
[value: 84, color: "#f1d801"],
|
|
||||||
[value: 95, color: "#d04e00"],
|
|
||||||
[value: 96, color: "#bc2323"]
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
valueTile("gpm", "device.gpm", inactiveLabel: false, width: 2, height: 2) {
|
|
||||||
state "gpm", label:'${currentValue}gpm', unit:""
|
|
||||||
}
|
|
||||||
standardTile("powerState", "device.powerState", width: 2, height: 2) {
|
|
||||||
state "reconnected", icon:"http://swiftlet.technology/wp-content/uploads/2016/02/Connected-64.png", backgroundColor:"#cccccc"
|
|
||||||
state "disconnected", icon:"http://swiftlet.technology/wp-content/uploads/2016/02/Disconnected-64.png", backgroundColor:"#cc0000"
|
|
||||||
state "batteryReplaced", icon:"http://swiftlet.technology/wp-content/uploads/2016/04/Full-Battery-96.png", backgroundColor:"#cccccc"
|
|
||||||
state "noBattery", icon:"http://swiftlet.technology/wp-content/uploads/2016/04/No-Battery-96.png", backgroundColor:"#cc0000"
|
|
||||||
}
|
|
||||||
standardTile("waterState", "device.waterState", width: 2, height: 2, canChangeIcon: true) {
|
|
||||||
state "none", icon:"http://cdn.device-icons.smartthings.com/Weather/weather12-icn@2x.png", backgroundColor:"#cccccc", label: "No Flow"
|
|
||||||
state "flow", icon:"http://cdn.device-icons.smartthings.com/Weather/weather12-icn@2x.png", backgroundColor:"#53a7c0", label: "Flow"
|
|
||||||
state "overflow", icon:"http://cdn.device-icons.smartthings.com/Weather/weather12-icn@2x.png", backgroundColor:"#cc0000", label: "High Flow"
|
|
||||||
}
|
|
||||||
standardTile("heatState", "device.heatState", width: 2, height: 2) {
|
|
||||||
state "normal", label:'Normal', icon:"st.alarm.temperature.normal", backgroundColor:"#ffffff"
|
|
||||||
state "freezing", label:'Freezing', icon:"st.alarm.temperature.freeze", backgroundColor:"#2eb82e"
|
|
||||||
state "overheated", label:'Overheated', icon:"st.alarm.temperature.overheat", backgroundColor:"#F80000"
|
|
||||||
}
|
|
||||||
standardTile("take1", "device.image", width: 2, height: 2, canChangeIcon: false, inactiveLabel: true, canChangeBackground: false, decoration: "flat") {
|
|
||||||
state "take", label: "", action: "Image Capture.take", nextState:"taking", icon: "st.secondary.refresh"
|
|
||||||
}
|
|
||||||
standardTile("chartMode", "device.chartMode", width: 2, height: 2, canChangeIcon: false, canChangeBackground: false, decoration: "flat") {
|
|
||||||
state "day", label:'24 Hours\n(press to change)', nextState: "week", action: 'chartMode'
|
|
||||||
state "week", label:'7 Days\n(press to change)', nextState: "month", action: 'chartMode'
|
|
||||||
state "month", label:'4 Weeks\n(press to change)', nextState: "day", action: 'chartMode'
|
|
||||||
}
|
|
||||||
valueTile("zeroTile", "device.zero", width: 2, height: 2, canChangeIcon: false, canChangeBackground: false, decoration: "flat") {
|
|
||||||
state "zero", label:'Zero', action: 'zero'
|
|
||||||
}
|
|
||||||
main (["waterState"])
|
|
||||||
details(["flowHistory", "chartMode", "take1", "temperature", "gpm", "waterState", "battery"])
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse events into attributes
|
|
||||||
def parse(String description) {
|
|
||||||
def results = []
|
|
||||||
if (description.startsWith("Err")) {
|
|
||||||
results << createEvent(descriptionText:description, displayed:true)
|
|
||||||
} else {
|
|
||||||
def cmd = zwave.parse(description, [ 0x80: 1, 0x84: 1, 0x71: 2, 0x72: 1 ])
|
|
||||||
if (cmd) {
|
|
||||||
results << createEvent( zwaveEvent(cmd) )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//log.debug "\"$description\" parsed to ${results.inspect()}"
|
|
||||||
if(gallonThreshhold != device.currentValue("lastThreshhold"))
|
|
||||||
{
|
|
||||||
results << setThreshhold(gallonThreshhold)
|
|
||||||
}
|
|
||||||
log.debug "zwave parsed to ${results.inspect()}"
|
|
||||||
return results
|
|
||||||
}
|
|
||||||
|
|
||||||
def updated()
|
|
||||||
{
|
|
||||||
log.debug("Updated")
|
|
||||||
}
|
|
||||||
|
|
||||||
def setHighFlowLevel(level)
|
|
||||||
{
|
|
||||||
setThreshhold(level)
|
|
||||||
}
|
|
||||||
|
|
||||||
def take() {
|
|
||||||
def mode = device.currentValue("chartMode")
|
|
||||||
if(mode == "day")
|
|
||||||
{
|
|
||||||
take1()
|
|
||||||
}
|
|
||||||
else if(mode == "week")
|
|
||||||
{
|
|
||||||
take7()
|
|
||||||
}
|
|
||||||
else if(mode == "month")
|
|
||||||
{
|
|
||||||
take28()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def chartMode(string) {
|
|
||||||
log.debug("ChartMode")
|
|
||||||
def state = device.currentValue("chartMode")
|
|
||||||
def tempValue = ""
|
|
||||||
switch(state)
|
|
||||||
{
|
|
||||||
case "day":
|
|
||||||
tempValue = "week"
|
|
||||||
break
|
|
||||||
|
|
||||||
case "week":
|
|
||||||
tempValue = "month"
|
|
||||||
break
|
|
||||||
|
|
||||||
case "month":
|
|
||||||
tempValue = "day"
|
|
||||||
break
|
|
||||||
|
|
||||||
default:
|
|
||||||
tempValue = "day"
|
|
||||||
break
|
|
||||||
}
|
|
||||||
sendEvent(name: "chartMode", value: tempValue)
|
|
||||||
take()
|
|
||||||
}
|
|
||||||
|
|
||||||
def take1() {
|
|
||||||
api("24hrs", "") {
|
|
||||||
log.debug("Image captured")
|
|
||||||
|
|
||||||
if(it.headers.'Content-Type'.contains("image/png")) {
|
|
||||||
if(it.data) {
|
|
||||||
storeImage(getPictureName("24hrs"), it.data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def take7() {
|
|
||||||
api("7days", "") {
|
|
||||||
log.debug("Image captured")
|
|
||||||
|
|
||||||
if(it.headers.'Content-Type'.contains("image/png")) {
|
|
||||||
if(it.data) {
|
|
||||||
storeImage(getPictureName("7days"), it.data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def take28() {
|
|
||||||
api("4weeks", "") {
|
|
||||||
log.debug("Image captured")
|
|
||||||
|
|
||||||
if(it.headers.'Content-Type'.contains("image/png")) {
|
|
||||||
if(it.data) {
|
|
||||||
storeImage(getPictureName("4weeks"), it.data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def zero()
|
|
||||||
{
|
|
||||||
delayBetween([
|
|
||||||
zwave.meterV3.meterReset().format(),
|
|
||||||
zwave.meterV3.meterGet().format(),
|
|
||||||
zwave.firmwareUpdateMdV2.firmwareMdGet().format(),
|
|
||||||
], 100)
|
|
||||||
}
|
|
||||||
|
|
||||||
def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv5.SensorMultilevelReport cmd)
|
|
||||||
{
|
|
||||||
log.debug cmd
|
|
||||||
def map = [:]
|
|
||||||
if(cmd.sensorType == 1) {
|
|
||||||
map = [name: "temperature"]
|
|
||||||
if(cmd.scale == 0) {
|
|
||||||
map.value = getTemperature(cmd.scaledSensorValue)
|
|
||||||
} else {
|
|
||||||
map.value = cmd.scaledSensorValue
|
|
||||||
}
|
|
||||||
map.unit = location.temperatureScale
|
|
||||||
} /* else if(cmd.sensorType == 2) {
|
|
||||||
map = [name: "waterState"]
|
|
||||||
if(cmd.sensorValue[0] == 0x80) {
|
|
||||||
map.value = "flow"
|
|
||||||
sendEvent(name: "water", value: "dry")
|
|
||||||
} else if(cmd.sensorValue[0] == 0x00) {
|
|
||||||
map.value = "none"
|
|
||||||
sendEvent(name: "water", value: "dry")
|
|
||||||
} else if(cmd.sensorValue[0] == 0xFF) {
|
|
||||||
map.value = "overflow"
|
|
||||||
sendEvent(name: "water", value: "wet")
|
|
||||||
sendAlarm("waterOverflow")
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
return map
|
|
||||||
}
|
|
||||||
|
|
||||||
def zwaveEvent(physicalgraph.zwave.commands.meterv3.MeterReport cmd)
|
|
||||||
{
|
|
||||||
def map = [:]
|
|
||||||
map.name = "gpm"
|
|
||||||
def delta = cmd.scaledMeterValue - cmd.scaledPreviousMeterValue
|
|
||||||
if (delta < 0 || delta > 10000) {
|
|
||||||
log.error(cmd)
|
|
||||||
delta = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
map.value = delta
|
|
||||||
map.unit = "gpm"
|
|
||||||
sendDataToCloud(delta)
|
|
||||||
sendEvent(name: "cumulative", value: cmd.scaledMeterValue, displayed: false, unit: "gal")
|
|
||||||
return map
|
|
||||||
}
|
|
||||||
|
|
||||||
def zwaveEvent(physicalgraph.zwave.commands.alarmv2.AlarmReport cmd)
|
|
||||||
{
|
|
||||||
def map = [:]
|
|
||||||
if (cmd.zwaveAlarmType == 8) // Power Alarm
|
|
||||||
{
|
|
||||||
map.name = "powerState" // For Tile (shows in "Recently")
|
|
||||||
if (cmd.zwaveAlarmEvent == 2) // AC Mains Disconnected
|
|
||||||
{
|
|
||||||
map.value = "disconnected"
|
|
||||||
sendAlarm("acMainsDisconnected")
|
|
||||||
}
|
|
||||||
else if (cmd.zwaveAlarmEvent == 3) // AC Mains Reconnected
|
|
||||||
{
|
|
||||||
map.value = "reconnected"
|
|
||||||
sendAlarm("acMainsReconnected")
|
|
||||||
}
|
|
||||||
else if (cmd.zwaveAlarmEvent == 0x0B) // Replace Battery Now
|
|
||||||
{
|
|
||||||
map.value = "noBattery"
|
|
||||||
sendAlarm("replaceBatteryNow")
|
|
||||||
}
|
|
||||||
else if (cmd.zwaveAlarmEvent == 0x00) // Battery Replaced
|
|
||||||
{
|
|
||||||
map.value = "batteryReplaced"
|
|
||||||
sendAlarm("batteryReplaced")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (cmd.zwaveAlarmType == 4) // Heat Alarm
|
|
||||||
{
|
|
||||||
map.name = "heatState"
|
|
||||||
if (cmd.zwaveAlarmEvent == 0) // Normal
|
|
||||||
{
|
|
||||||
map.value = "normal"
|
|
||||||
}
|
|
||||||
else if (cmd.zwaveAlarmEvent == 1) // Overheat
|
|
||||||
{
|
|
||||||
map.value = "overheated"
|
|
||||||
sendAlarm("tempOverheated")
|
|
||||||
}
|
|
||||||
else if (cmd.zwaveAlarmEvent == 5) // Underheat
|
|
||||||
{
|
|
||||||
map.value = "freezing"
|
|
||||||
sendAlarm("tempFreezing")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (cmd.zwaveAlarmType == 5) // Water Alarm
|
|
||||||
{
|
|
||||||
map.name = "waterState"
|
|
||||||
if (cmd.zwaveAlarmEvent == 0) // Normal
|
|
||||||
{
|
|
||||||
map.value = "none"
|
|
||||||
sendEvent(name: "water", value: "dry")
|
|
||||||
}
|
|
||||||
else if (cmd.zwaveAlarmEvent == 6) // Flow Detected
|
|
||||||
{
|
|
||||||
if(cmd.eventParameter[0] == 2)
|
|
||||||
{
|
|
||||||
map.value = "flow"
|
|
||||||
sendEvent(name: "water", value: "dry")
|
|
||||||
}
|
|
||||||
else if(cmd.eventParameter[0] == 3)
|
|
||||||
{
|
|
||||||
map.value = "overflow"
|
|
||||||
sendAlarm("waterOverflow")
|
|
||||||
sendEvent(name: "water", value: "wet")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//log.debug "alarmV2: $cmd"
|
|
||||||
|
|
||||||
return map
|
|
||||||
}
|
|
||||||
|
|
||||||
def zwaveEvent(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
|
|
||||||
def map = [:]
|
|
||||||
if(cmd.batteryLevel == 0xFF) {
|
|
||||||
map.name = "battery"
|
|
||||||
map.value = 1
|
|
||||||
map.descriptionText = "${device.displayName} has a low battery"
|
|
||||||
map.displayed = true
|
|
||||||
} else {
|
|
||||||
map.name = "battery"
|
|
||||||
map.value = cmd.batteryLevel > 0 ? cmd.batteryLevel.toString() : 1
|
|
||||||
map.unit = "%"
|
|
||||||
map.displayed = false
|
|
||||||
}
|
|
||||||
return map
|
|
||||||
}
|
|
||||||
|
|
||||||
def zwaveEvent(physicalgraph.zwave.Command cmd)
|
|
||||||
{
|
|
||||||
log.debug "COMMAND CLASS: $cmd"
|
|
||||||
}
|
|
||||||
|
|
||||||
def sendDataToCloud(double data)
|
|
||||||
{
|
|
||||||
def params = [
|
|
||||||
uri: "https://iot.swiftlet.technology",
|
|
||||||
path: "/fortrezz/post.php",
|
|
||||||
body: [
|
|
||||||
id: device.id,
|
|
||||||
value: data,
|
|
||||||
email: registerEmail
|
|
||||||
]
|
|
||||||
]
|
|
||||||
|
|
||||||
//log.debug("POST parameters: ${params}")
|
|
||||||
try {
|
|
||||||
httpPostJson(params) { resp ->
|
|
||||||
resp.headers.each {
|
|
||||||
//log.debug "${it.name} : ${it.value}"
|
|
||||||
}
|
|
||||||
log.debug "sendDataToCloud query response: ${resp.data}"
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
log.debug "something went wrong: $e"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def getTemperature(value) {
|
|
||||||
if(location.temperatureScale == "C"){
|
|
||||||
return value
|
|
||||||
} else {
|
|
||||||
return Math.round(celsiusToFahrenheit(value))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private getPictureName(category) {
|
|
||||||
//def pictureUuid = device.id.toString().replaceAll('-', '')
|
|
||||||
def pictureUuid = java.util.UUID.randomUUID().toString().replaceAll('-', '')
|
|
||||||
|
|
||||||
def name = "image" + "_$pictureUuid" + "_" + category + ".png"
|
|
||||||
return name
|
|
||||||
}
|
|
||||||
|
|
||||||
def api(method, args = [], success = {}) {
|
|
||||||
def methods = [
|
|
||||||
//"snapshot": [uri: "http://${ip}:${port}/snapshot.cgi${login()}&${args}", type: "post"],
|
|
||||||
"24hrs": [uri: "https://iot.swiftlet.technology/fortrezz/chart.php?uuid=${device.id}&tz=${location.timeZone.ID}&type=1", type: "get"],
|
|
||||||
"7days": [uri: "https://iot.swiftlet.technology/fortrezz/chart.php?uuid=${device.id}&tz=${location.timeZone.ID}&type=2", type: "get"],
|
|
||||||
"4weeks": [uri: "https://iot.swiftlet.technology/fortrezz/chart.php?uuid=${device.id}&tz=${location.timeZone.ID}&type=3", type: "get"],
|
|
||||||
]
|
|
||||||
|
|
||||||
def request = methods.getAt(method)
|
|
||||||
|
|
||||||
return doRequest(request.uri, request.type, success)
|
|
||||||
}
|
|
||||||
|
|
||||||
private doRequest(uri, type, success) {
|
|
||||||
log.debug(uri)
|
|
||||||
|
|
||||||
if(type == "post") {
|
|
||||||
httpPost(uri , "", success)
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(type == "get") {
|
|
||||||
httpGet(uri, success)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def sendAlarm(text)
|
|
||||||
{
|
|
||||||
sendEvent(name: "alarmState", value: text, descriptionText: text, displayed: false)
|
|
||||||
}
|
|
||||||
|
|
||||||
def setThreshhold(rate)
|
|
||||||
{
|
|
||||||
log.debug "Setting Threshhold to ${rate}"
|
|
||||||
|
|
||||||
def event = createEvent(name: "lastThreshhold", value: rate, displayed: false)
|
|
||||||
def cmds = []
|
|
||||||
cmds << zwave.configurationV2.configurationSet(configurationValue: [(int)Math.round(rate*10)], parameterNumber: 5, size: 1).format()
|
|
||||||
sendEvent(event)
|
|
||||||
return response(cmds) // return a list containing the event and the result of response()
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,320 @@
|
|||||||
|
/**
|
||||||
|
* Leak Detector for FortrezZ Water Meter
|
||||||
|
*
|
||||||
|
* Copyright 2016 Daniel Kurin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
definition(
|
||||||
|
name: "FortrezZ Leak Detector",
|
||||||
|
namespace: "fortrezz",
|
||||||
|
author: "FortrezZ, LLC",
|
||||||
|
description: "Use the FortrezZ Water Meter to identify leaks in your home's water system.",
|
||||||
|
category: "Green Living",
|
||||||
|
iconUrl: "http://swiftlet.technology/wp-content/uploads/2016/05/logo-square-200-1.png",
|
||||||
|
iconX2Url: "http://swiftlet.technology/wp-content/uploads/2016/05/logo-square-500.png",
|
||||||
|
iconX3Url: "http://swiftlet.technology/wp-content/uploads/2016/05/logo-square.png")
|
||||||
|
|
||||||
|
|
||||||
|
preferences {
|
||||||
|
page(name: "page2", title: "Select device and actions", install: true, uninstall: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
def page2() {
|
||||||
|
dynamicPage(name: "page2") {
|
||||||
|
section("Choose a water meter to monitor:") {
|
||||||
|
input(name: "meter", type: "capability.energyMeter", title: "Water Meter", description: null, required: true, submitOnChange: true)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (meter) {
|
||||||
|
section {
|
||||||
|
app(name: "childRules", appName: "Leak Detector", namespace: "fortrezz", title: "Create New Leak Detector...", multiple: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
section("Send notifications through...") {
|
||||||
|
input(name: "pushNotification", type: "bool", title: "SmartThings App", required: false)
|
||||||
|
input(name: "smsNotification", type: "bool", title: "Text Message (SMS)", submitOnChange: true, required: false)
|
||||||
|
if (smsNotification)
|
||||||
|
{
|
||||||
|
input(name: "phone", type: "phone", title: "Phone number?", required: true)
|
||||||
|
}
|
||||||
|
input(name: "minutesBetweenNotifications", type: "number", title: "Minutes between notifications", required: true, defaultValue: 60)
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug "there are ${childApps.size()} child smartapps"
|
||||||
|
def childRules = []
|
||||||
|
childApps.each {child ->
|
||||||
|
//log.debug "child ${child.id}: ${child.settings()}"
|
||||||
|
childRules << [id: child.id, rules: child.settings()]
|
||||||
|
}
|
||||||
|
state.rules = childRules
|
||||||
|
//log.debug("Child Rules: ${state.rules} w/ length ${state.rules.toString().length()}")
|
||||||
|
log.debug "Parent Settings: ${settings}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
log.debug "Installed with settings: ${settings}"
|
||||||
|
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "Updated with settings: ${settings}"
|
||||||
|
|
||||||
|
unsubscribe()
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
|
subscribe(meter, "cumulative", cumulativeHandler)
|
||||||
|
subscribe(meter, "gpm", gpmHandler)
|
||||||
|
log.debug("Subscribing to events")
|
||||||
|
}
|
||||||
|
|
||||||
|
def cumulativeHandler(evt) {
|
||||||
|
//Date Stuff
|
||||||
|
def daysOfTheWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
||||||
|
def today = new Date()
|
||||||
|
today.clearTime()
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
c.setTime(today);
|
||||||
|
int dow = c.get(Calendar.DAY_OF_WEEK);
|
||||||
|
def dowName = daysOfTheWeek[dow-1]
|
||||||
|
|
||||||
|
def gpm = meter.latestValue("gpm")
|
||||||
|
def cumulative = new BigDecimal(evt.value)
|
||||||
|
log.debug "Cumulative Handler: [gpm: ${gpm}, cumulative: ${cumulative}]"
|
||||||
|
def rules = state.rules
|
||||||
|
rules.each { it ->
|
||||||
|
def r = it.rules
|
||||||
|
def childAppID = it.id
|
||||||
|
//log.debug("Rule: ${r}")
|
||||||
|
switch (r.type) {
|
||||||
|
case "Mode":
|
||||||
|
log.debug("Mode Test: ${location.currentMode} in ${r.modes}... ${findIn(r.modes, location.currentMode)}")
|
||||||
|
if (findIn(r.modes, location.currentMode))
|
||||||
|
{
|
||||||
|
log.debug("Threshold:${r.gpm}, Value:${gpm}")
|
||||||
|
if(gpm > r.gpm)
|
||||||
|
{
|
||||||
|
sendNotification(childAppID, gpm)
|
||||||
|
if(r.dev)
|
||||||
|
{
|
||||||
|
//log.debug("Child App: ${childAppID}")
|
||||||
|
def activityApp = getChildById(childAppID)
|
||||||
|
activityApp.devAction(r.command)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case "Time Period":
|
||||||
|
log.debug("Time Period Test: ${r}")
|
||||||
|
def boolTime = timeOfDayIsBetween(r.startTime, r.endTime, new Date(), location.timeZone)
|
||||||
|
def boolDay = !r.days || findIn(r.days, dowName) // Truth Table of this mess: http://swiftlet.technology/wp-content/uploads/2016/05/IMG_20160523_150600.jpg
|
||||||
|
def boolMode = !r.modes || findIn(r.modes, location.currentMode)
|
||||||
|
|
||||||
|
if(boolTime && boolDay && boolMode)
|
||||||
|
{
|
||||||
|
if(gpm > r.gpm)
|
||||||
|
{
|
||||||
|
sendNotification(childAppID, gpm)
|
||||||
|
if(r.dev)
|
||||||
|
{
|
||||||
|
def activityApp = getChildById(childAppID)
|
||||||
|
activityApp.devAction(r.command)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case "Accumulated Flow":
|
||||||
|
log.debug("Accumulated Flow Test: ${r}")
|
||||||
|
def boolTime = timeOfDayIsBetween(r.startTime, r.endTime, new Date(), location.timeZone)
|
||||||
|
def boolDay = !r.days || findIn(r.days, dowName) // Truth Table of this mess: http://swiftlet.technology/wp-content/uploads/2016/05/IMG_20160523_150600.jpg
|
||||||
|
def boolMode = !r.modes || findIn(r.modes, location.currentMode)
|
||||||
|
|
||||||
|
if(boolTime && boolDay && boolMode)
|
||||||
|
{
|
||||||
|
def delta = 0
|
||||||
|
if(state["accHistory${childAppID}"] != null)
|
||||||
|
{
|
||||||
|
delta = cumulative - state["accHistory${childAppID}"]
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state["accHistory${childAppID}"] = cumulative
|
||||||
|
}
|
||||||
|
log.debug("Currently in specified time, delta from beginning of time period: ${delta}")
|
||||||
|
|
||||||
|
if(delta > r.gallons)
|
||||||
|
{
|
||||||
|
sendNotification(childAppID, delta)
|
||||||
|
if(r.dev)
|
||||||
|
{
|
||||||
|
def activityApp = getChildById(childAppID)
|
||||||
|
activityApp.devAction(r.command)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log.debug("Outside specified time, saving value")
|
||||||
|
state["accHistory${childAppID}"] = cumulative
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case "Continuous Flow":
|
||||||
|
log.debug("Continuous Flow Test: ${r}")
|
||||||
|
def contMinutes = 0
|
||||||
|
def boolMode = !r.modes || findIn(r.modes, location.currentMode)
|
||||||
|
|
||||||
|
if(gpm != 0)
|
||||||
|
{
|
||||||
|
if(state["contHistory${childAppID}"] == [])
|
||||||
|
{
|
||||||
|
state["contHistory${childAppID}"] = new Date()
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//def td = now() - Date.parse("yyyy-MM-dd'T'HH:mm:ss'Z'", state["contHistory${childAppID}"]).getTime()
|
||||||
|
//log.debug(state["contHistory${childAppID}"])
|
||||||
|
//def historyDate = new Date(state["contHistory${childAppID}"])
|
||||||
|
def historyDate = new Date().parse("yyyy-MM-dd'T'HH:mm:ssZ", state["contHistory${childAppID}"])
|
||||||
|
def td = now() - historyDate.getTime()
|
||||||
|
//log.debug("Now minus then: ${td}")
|
||||||
|
contMinutes = td/60000
|
||||||
|
log.debug("Minutes of constant flow: ${contMinutes}, since ${state["contHistory${childAppID}"]}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(contMinutes > r.flowMinutes && boolMode)
|
||||||
|
{
|
||||||
|
sendNotification(childAppID, Math.round(contMinutes))
|
||||||
|
if(r.dev)
|
||||||
|
{
|
||||||
|
def activityApp = getChildById(childAppID)
|
||||||
|
activityApp.devAction(r.command)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case "Water Valve Status":
|
||||||
|
log.debug("Water Valve Test: ${r}")
|
||||||
|
def child = getChildById(childAppID)
|
||||||
|
//log.debug("Water Valve Child App: ${child.id}")
|
||||||
|
if(child.isValveStatus(r.valveStatus))
|
||||||
|
{
|
||||||
|
if(gpm > r.gpm)
|
||||||
|
{
|
||||||
|
sendNotification(childAppID, gpm)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case "Switch Status":
|
||||||
|
break
|
||||||
|
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def gpmHandler(evt) {
|
||||||
|
//Date Stuff
|
||||||
|
def daysOfTheWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
||||||
|
def today = new Date()
|
||||||
|
today.clearTime()
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
c.setTime(today);
|
||||||
|
int dow = c.get(Calendar.DAY_OF_WEEK);
|
||||||
|
def dowName = daysOfTheWeek[dow-1]
|
||||||
|
|
||||||
|
def gpm = evt.value
|
||||||
|
def cumulative = meter.latestValue("cumulative")
|
||||||
|
log.debug "GPM Handler: [gpm: ${gpm}, cumulative: ${cumulative}]"
|
||||||
|
def rules = state.rules
|
||||||
|
rules.each { it ->
|
||||||
|
def r = it.rules
|
||||||
|
def childAppID = it.id
|
||||||
|
switch (r.type) {
|
||||||
|
|
||||||
|
// This is down here because "cumulative" never gets sent in the case of 0 change between messages
|
||||||
|
case "Continuous Flow":
|
||||||
|
log.debug("Continuous Flow Test (GPM): ${r}")
|
||||||
|
def contMinutes = 0
|
||||||
|
|
||||||
|
if(gpm == "0.0")
|
||||||
|
{
|
||||||
|
state["contHistory${childAppID}"] = []
|
||||||
|
}
|
||||||
|
//log.debug("contHistory${childAppID} is ${state["contHistory${childAppID}"]}")
|
||||||
|
break
|
||||||
|
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
def sendNotification(device, gpm)
|
||||||
|
{
|
||||||
|
def set = getChildById(device).settings()
|
||||||
|
def msg = ""
|
||||||
|
if(set.type == "Accumulated Flow")
|
||||||
|
{
|
||||||
|
msg = "Water Flow Warning: \"${set.ruleName}\" is over threshold at ${gpm} gallons"
|
||||||
|
}
|
||||||
|
else if(set.type == "Continuous Flow")
|
||||||
|
{
|
||||||
|
msg = "Water Flow Warning: \"${set.ruleName}\" is over threshold at ${gpm} minutes"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg = "Water Flow Warning: \"${set.ruleName}\" is over threshold at ${gpm}gpm"
|
||||||
|
}
|
||||||
|
log.debug(msg)
|
||||||
|
|
||||||
|
// Only send notifications as often as the user specifies
|
||||||
|
def lastNotification = 0
|
||||||
|
if(state["notificationHistory${device}"])
|
||||||
|
{
|
||||||
|
lastNotification = Date.parse("yyyy-MM-dd'T'HH:mm:ssZ", state["notificationHistory${device}"]).getTime()
|
||||||
|
}
|
||||||
|
def td = now() - lastNotification
|
||||||
|
log.debug("Last Notification at ${state["notificationHistory${device}"]}... ${td/(60*1000)} minutes")
|
||||||
|
if(td/(60*1000) > minutesBetweenNotifications.value)
|
||||||
|
{
|
||||||
|
log.debug("Sending Notification")
|
||||||
|
if (pushNotification)
|
||||||
|
{
|
||||||
|
sendPush(msg)
|
||||||
|
state["notificationHistory${device}"] = new Date()
|
||||||
|
}
|
||||||
|
if (smsNotification)
|
||||||
|
{
|
||||||
|
sendSms(phone, msg)
|
||||||
|
state["notificationHistory${device}"] = new Date()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getChildById(app)
|
||||||
|
{
|
||||||
|
return childApps.find{ it.id == app }
|
||||||
|
}
|
||||||
|
|
||||||
|
def findIn(haystack, needle)
|
||||||
|
{
|
||||||
|
def result = false
|
||||||
|
haystack.each { it ->
|
||||||
|
//log.debug("findIn: ${it} <- ${needle}")
|
||||||
|
if (needle == it)
|
||||||
|
{
|
||||||
|
//log.debug("Found needle in haystack")
|
||||||
|
result = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
243
smartapps/fortrezz/leak-detector.src/leak-detector.groovy
Normal file
243
smartapps/fortrezz/leak-detector.src/leak-detector.groovy
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
/**
|
||||||
|
* Leak Detector
|
||||||
|
*
|
||||||
|
* Copyright 2016 Daniel Kurin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
definition(
|
||||||
|
name: "Leak Detector",
|
||||||
|
namespace: "fortrezz",
|
||||||
|
author: "FortrezZ, LLC",
|
||||||
|
description: "Child SmartApp for leak detector rules",
|
||||||
|
category: "Green Living",
|
||||||
|
parent: "fortrezz:FortrezZ Leak Detector",
|
||||||
|
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 {
|
||||||
|
page(name: "prefsPage", title: "Choose the detector behavior", install: true, uninstall: true)
|
||||||
|
|
||||||
|
// Do something here like update a message on the screen,
|
||||||
|
// or introduce more inputs. submitOnChange will refresh
|
||||||
|
// the page and allow the user to see the changes immediately.
|
||||||
|
// For example, you could prompt for the level of the dimmers
|
||||||
|
// if dimmers have been selected:
|
||||||
|
//log.debug "Child Settings: ${settings}"
|
||||||
|
}
|
||||||
|
|
||||||
|
def prefsPage() {
|
||||||
|
def daysOfTheWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
|
||||||
|
dynamicPage(name: "prefsPage") {
|
||||||
|
section("Set Leak Threshold by...") {
|
||||||
|
input(name: "type", type: "enum", title: "Type...", submitOnChange: true, options: ruleTypes())
|
||||||
|
}
|
||||||
|
|
||||||
|
if(type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case "Mode":
|
||||||
|
section("Threshold settings") {
|
||||||
|
input(name: "ruleName", type: "text", title: "Rule Name", required: true)
|
||||||
|
input(name: "gpm", type: "decimal", title: "GPM exceeds", required: true, defaultValue: 0.1)
|
||||||
|
}
|
||||||
|
section("Only in these modes") {
|
||||||
|
input(name: "modes", type: "mode", title: "select a mode(s)", multiple: true, required: true)
|
||||||
|
}
|
||||||
|
section ("Action") {
|
||||||
|
input(name: "dev", type: "capability.actuator", title: "Choose a device to perform the action", required: false, submitOnChange: true)
|
||||||
|
if (dev) {
|
||||||
|
input(name: "command", type: "enum", title: "Command...", submitOnChange: true, options: deviceCommands(dev))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case "Time Period":
|
||||||
|
section("Threshold settings") {
|
||||||
|
input(name: "ruleName", type: "text", title: "Rule Name", required: true)
|
||||||
|
input(name: "gpm", type: "decimal", title: "GPM exceeds", required: true)
|
||||||
|
}
|
||||||
|
section("Between...") {
|
||||||
|
input(name: "startTime", type: "time", title: "Start Time", required: true)
|
||||||
|
}
|
||||||
|
section("...and...") {
|
||||||
|
input(name: "endTime", type: "time", title: "End Time", required: true)
|
||||||
|
}
|
||||||
|
section("Only on these days") {
|
||||||
|
input(name: "days", type: "enum", title: "Days of the week", required: false, options: daysOfTheWeek, multiple: true)
|
||||||
|
}
|
||||||
|
section("Only in these modes") {
|
||||||
|
input(name: "modes", type: "mode", title: "System Modes", required: false, multiple: true)
|
||||||
|
}
|
||||||
|
section ("Action") {
|
||||||
|
input(name: "dev", type: "capability.actuator", title: "Choose a device to perform the action", required: false, submitOnChange: true)
|
||||||
|
if (dev) {
|
||||||
|
input(name: "command", type: "enum", title: "Command...", submitOnChange: true, options: deviceCommands(dev))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case "Accumulated Flow":
|
||||||
|
section("Threshold settings") {
|
||||||
|
input(name: "ruleName", type: "text", title: "Rule Name", required: true)
|
||||||
|
input(name: "gallons", type: "number", title: "Total Gallons exceeds", required: true)
|
||||||
|
}
|
||||||
|
section("Between...") {
|
||||||
|
input(name: "startTime", type: "time", title: "Start Time", required: true)
|
||||||
|
}
|
||||||
|
section("...and...") {
|
||||||
|
input(name: "endTime", type: "time", title: "End Time", required: true)
|
||||||
|
}
|
||||||
|
section("Only on these days") {
|
||||||
|
input(name: "days", type: "enum", title: "Days of the week", required: false, options: daysOfTheWeek, multiple: true)
|
||||||
|
}
|
||||||
|
section("Only in these modes") {
|
||||||
|
input(name: "modes", type: "mode", title: "System Modes", required: false, multiple: true)
|
||||||
|
}
|
||||||
|
section ("Action") {
|
||||||
|
input(name: "dev", type: "capability.actuator", title: "Choose a device to perform the action", required: false, submitOnChange: true)
|
||||||
|
if (dev) {
|
||||||
|
input(name: "command", type: "enum", title: "Command...", submitOnChange: true, options: deviceCommands(dev))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case "Continuous Flow":
|
||||||
|
section("Threshold settings") {
|
||||||
|
input(name: "ruleName", type: "text", title: "Rule Name", required: true)
|
||||||
|
input(name: "flowMinutes", type: "number", title: "Minutes of constant flow", required: true, defaultValue: 60)
|
||||||
|
}
|
||||||
|
section("Only in these modes") {
|
||||||
|
input(name: "modes", type: "mode", title: "System Modes", required: false, multiple: true)
|
||||||
|
}
|
||||||
|
section ("Action") {
|
||||||
|
input(name: "dev", type: "capability.actuator", title: "Choose a device to perform the action", required: false, submitOnChange: true)
|
||||||
|
if (dev) {
|
||||||
|
input(name: "command", type: "enum", title: "Command...", submitOnChange: true, options: deviceCommands(dev))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case "Water Valve Status":
|
||||||
|
section("Threshold settings") {
|
||||||
|
input(name: "ruleName", type: "text", title: "Rule Name", required: true)
|
||||||
|
input(name: "gpm", type: "decimal", title: "GPM exceeds", required: true, defaultValue: 0.1)
|
||||||
|
}
|
||||||
|
section ("While...") {
|
||||||
|
input(name: "valve", type: "capability.valve", title: "Choose a valve", required: true)
|
||||||
|
}
|
||||||
|
section ("...is...") {
|
||||||
|
input(name: "valveStatus", type: "enum", title: "Status", options: ["Open","Closed"], required: true)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case "Switch Status":
|
||||||
|
section("Threshold settings") {
|
||||||
|
input(name: "ruleName", type: "text", title: "Rule Name", required: true)
|
||||||
|
input(name: "gpm", type: "decimal", title: "GPM exceeds", required: true, defaultValue: 0.1)
|
||||||
|
}
|
||||||
|
section ("If...") {
|
||||||
|
input(name: "valve", type: "capability.switch", title: "Choose a switch", required: true)
|
||||||
|
}
|
||||||
|
section ("...is...") {
|
||||||
|
input(name: "switchStatus", type: "enum", title: "Status", options: ["On","Off"], required: true)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def ruleTypes() {
|
||||||
|
def types = []
|
||||||
|
types << "Mode"
|
||||||
|
types << "Time Period"
|
||||||
|
types << "Accumulated Flow"
|
||||||
|
types << "Continuous Flow"
|
||||||
|
types << "Water Valve Status"
|
||||||
|
//types << "Switch Status"
|
||||||
|
|
||||||
|
return types
|
||||||
|
}
|
||||||
|
|
||||||
|
def actionTypes() {
|
||||||
|
def types = []
|
||||||
|
types << [name: "Switch", capability: "capabilty.switch"]
|
||||||
|
types << [name: "Water Valve", capability: "capability.valve"]
|
||||||
|
|
||||||
|
return types
|
||||||
|
}
|
||||||
|
|
||||||
|
def deviceCommands(dev)
|
||||||
|
{
|
||||||
|
def cmds = []
|
||||||
|
dev.supportedCommands.each { command ->
|
||||||
|
cmds << command.name
|
||||||
|
}
|
||||||
|
|
||||||
|
return cmds
|
||||||
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
log.debug "Installed with settings: ${settings}"
|
||||||
|
app.updateLabel("${ruleName ? ruleName : ""} - ${type}")
|
||||||
|
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "Updated with settings: ${settings}"
|
||||||
|
app.updateLabel("${ruleName ? ruleName : ""} - ${type}")
|
||||||
|
|
||||||
|
unsubscribe()
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def settings() {
|
||||||
|
def set = settings
|
||||||
|
if (set["dev"] != null)
|
||||||
|
{
|
||||||
|
log.debug("dev set: ${set.dev}")
|
||||||
|
set.dev = set.dev.id
|
||||||
|
}
|
||||||
|
if (set["valve"] != null)
|
||||||
|
{
|
||||||
|
log.debug("valve set: ${set.valve}")
|
||||||
|
set.valve = set.valve.id
|
||||||
|
}
|
||||||
|
log.debug(set)
|
||||||
|
return set
|
||||||
|
}
|
||||||
|
|
||||||
|
def devAction(action)
|
||||||
|
{
|
||||||
|
if(dev)
|
||||||
|
{
|
||||||
|
log.debug("device: ${dev}, action: ${action}")
|
||||||
|
dev."${action}"()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def isValveStatus(status)
|
||||||
|
{
|
||||||
|
def result = false
|
||||||
|
log.debug("Water Valve ${valve} has status ${valve.currentState("contact").value}, compared to ${status.toLowerCase()}")
|
||||||
|
if(valve)
|
||||||
|
{
|
||||||
|
if(valve.currentState("contact").value == status.toLowerCase())
|
||||||
|
{
|
||||||
|
result = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
|
// TODO: subscribe to attributes, devices, locations, etc.
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: implement event handlers
|
||||||
Reference in New Issue
Block a user