mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-10 05:11:51 +00:00
Compare commits
1 Commits
MSA-2114-4
...
MSA-2115-5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0f467f1a7 |
@@ -1,180 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
metadata {
|
||||
definition (name: "FortrezZ Water Sensor", namespace: "fortrezz", author: "SmartThings") {
|
||||
capability "Water Sensor"
|
||||
capability "Sensor"
|
||||
capability "Battery"
|
||||
capability "Temperature Measurement"
|
||||
|
||||
fingerprint deviceId: "0x2001", inClusters: "0x30,0x9C,0x9D,0x85,0x80,0x72,0x31,0x84,0x86"
|
||||
fingerprint deviceId: "0x2101", inClusters: "0x71,0x70,0x85,0x80,0x72,0x31,0x84,0x86"
|
||||
}
|
||||
|
||||
simulator {
|
||||
status "dry": "command: 7105, payload: 00 00 00 FF 05 FE 00 00"
|
||||
status "wet": "command: 7105, payload: 00 FF 00 FF 05 02 00 00"
|
||||
status "overheated": "command: 7105, payload: 00 00 00 FF 04 02 00 00"
|
||||
status "freezing": "command: 7105, payload: 00 00 00 FF 04 05 00 00"
|
||||
status "normal": "command: 7105, payload: 00 00 00 FF 04 FE 00 00"
|
||||
for (int i = 0; i <= 100; i += 20) {
|
||||
status "battery ${i}%": new physicalgraph.zwave.Zwave().batteryV1.batteryReport(batteryLevel: i).incomingMessage()
|
||||
}
|
||||
}
|
||||
|
||||
tiles(scale: 2) {
|
||||
multiAttributeTile(name:"water", type: "generic", width: 6, height: 4){
|
||||
tileAttribute ("device.water", key: "PRIMARY_CONTROL") {
|
||||
attributeState "dry", label: "Dry", icon:"st.alarm.water.dry", backgroundColor:"#ffffff"
|
||||
attributeState "wet", label: "Wet", icon:"st.alarm.water.wet", backgroundColor:"#53a7c0"
|
||||
}
|
||||
}
|
||||
standardTile("temperatureState", "device.temperature", width: 2, height: 2) {
|
||||
state "normal", icon:"st.alarm.temperature.normal", backgroundColor:"#ffffff"
|
||||
state "freezing", icon:"st.alarm.temperature.freeze", backgroundColor:"#53a7c0"
|
||||
state "overheated", icon:"st.alarm.temperature.overheat", backgroundColor:"#F80000"
|
||||
}
|
||||
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("battery", "device.battery", decoration: "flat", inactiveLabel: false, width: 2, height: 2) {
|
||||
state "battery", label:'${currentValue}% battery', unit:""
|
||||
}
|
||||
main (["water", "temperatureState"])
|
||||
details(["water", "temperatureState", "temperature", "battery"])
|
||||
}
|
||||
}
|
||||
|
||||
def parse(String description) {
|
||||
def result = []
|
||||
def parsedZwEvent = zwave.parse(description, [0x30: 1, 0x71: 2, 0x84: 1])
|
||||
|
||||
if(parsedZwEvent) {
|
||||
if(parsedZwEvent.CMD == "8407") {
|
||||
def lastStatus = device.currentState("battery")
|
||||
def ageInMinutes = lastStatus ? (new Date().time - lastStatus.date.time)/60000 : 600
|
||||
log.debug "Battery status was last checked ${ageInMinutes} minutes ago"
|
||||
|
||||
if (ageInMinutes >= 600) {
|
||||
log.debug "Battery status is outdated, requesting battery report"
|
||||
result << new physicalgraph.device.HubAction(zwave.batteryV1.batteryGet().format())
|
||||
}
|
||||
result << new physicalgraph.device.HubAction(zwave.wakeUpV1.wakeUpNoMoreInformation().format())
|
||||
}
|
||||
result << createEvent( zwaveEvent(parsedZwEvent) )
|
||||
}
|
||||
if(!result) result = [ descriptionText: parsedZwEvent, displayed: false ]
|
||||
log.debug "Parse returned ${result}"
|
||||
return result
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.wakeupv1.WakeUpNotification cmd)
|
||||
{
|
||||
[descriptionText: "${device.displayName} woke up", isStateChange: false]
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.sensorbinaryv1.SensorBinaryReport cmd)
|
||||
{
|
||||
def map = [:]
|
||||
map.name = "water"
|
||||
map.value = cmd.sensorValue ? "wet" : "dry"
|
||||
map.descriptionText = "${device.displayName} is ${map.value}"
|
||||
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
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.alarmv2.AlarmReport cmd)
|
||||
{
|
||||
def map = [:]
|
||||
if (cmd.zwaveAlarmType == physicalgraph.zwave.commands.alarmv2.AlarmReport.ZWAVE_ALARM_TYPE_WATER) {
|
||||
map.name = "water"
|
||||
map.value = cmd.alarmLevel ? "wet" : "dry"
|
||||
map.descriptionText = "${device.displayName} is ${map.value}"
|
||||
}
|
||||
if(cmd.zwaveAlarmType == physicalgraph.zwave.commands.alarmv2.AlarmReport.ZWAVE_ALARM_TYPE_HEAT) {
|
||||
map.name = "temperatureState"
|
||||
if(cmd.zwaveAlarmEvent == 1) { map.value = "overheated"}
|
||||
if(cmd.zwaveAlarmEvent == 2) { map.value = "overheated"}
|
||||
if(cmd.zwaveAlarmEvent == 3) { map.value = "changing temperature rapidly"}
|
||||
if(cmd.zwaveAlarmEvent == 4) { map.value = "changing temperature rapidly"}
|
||||
if(cmd.zwaveAlarmEvent == 5) { map.value = "freezing"}
|
||||
if(cmd.zwaveAlarmEvent == 6) { map.value = "freezing"}
|
||||
if(cmd.zwaveAlarmEvent == 254) { map.value = "normal"}
|
||||
map.descriptionText = "${device.displayName} is ${map.value}"
|
||||
}
|
||||
|
||||
map
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv5.SensorMultilevelReport 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
|
||||
}
|
||||
map
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd)
|
||||
{
|
||||
def map = [:]
|
||||
map.name = "water"
|
||||
map.value = cmd.value ? "wet" : "dry"
|
||||
map.descriptionText = "${device.displayName} is ${map.value}"
|
||||
map
|
||||
}
|
||||
|
||||
def getTemperature(value) {
|
||||
if(location.temperatureScale == "C"){
|
||||
return value
|
||||
} else {
|
||||
return Math.round(celsiusToFahrenheit(value))
|
||||
}
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.Command cmd)
|
||||
{
|
||||
log.debug "COMMAND CLASS: $cmd"
|
||||
}
|
||||
183
devicetypes/fortrezz/telguard-gdc1.src/telguard-gdc1.groovy
Normal file
183
devicetypes/fortrezz/telguard-gdc1.src/telguard-gdc1.groovy
Normal file
@@ -0,0 +1,183 @@
|
||||
/**
|
||||
* Z-Wave Garage Door Opener
|
||||
*
|
||||
* Copyright 2014 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.
|
||||
*
|
||||
*/
|
||||
metadata {
|
||||
definition (name: "Telguard GDC1", namespace: "fortrezz", author: "FortrezZ, LLC") {
|
||||
capability "Actuator"
|
||||
capability "Door Control"
|
||||
capability "Garage Door Control"
|
||||
capability "Contact Sensor"
|
||||
capability "Refresh"
|
||||
capability "Sensor"
|
||||
capability "Switch"
|
||||
|
||||
fingerprint deviceId: "0x1000", inClusters: "0x72, 0x86, 0x25"
|
||||
}
|
||||
|
||||
simulator {
|
||||
status "closed": "command: 9881, payload: 00 66 03 00"
|
||||
status "opening": "command: 9881, payload: 00 66 03 FE"
|
||||
status "open": "command: 9881, payload: 00 66 03 FF"
|
||||
status "closing": "command: 9881, payload: 00 66 03 FC"
|
||||
status "unknown": "command: 9881, payload: 00 66 03 FD"
|
||||
|
||||
reply "988100660100": "command: 9881, payload: 00 66 03 FC"
|
||||
reply "9881006601FF": "command: 9881, payload: 00 66 03 FE"
|
||||
}
|
||||
|
||||
tiles {
|
||||
standardTile("toggle", "device.door", width: 2, height: 2) {
|
||||
state("unknown", label:'${name}', action:"refresh.refresh", icon:"st.doors.garage.garage-open", backgroundColor:"#ffa81e")
|
||||
state("closed", label:'${name}', action:"door control.open", icon:"st.doors.garage.garage-closed", backgroundColor:"#79b821", nextState:"opening")
|
||||
state("open", label:'${name}', action:"door control.close", icon:"st.doors.garage.garage-open", backgroundColor:"#ffa81e", nextState:"closing")
|
||||
state("opening", label:'${name}', icon:"st.doors.garage.garage-opening", backgroundColor:"#ffe71e")
|
||||
state("closing", label:'${name}', icon:"st.doors.garage.garage-closing", backgroundColor:"#ffe71e")
|
||||
}
|
||||
standardTile("open", "device.door", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'open', action:"door control.open", icon:"st.doors.garage.garage-opening"
|
||||
}
|
||||
standardTile("close", "device.door", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'close', action:"door control.close", icon:"st.doors.garage.garage-closing"
|
||||
}
|
||||
standardTile("refresh", "device.door", inactiveLabel: false, decoration: "flat") {
|
||||
state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
|
||||
}
|
||||
standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
|
||||
state "on", label:'${name}', action:"switch.off", icon:"st.switches.switch.off", backgroundColor:"#79b821", nextState:"turningOff"
|
||||
state "off", label:'${name}', action:"switch.on", icon:"st.switches.switch.on", backgroundColor:"#ffffff", nextState:"turningOn"
|
||||
state "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.switch.off", backgroundColor:"#79b821", nextState:"turningOff"
|
||||
state "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.switch.on", backgroundColor:"#ffffff", nextState:"turningOn"
|
||||
state "offline", label:'${name}', icon:"st.switches.switch.off", backgroundColor:"#ff0000"
|
||||
}
|
||||
|
||||
main "toggle"
|
||||
details(["toggle", "open", "close", "refresh"])
|
||||
}
|
||||
}
|
||||
|
||||
def parse(String description) {
|
||||
def results = []
|
||||
log.debug(description)
|
||||
if (description.startsWith("Err")) {
|
||||
results << createEvent(descriptionText:description, displayed:true)
|
||||
} else {
|
||||
def cmd = zwave.parse(description)
|
||||
if (cmd) {
|
||||
results = zwaveEvent(cmd)
|
||||
}
|
||||
}
|
||||
log.debug "\"$description\" parsed to ${results.inspect()}"
|
||||
return results
|
||||
}
|
||||
|
||||
def open() {
|
||||
sendEvent(name: "door", value: "opening", descriptionText: "$device.displayName: opening")
|
||||
delayBetween([
|
||||
zwave.basicV1.basicSet(value: 0xFF).format(),
|
||||
zwave.basicV1.basicGet().format()
|
||||
], 15000)
|
||||
}
|
||||
|
||||
def close() {
|
||||
sendEvent(name: "door", value: "closing", descriptionText: "$device.displayName: closing")
|
||||
zwave.basicV1.basicSet(value: 0x00).format()
|
||||
}
|
||||
|
||||
def on() {
|
||||
open()
|
||||
}
|
||||
|
||||
def off() {
|
||||
close()
|
||||
}
|
||||
|
||||
def refresh() {
|
||||
zwave.basicV1.basicGet().format()
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
|
||||
def map = [name: "door"]
|
||||
def map2 = [name: "switch"]
|
||||
if (cmd.value == 0xFF)
|
||||
{
|
||||
map.value = "open"
|
||||
map2.value = "on"
|
||||
sendEvent(map2)
|
||||
}
|
||||
else if (cmd.value == 0x00)
|
||||
{
|
||||
map.value = "closed"
|
||||
map2.value = "off"
|
||||
sendEvent(map2)
|
||||
}
|
||||
else
|
||||
{
|
||||
map.value = "unknown"
|
||||
}
|
||||
|
||||
createEvent(map)
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd) {
|
||||
def map = [name: "door"]
|
||||
def map2 = [name: "switch"]
|
||||
if (cmd.value == 0xFF)
|
||||
{
|
||||
map.value = "open"
|
||||
map2.value = "on"
|
||||
sendEvent(map2)
|
||||
}
|
||||
else if (cmd.value == 0x00)
|
||||
{
|
||||
map.value = "closed"
|
||||
map2.value = "off"
|
||||
sendEvent(map2)
|
||||
}
|
||||
else
|
||||
{
|
||||
map.value = "unknown"
|
||||
}
|
||||
|
||||
createEvent(map)
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.manufacturerspecificv2.ManufacturerSpecificReport cmd) {
|
||||
def result = []
|
||||
|
||||
def msr = String.format("%04X-%04X-%04X", cmd.manufacturerId, cmd.productTypeId, cmd.productId)
|
||||
log.debug "msr: $msr"
|
||||
updateDataValue("MSR", msr)
|
||||
|
||||
result << createEvent(descriptionText: "$device.displayName MSR: $msr", isStateChange: false)
|
||||
result
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.versionv1.VersionReport cmd) {
|
||||
def fw = "${cmd.applicationVersion}.${cmd.applicationSubVersion}"
|
||||
updateDataValue("fw", fw)
|
||||
def text = "$device.displayName: firmware version: $fw, Z-Wave version: ${cmd.zWaveProtocolVersion}.${cmd.zWaveProtocolSubVersion}"
|
||||
createEvent(descriptionText: text, isStateChange: false)
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.commands.applicationstatusv1.ApplicationBusy cmd) {
|
||||
def msg = cmd.status == 0 ? "try again later" :
|
||||
cmd.status == 1 ? "try again in $cmd.waitTime seconds" :
|
||||
cmd.status == 2 ? "request queued" : "sorry"
|
||||
createEvent(displayed: true, descriptionText: "$device.displayName is busy, $msg")
|
||||
}
|
||||
|
||||
def zwaveEvent(physicalgraph.zwave.Command cmd) {
|
||||
createEvent(displayed: false, descriptionText: "$device.displayName: $cmd")
|
||||
}
|
||||
Reference in New Issue
Block a user