mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-18 21:03:39 +00:00
Compare commits
7 Commits
PROD_2017.
...
MSA-1769-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
558a353bd5 | ||
|
|
a8f95cc0b9 | ||
|
|
06e4b7d9f0 | ||
|
|
16d7da81f1 | ||
|
|
8e6d009d67 | ||
|
|
d8c89f6c6a | ||
|
|
ddc15172d6 |
@@ -40,14 +40,11 @@ metadata {
|
|||||||
|
|
||||||
// Parse incoming device messages to generate events
|
// Parse incoming device messages to generate events
|
||||||
def parse(String description) {
|
def parse(String description) {
|
||||||
def name = null
|
def resMap
|
||||||
def value = description
|
if (description.startsWith("zone")) {
|
||||||
if (zigbee.isZoneType19(description)) {
|
resMap = createEvent(name: "contact", value: zigbee.parseZoneStatus(description).isAlarm1Set() ? "open" : "closed")
|
||||||
name = "contact"
|
|
||||||
value = zigbee.translateStatusZoneType19(description) ? "open" : "closed"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def result = createEvent(name: name, value: value)
|
log.debug "Parse returned $resMap"
|
||||||
log.debug "Parse returned ${result?.descriptionText}"
|
return resMap
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ def parse(String description) {
|
|||||||
log.debug "parse($description)"
|
log.debug "parse($description)"
|
||||||
def results = [:]
|
def results = [:]
|
||||||
|
|
||||||
if (!isSupportedDescription(description) || zigbee.isZoneType19(description)) {
|
if (!isSupportedDescription(description) || description.startsWith("zone")) {
|
||||||
// Ignore this in favor of orientation-based state
|
// Ignore this in favor of orientation-based state
|
||||||
// results = parseSingleMessage(description)
|
// results = parseSingleMessage(description)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ def parse(String description) {
|
|||||||
log.debug "parse($description)"
|
log.debug "parse($description)"
|
||||||
def results = null
|
def results = null
|
||||||
|
|
||||||
if (!isSupportedDescription(description) || zigbee.isZoneType19(description)) {
|
if (!isSupportedDescription(description) || description.startsWith("zone")) {
|
||||||
// Ignore this in favor of orientation-based state
|
// Ignore this in favor of orientation-based state
|
||||||
// results = parseSingleMessage(description)
|
// results = parseSingleMessage(description)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ metadata {
|
|||||||
|
|
||||||
def parse(String description) {
|
def parse(String description) {
|
||||||
def results = [:]
|
def results = [:]
|
||||||
if (isZoneType19(description) || !isSupportedDescription(description)) {
|
if (description.startsWith("zone") || !isSupportedDescription(description)) {
|
||||||
results = parseBasicMessage(description)
|
results = parseBasicMessage(description)
|
||||||
}
|
}
|
||||||
else if (isMotionStatusMessage(description)){
|
else if (isMotionStatusMessage(description)){
|
||||||
@@ -87,16 +87,12 @@ private String parseName(String description) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String parseValue(String description) {
|
private String parseValue(String description) {
|
||||||
if (isZoneType19(description)) {
|
def zs = zigbee.parseZoneStatus(description)
|
||||||
if (translateStatusZoneType19(description)) {
|
if (zs) {
|
||||||
return "active"
|
zs.isAlarm1Set() ? "active" : "inactive"
|
||||||
}
|
} else {
|
||||||
else {
|
description
|
||||||
return "inactive"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
description
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private parseDescriptionText(String linkText, String value, String description) {
|
private parseDescriptionText(String linkText, String value, String description) {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ metadata {
|
|||||||
def parse(String description) {
|
def parse(String description) {
|
||||||
def results
|
def results
|
||||||
|
|
||||||
if (!isSupportedDescription(description) || zigbee.isZoneType19(description)) {
|
if (!isSupportedDescription(description) || description.startsWith("zone")) {
|
||||||
results = parseSingleMessage(description)
|
results = parseSingleMessage(description)
|
||||||
}
|
}
|
||||||
else if (description == 'updated') {
|
else if (description == 'updated') {
|
||||||
@@ -488,12 +488,7 @@ private String parseValue(String description) {
|
|||||||
if (!isSupportedDescription(description)) {
|
if (!isSupportedDescription(description)) {
|
||||||
return description
|
return description
|
||||||
}
|
}
|
||||||
else if (zigbee.translateStatusZoneType19(description)) {
|
return zigbee.parseZoneStatus(description)?.isAlarm1Set() ? "open" : "closed"
|
||||||
return "open"
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return "closed"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private parseDescriptionText(String linkText, String value, String description) {
|
private parseDescriptionText(String linkText, String value, String description) {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ metadata {
|
|||||||
def parse(String description) {
|
def parse(String description) {
|
||||||
def results
|
def results
|
||||||
|
|
||||||
if (!isSupportedDescription(description) || zigbee.isZoneType19(description)) {
|
if (!isSupportedDescription(description) || description.startsWith("zone")) {
|
||||||
// Ignore this in favor of orientation-based state
|
// Ignore this in favor of orientation-based state
|
||||||
// results = parseSingleMessage(description)
|
// results = parseSingleMessage(description)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,15 +118,38 @@ private Map getBatteryResult(rawValue) {
|
|||||||
private Map parseNonIasButtonMessage(Map descMap){
|
private Map parseNonIasButtonMessage(Map descMap){
|
||||||
def buttonState = ""
|
def buttonState = ""
|
||||||
def buttonNumber = 0
|
def buttonNumber = 0
|
||||||
if (((device.getDataValue("model") == "3460-L") || (device.getDataValue("model") == "3450-L"))
|
if ((device.getDataValue("model") == "3460-L") &&(descMap.clusterInt == 0x0006)) {
|
||||||
&&(descMap.clusterInt == 0x0006)) {
|
if (descMap.commandInt == 1) {
|
||||||
if (descMap.command == "01") {
|
|
||||||
getButtonResult("press")
|
getButtonResult("press")
|
||||||
}
|
}
|
||||||
else if (descMap.command == "00") {
|
else if (descMap.commandInt == 0) {
|
||||||
getButtonResult("release")
|
getButtonResult("release")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ((device.getDataValue("model") == "3450-L") && (descMap.clusterInt == 0x0006)) {
|
||||||
|
if (descMap.commandInt == 1) {
|
||||||
|
getButtonResult("press")
|
||||||
|
}
|
||||||
|
else if (descMap.commandInt == 0) {
|
||||||
|
def button = 1
|
||||||
|
switch(descMap.sourceEndpoint) {
|
||||||
|
case "01":
|
||||||
|
button = 4
|
||||||
|
break
|
||||||
|
case "02":
|
||||||
|
button = 3
|
||||||
|
break
|
||||||
|
case "03":
|
||||||
|
button = 1
|
||||||
|
break
|
||||||
|
case "04":
|
||||||
|
button = 2
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
getButtonResult("release", button)
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (descMap.clusterInt == 0x0006) {
|
else if (descMap.clusterInt == 0x0006) {
|
||||||
buttonState = "pushed"
|
buttonState = "pushed"
|
||||||
if (descMap.command == "01") {
|
if (descMap.command == "01") {
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* SmartThings Mobile
|
||||||
|
*
|
||||||
|
* Copyright 2017 Warren Smith
|
||||||
|
*
|
||||||
|
* 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: "SmartThings Mobile",
|
||||||
|
namespace: "Smart things ",
|
||||||
|
author: "Warren Smith",
|
||||||
|
description: "App",
|
||||||
|
category: "Green Living",
|
||||||
|
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") {
|
||||||
|
appSetting "SmartThings"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
preferences {
|
||||||
|
section("Title") {
|
||||||
|
// TODO: put inputs here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
log.debug "Installed with settings: ${settings}"
|
||||||
|
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "Updated with settings: ${settings}"
|
||||||
|
|
||||||
|
unsubscribe()
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
|
// TODO: subscribe to attributes, devices, locations, etc.
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: implement event handlers
|
||||||
Reference in New Issue
Block a user