mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-21 13:10:51 +00:00
Compare commits
1 Commits
MSA-2115-5
...
MSA-2117-7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0bdbf6abb |
@@ -1,183 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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")
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
/**
|
||||||
|
* FortrezZ MIMO2+ B-Side
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
definition(
|
||||||
|
name: "FortrezZ MIMO2+ B-Side",
|
||||||
|
namespace: "fortrezz",
|
||||||
|
author: "FortrezZ, LLC",
|
||||||
|
description: "Breaks the MIMO2 into two separate devices to allow automation on SIG2 and Relay 2.",
|
||||||
|
category: "Convenience",
|
||||||
|
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",
|
||||||
|
singleInstance: true)
|
||||||
|
|
||||||
|
|
||||||
|
preferences {
|
||||||
|
section("Title") {
|
||||||
|
input(name: "devices", type: "capability.voltageMeasurement", title: "MIMO2 devices", description: null, required: true, submitOnChange: true, multiple: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
log.debug "Installed with settings: ${settings}"
|
||||||
|
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "Updated with settings: ${settings}"
|
||||||
|
|
||||||
|
unsubscribe()
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def initialize(){
|
||||||
|
log.debug("Devices: ${settings.devices}")
|
||||||
|
settings.devices.each {//deviceId ->
|
||||||
|
subscribe(it, "powered", events)
|
||||||
|
subscribe(it, "switch2", events)
|
||||||
|
subscribe(it, "contact2", events)
|
||||||
|
subscribe(it, "voltage2", events)
|
||||||
|
subscribe(it, "relay2", events)
|
||||||
|
subscribe(it, "anaDig2", events)
|
||||||
|
|
||||||
|
try {
|
||||||
|
def existingDevice = getChildDevice(it.id)
|
||||||
|
if(!existingDevice) {
|
||||||
|
log.debug("Device ID: ${existingDevice}")
|
||||||
|
def childDevice = addChildDevice("fortrezz", "FortrezZ MIMO2+ B-Side", it.id, null, [name: "Device.${it.id}", label: "${it.name} B-Side", completedSetup: true])
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
log.error "Error creating device: ${e}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getChildDevices().each {
|
||||||
|
def test = it
|
||||||
|
def search = settings.devices.find { getChildDevice(it.id).id == test.id }
|
||||||
|
if(!search) {
|
||||||
|
removeChildDevices(test)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def uninstalled() {
|
||||||
|
removeChildDevices(getChildDevices())
|
||||||
|
}
|
||||||
|
|
||||||
|
private removeChildDevices(delete) {
|
||||||
|
delete.each {
|
||||||
|
deleteChildDevice(it.deviceNetworkId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def on2(child) {
|
||||||
|
log.debug("on2")
|
||||||
|
def ret = child
|
||||||
|
settings.devices.each {//deviceId ->
|
||||||
|
def ch = getChildDevice(it.id)
|
||||||
|
if(child == ch.id) {
|
||||||
|
ret = "${child}, ${it.id}"
|
||||||
|
it.on2()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
def off2(child) {
|
||||||
|
log.debug("off2")
|
||||||
|
def ret = child
|
||||||
|
settings.devices.each {//deviceId ->
|
||||||
|
def ch = getChildDevice(it.id)
|
||||||
|
if(child == ch.id) {
|
||||||
|
ret = "${child}, ${it.id}"
|
||||||
|
it.off2()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
def refresh2(child) {
|
||||||
|
log.debug("refresh2")
|
||||||
|
def ret = child
|
||||||
|
settings.devices.each {//deviceId ->
|
||||||
|
def ch = getChildDevice(it.id)
|
||||||
|
if(child == ch.id) {
|
||||||
|
ret = "${child}, ${it.id}"
|
||||||
|
it.refresh()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
def events(evt) {
|
||||||
|
def ch = getChildDevice(evt.device.id)
|
||||||
|
ch.eventParse(evt);
|
||||||
|
log.debug("${evt.device.id} triggered ${evt.name}")
|
||||||
|
}
|
||||||
|
// TODO: implement event handlers
|
||||||
Reference in New Issue
Block a user