mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-16 13:10:51 +00:00
Compare commits
25 Commits
MSA-1435-1
...
DEVTOOLS-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5c91f82b6 | ||
|
|
47183ebbff | ||
|
|
d68f70b3dd | ||
|
|
e1b1479cfc | ||
|
|
16e4954f10 | ||
|
|
929f8e1a44 | ||
|
|
255185ee8c | ||
|
|
ad50582e92 | ||
|
|
6de6704502 | ||
|
|
a5bc475cc1 | ||
|
|
4fd5cc5d70 | ||
|
|
236c37290e | ||
|
|
7beb2e3905 | ||
|
|
d17bc1869f | ||
|
|
534118a47a | ||
|
|
7bfa0304af | ||
|
|
842f39e9ff | ||
|
|
dd308f6d8f | ||
|
|
1a72158a9a | ||
|
|
94ab309335 | ||
|
|
f2d635ab44 | ||
|
|
a7cd9e072b | ||
|
|
b5843acc38 | ||
|
|
4e5d1f6ad0 | ||
|
|
ef29820fa1 |
@@ -0,0 +1,37 @@
|
|||||||
|
/**
|
||||||
|
* 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: "Beacon Capability", namespace: "capabilities", author: "SmartThings") {
|
||||||
|
capability "Beacon"
|
||||||
|
}
|
||||||
|
|
||||||
|
simulator {
|
||||||
|
status "present": "beacon: present"
|
||||||
|
status "not present": "beacon: not present"
|
||||||
|
}
|
||||||
|
|
||||||
|
tiles {
|
||||||
|
standardTile("beacon", "device.beacon", width: 2, height: 2) {
|
||||||
|
state("not present", label:'not present', icon:"st.presence.tile.not-present", backgroundColor:"#ffffff")
|
||||||
|
state("present", label:'present', icon:"st.presence.tile.present", backgroundColor:"#53a7c0")
|
||||||
|
}
|
||||||
|
main "beacon"
|
||||||
|
details "beacon"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def parse(String description) {
|
||||||
|
def pair = description.split(":")
|
||||||
|
createEvent(name: pair[0].trim(), value: pair[1].trim())
|
||||||
|
}
|
||||||
@@ -64,8 +64,10 @@ metadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
standardTile("switch", "device.switch", width: 1, height: 1, canChangeIcon: true) {
|
standardTile("switch", "device.switch", width: 1, height: 1, canChangeIcon: true) {
|
||||||
state "off", label: '${name}', action: "switch.on", icon: "st.Electronics.electronics16", backgroundColor: "#ffffff"
|
state "on", label: '${name}', action: "switch.off", icon: "st.Electronics.electronics16", backgroundColor: "#79b821", nextState:"turningOff"
|
||||||
state "on", label: '${name}', action: "switch.off", icon: "st.Electronics.electronics16", backgroundColor: "#79b821"
|
state "turningOff", label:'TURNING OFF', icon:"st.Electronics.electronics16", backgroundColor:"#ffffff"
|
||||||
|
state "off", label: '${name}', action: "switch.on", icon: "st.Electronics.electronics16", backgroundColor: "#ffffff", nextState:"turningOn"
|
||||||
|
state "turningOn", label:'TURNING ON', icon:"st.Electronics.electronics16", backgroundColor:"#79b821"
|
||||||
}
|
}
|
||||||
valueTile("1", "device.station1", decoration: "flat", canChangeIcon: false) {
|
valueTile("1", "device.station1", decoration: "flat", canChangeIcon: false) {
|
||||||
state "station1", label:'${currentValue}', action:"preset1"
|
state "station1", label:'${currentValue}', action:"preset1"
|
||||||
@@ -747,8 +749,16 @@ def cb_boseSetInput(xml, input) {
|
|||||||
*/
|
*/
|
||||||
def boseSetPowerState(boolean enable) {
|
def boseSetPowerState(boolean enable) {
|
||||||
log.info "boseSetPowerState(${enable})"
|
log.info "boseSetPowerState(${enable})"
|
||||||
queueCallback('nowPlaying', "cb_boseSetPowerState", enable ? "POWERON" : "POWEROFF")
|
// Fix to get faster update of power status back from speaker after sending on/off
|
||||||
return boseRefreshNowPlaying()
|
// Instead of queuing the command to be sent after the refresh send it directly via sendHubCommand
|
||||||
|
// Note: This is a temporary hack that should be replaced by a re-design of the
|
||||||
|
// DTH to use sendHubCommand for all commands
|
||||||
|
sendHubCommand(bosePOST("/key", "<key state=\"press\" sender=\"Gabbo\">POWER</key>"))
|
||||||
|
sendHubCommand(bosePOST("/key", "<key state=\"release\" sender=\"Gabbo\">POWER</key>"))
|
||||||
|
sendHubCommand(boseGET("/now_playing"))
|
||||||
|
if (enable) {
|
||||||
|
queueCallback('nowPlaying', "cb_boseConfirmPowerOn", 5)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -787,10 +797,11 @@ def cb_boseSetPowerState(xml, state) {
|
|||||||
*/
|
*/
|
||||||
def cb_boseConfirmPowerOn(xml, tries) {
|
def cb_boseConfirmPowerOn(xml, tries) {
|
||||||
def result = []
|
def result = []
|
||||||
log.warn "boseConfirmPowerOn() attempt #" + tries
|
def attempt = tries as Integer
|
||||||
if (xml.attributes()['source'] == "STANDBY" && tries > 0) {
|
log.warn "boseConfirmPowerOn() attempt #$attempt"
|
||||||
|
if (xml.attributes()['source'] == "STANDBY" && attempt > 0) {
|
||||||
result << boseRefreshNowPlaying()
|
result << boseRefreshNowPlaying()
|
||||||
queueCallback('nowPlaying', "cb_boseConfirmPowerOn", tries-1)
|
queueCallback('nowPlaying', "cb_boseConfirmPowerOn", attempt-1)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
* for the specific language governing permissions and limitations under the License.
|
* for the specific language governing permissions and limitations under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import physicalgraph.zigbee.clusters.iaszone.ZoneStatus
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "NYCE Motion Sensor", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "NYCE Motion Sensor", namespace: "smartthings", author: "SmartThings") {
|
||||||
@@ -143,51 +144,14 @@ private Map parseReportAttributeMessage(String description) {
|
|||||||
|
|
||||||
|
|
||||||
private Map parseIasMessage(String description) {
|
private Map parseIasMessage(String description) {
|
||||||
List parsedMsg = description.split(' ')
|
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
||||||
String msgCode = parsedMsg[2]
|
Map resultMap = [:]
|
||||||
|
|
||||||
Map resultMap = [:]
|
|
||||||
switch(msgCode) {
|
|
||||||
case '0x0030': // Closed/No Motion/Dry
|
|
||||||
log.debug 'no motion'
|
|
||||||
resultMap.name = 'motion'
|
|
||||||
resultMap.value = 'inactive'
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0032': // Open/Motion/Wet
|
result.name = 'motion'
|
||||||
log.debug 'motion'
|
result.value = zs.isAlarm2Set() ? 'active' : 'inactive'
|
||||||
resultMap.name = 'motion'
|
log.debug(zs.isAlarm2Set() ? 'motion' : 'no motion')
|
||||||
resultMap.value = 'active'
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0032': // Tamper Alarm
|
return resultMap
|
||||||
log.debug 'motion with tamper alarm'
|
|
||||||
resultMap.name = 'motion'
|
|
||||||
resultMap.value = 'active'
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0033': // Battery Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0034': // Supervision Report
|
|
||||||
log.debug 'no motion with tamper alarm'
|
|
||||||
resultMap.name = 'motion'
|
|
||||||
resultMap.value = 'inactive'
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0035': // Restore Report
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0036': // Trouble/Failure
|
|
||||||
log.debug 'motion with failure alarm'
|
|
||||||
resultMap.name = 'motion'
|
|
||||||
resultMap.value = 'active'
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0038': // Test Mode
|
|
||||||
break
|
|
||||||
}
|
|
||||||
return resultMap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh()
|
def refresh()
|
||||||
|
|||||||
@@ -13,7 +13,10 @@
|
|||||||
* for the specific language governing permissions and limitations under the License.
|
* for the specific language governing permissions and limitations under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import physicalgraph.zigbee.clusters.iaszone.ZoneStatus
|
||||||
|
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "NYCE Open/Closed Sensor", namespace: "smartthings", author: "NYCE") {
|
definition (name: "NYCE Open/Closed Sensor", namespace: "smartthings", author: "NYCE") {
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
@@ -219,40 +222,33 @@ private Map parseReportAttributeMessage(String description) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List parseIasMessage(String description) {
|
private List parseIasMessage(String description) {
|
||||||
List parsedMsg = description.split(" ")
|
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
||||||
String msgCode = parsedMsg[2]
|
log.debug "parseIasMessage: $description"
|
||||||
|
|
||||||
List resultListMap = []
|
List resultListMap = []
|
||||||
Map resultMap_battery = [:]
|
Map resultMap_battery = [:]
|
||||||
Map resultMap_battery_state = [:]
|
Map resultMap_battery_state = [:]
|
||||||
Map resultMap_sensor = [:]
|
Map resultMap_sensor = [:]
|
||||||
|
|
||||||
// Relevant bit field definitions from ZigBee spec
|
resultMap_sensor.name = "contact"
|
||||||
def BATTERY_BIT = ( 1 << 3 )
|
resultMap_sensor.value = zs.isAlarm1Set() ? "open" : "closed"
|
||||||
def TROUBLE_BIT = ( 1 << 6 )
|
|
||||||
def SENSOR_BIT = ( 1 << 0 ) // it's ALARM1 bit from the ZCL spec
|
|
||||||
|
|
||||||
// Convert hex string to integer
|
|
||||||
def zoneStatus = Integer.parseInt(msgCode[-4..-1],16)
|
|
||||||
|
|
||||||
log.debug "parseIasMessage: zoneStatus: ${zoneStatus}"
|
|
||||||
|
|
||||||
// Check each relevant bit, create map for it, and add to list
|
// Check each relevant bit, create map for it, and add to list
|
||||||
log.debug "parseIasMessage: Battery Status ${zoneStatus & BATTERY_BIT}"
|
log.debug "parseIasMessage: Battery Status ${zs.battery}"
|
||||||
log.debug "parseIasMessage: Trouble Status ${zoneStatus & TROUBLE_BIT}"
|
log.debug "parseIasMessage: Trouble Status ${zs.trouble}"
|
||||||
log.debug "parseIasMessage: Sensor Status ${zoneStatus & SENSOR_BIT}"
|
log.debug "parseIasMessage: Sensor Status ${zs.alarm1}"
|
||||||
|
|
||||||
/* Comment out this path to check the battery state to avoid overwriting the
|
/* Comment out this path to check the battery state to avoid overwriting the
|
||||||
battery value (Change log #2), but keep these conditions for later use
|
battery value (Change log #2), but keep these conditions for later use
|
||||||
resultMap_battery_state.name = "battery_state"
|
resultMap_battery_state.name = "battery_state"
|
||||||
if (zoneStatus & TROUBLE_BIT) {
|
if (zs.isTroubleSet()) {
|
||||||
resultMap_battery_state.value = "failed"
|
resultMap_battery_state.value = "failed"
|
||||||
|
|
||||||
resultMap_battery.name = "battery"
|
resultMap_battery.name = "battery"
|
||||||
resultMap_battery.value = 0
|
resultMap_battery.value = 0
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (zoneStatus & BATTERY_BIT) {
|
if (zs.isBatterySet()) {
|
||||||
resultMap_battery_state.value = "low"
|
resultMap_battery_state.value = "low"
|
||||||
|
|
||||||
// to generate low battery notification by the platform
|
// to generate low battery notification by the platform
|
||||||
@@ -270,9 +266,6 @@ private List parseIasMessage(String description) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
resultMap_sensor.name = "contact"
|
|
||||||
resultMap_sensor.value = (zoneStatus & SENSOR_BIT) ? "open" : "closed"
|
|
||||||
|
|
||||||
resultListMap << resultMap_battery_state
|
resultListMap << resultMap_battery_state
|
||||||
resultListMap << resultMap_battery
|
resultListMap << resultMap_battery
|
||||||
resultListMap << resultMap_sensor
|
resultListMap << resultMap_sensor
|
||||||
|
|||||||
@@ -101,6 +101,12 @@ def parse(String description) {
|
|||||||
else {
|
else {
|
||||||
def descriptionText = finalResult.value == "on" ? '{{ device.displayName }} is On' : '{{ device.displayName }} is Off'
|
def descriptionText = finalResult.value == "on" ? '{{ device.displayName }} is On' : '{{ device.displayName }} is Off'
|
||||||
sendEvent(name: finalResult.type, value: finalResult.value, descriptionText: descriptionText, translatable: true)
|
sendEvent(name: finalResult.type, value: finalResult.value, descriptionText: descriptionText, translatable: true)
|
||||||
|
// Temporary fix for the case when Device is OFFLINE and is connected again
|
||||||
|
if (state.lastOnOff == null){
|
||||||
|
state.lastOnOff = now()
|
||||||
|
sendEvent(name: "deviceWatch-lastActivity", value: state.lastOnOff, description: "Last Activity is on ${new Date(state.lastOnOff)}", displayed: false, isStateChange: true)
|
||||||
|
}
|
||||||
|
state.lastOnOff = now()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -116,9 +122,24 @@ def off() {
|
|||||||
def on() {
|
def on() {
|
||||||
zigbee.on()
|
zigbee.on()
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* PING is used by Device-Watch in attempt to reach the Outlet
|
||||||
|
* */
|
||||||
|
def ping() {
|
||||||
|
|
||||||
|
// send read attribute onOFF if the last time we heard from the outlet is outside of the checkInterval
|
||||||
|
if (state.lastOnOff < (now() - (1000 * device.currentValue("checkInterval"))) ){
|
||||||
|
log.info "ping, alive=no, lastOnOff=${new Date(state.lastOnOff)}"
|
||||||
|
state.lastOnOff = null
|
||||||
|
return zigbee.onOffRefresh()
|
||||||
|
} else { // if the last onOff activity is within the checkInterval we artificially create a Device-Watch event
|
||||||
|
log.info "ping, alive=yes, lastOnOff=${new Date(state.lastOnOff)}"
|
||||||
|
sendEvent(name: "deviceWatch-lastActivity", value: state.lastOnOff, description: "Last Activity is on ${new Date(state.lastOnOff)}", displayed: false, isStateChange: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
zigbee.onOffRefresh() + zigbee.refreshData("0x0B04", "0x050B")
|
zigbee.onOffRefresh() + zigbee.electricMeasurementPowerRefresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
def configure() {
|
def configure() {
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
* License for the specific language governing permissions and limitations
|
* License for the specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
import physicalgraph.zigbee.clusters.iaszone.ZoneStatus
|
||||||
|
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "SmartSense Moisture Sensor",namespace: "smartthings", author: "SmartThings", category: "C2") {
|
definition (name: "SmartSense Moisture Sensor",namespace: "smartthings", author: "SmartThings", category: "C2") {
|
||||||
@@ -22,6 +24,7 @@ metadata {
|
|||||||
capability "Temperature Measurement"
|
capability "Temperature Measurement"
|
||||||
capability "Water Sensor"
|
capability "Water Sensor"
|
||||||
capability "Health Check"
|
capability "Health Check"
|
||||||
|
capability "Sensor"
|
||||||
|
|
||||||
command "enrollResponse"
|
command "enrollResponse"
|
||||||
|
|
||||||
@@ -169,42 +172,9 @@ private Map parseCustomMessage(String description) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map parseIasMessage(String description) {
|
private Map parseIasMessage(String description) {
|
||||||
List parsedMsg = description.split(' ')
|
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
||||||
String msgCode = parsedMsg[2]
|
|
||||||
|
|
||||||
Map resultMap = [:]
|
return zs.isAlarm1Set() ? getMoistureResult('wet') : getMoistureResult('dry')
|
||||||
switch(msgCode) {
|
|
||||||
case '0x0020': // Closed/No Motion/Dry
|
|
||||||
resultMap = getMoistureResult('dry')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0021': // Open/Motion/Wet
|
|
||||||
resultMap = getMoistureResult('wet')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0022': // Tamper Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0023': // Battery Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0024': // Supervision Report
|
|
||||||
log.debug 'dry with tamper alarm'
|
|
||||||
resultMap = getMoistureResult('dry')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0025': // Restore Report
|
|
||||||
log.debug 'water with tamper alarm'
|
|
||||||
resultMap = getMoistureResult('wet')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0026': // Trouble/Failure
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0028': // Test Mode
|
|
||||||
break
|
|
||||||
}
|
|
||||||
return resultMap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def getTemperature(value) {
|
def getTemperature(value) {
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
* License for the specific language governing permissions and limitations
|
* License for the specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
import physicalgraph.zigbee.clusters.iaszone.ZoneStatus
|
||||||
|
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "SmartSense Motion Sensor", namespace: "smartthings", author: "SmartThings", category: "C2") {
|
definition (name: "SmartSense Motion Sensor", namespace: "smartthings", author: "SmartThings", category: "C2") {
|
||||||
@@ -22,6 +24,7 @@ metadata {
|
|||||||
capability "Temperature Measurement"
|
capability "Temperature Measurement"
|
||||||
capability "Refresh"
|
capability "Refresh"
|
||||||
capability "Health Check"
|
capability "Health Check"
|
||||||
|
capability "Sensor"
|
||||||
|
|
||||||
command "enrollResponse"
|
command "enrollResponse"
|
||||||
|
|
||||||
@@ -182,44 +185,10 @@ private Map parseCustomMessage(String description) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map parseIasMessage(String description) {
|
private Map parseIasMessage(String description) {
|
||||||
List parsedMsg = description.split(' ')
|
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
||||||
String msgCode = parsedMsg[2]
|
|
||||||
|
|
||||||
Map resultMap = [:]
|
// Some sensor models that use this DTH use alarm1 and some use alarm2 to signify motion
|
||||||
switch(msgCode) {
|
return (zs.isAlarm1Set() || zs.isAlarm2Set()) ? getMotionResult('active') : getMotionResult('inactive')
|
||||||
case '0x0020': // Closed/No Motion/Dry
|
|
||||||
resultMap = getMotionResult('inactive')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0021': // Open/Motion/Wet
|
|
||||||
resultMap = getMotionResult('active')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0022': // Tamper Alarm
|
|
||||||
log.debug 'motion with tamper alarm'
|
|
||||||
resultMap = getMotionResult('active')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0023': // Battery Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0024': // Supervision Report
|
|
||||||
log.debug 'no motion with tamper alarm'
|
|
||||||
resultMap = getMotionResult('inactive')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0025': // Restore Report
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0026': // Trouble/Failure
|
|
||||||
log.debug 'motion with failure alarm'
|
|
||||||
resultMap = getMotionResult('active')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0028': // Test Mode
|
|
||||||
break
|
|
||||||
}
|
|
||||||
return resultMap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def getTemperature(value) {
|
def getTemperature(value) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//DEPRECATED - Using the smartsense-motion-sensor.groovy DTH for this device. Users need to be moved before deleting this DTH
|
//DEPRECATED - Using the smartsense-motion-sensor.groovy DTH for this device. Users need to be moved before deleting this DTH
|
||||||
|
import physicalgraph.zigbee.clusters.iaszone.ZoneStatus
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "SmartSense Motion/Temp Sensor", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "SmartSense Motion/Temp Sensor", namespace: "smartthings", author: "SmartThings") {
|
||||||
@@ -168,44 +169,8 @@ private Map parseCustomMessage(String description) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map parseIasMessage(String description) {
|
private Map parseIasMessage(String description) {
|
||||||
List parsedMsg = description.split(' ')
|
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
||||||
String msgCode = parsedMsg[2]
|
return zs.isAlarm1Set() ? getMotionResult('active') : getMotionResult('inactive')
|
||||||
|
|
||||||
Map resultMap = [:]
|
|
||||||
switch(msgCode) {
|
|
||||||
case '0x0020': // Closed/No Motion/Dry
|
|
||||||
resultMap = getMotionResult('inactive')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0021': // Open/Motion/Wet
|
|
||||||
resultMap = getMotionResult('active')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0022': // Tamper Alarm
|
|
||||||
log.debug 'motion with tamper alarm'
|
|
||||||
resultMap = getMotionResult('active')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0023': // Battery Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0024': // Supervision Report
|
|
||||||
log.debug 'no motion with tamper alarm'
|
|
||||||
resultMap = getMotionResult('inactive')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0025': // Restore Report
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0026': // Trouble/Failure
|
|
||||||
log.debug 'motion with failure alarm'
|
|
||||||
resultMap = getMotionResult('active')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0028': // Test Mode
|
|
||||||
break
|
|
||||||
}
|
|
||||||
return resultMap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def getTemperature(value) {
|
def getTemperature(value) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
* License for the specific language governing permissions and limitations
|
* License for the specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
import physicalgraph.zigbee.clusters.iaszone.ZoneStatus
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "SmartSense Multi Sensor", namespace: "smartthings", author: "SmartThings", category: "C2") {
|
definition (name: "SmartSense Multi Sensor", namespace: "smartthings", author: "SmartThings", category: "C2") {
|
||||||
@@ -224,47 +225,13 @@ private Map parseCustomMessage(String description) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map parseIasMessage(String description) {
|
private Map parseIasMessage(String description) {
|
||||||
List parsedMsg = description.split(' ')
|
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
||||||
String msgCode = parsedMsg[2]
|
|
||||||
|
|
||||||
Map resultMap = [:]
|
Map resultMap = [:]
|
||||||
switch(msgCode) {
|
|
||||||
case '0x0020': // Closed/No Motion/Dry
|
|
||||||
if (garageSensor != "Yes"){
|
|
||||||
resultMap = getContactResult('closed')
|
|
||||||
}
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0021': // Open/Motion/Wet
|
if(garageSensor != "Yes") {
|
||||||
if (garageSensor != "Yes"){
|
resultMap = zs.isAlarm1Set() ? getContactResult('open') : getContactResult('closed')
|
||||||
resultMap = getContactResult('open')
|
|
||||||
}
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0022': // Tamper Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0023': // Battery Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0024': // Supervision Report
|
|
||||||
if (garageSensor != "Yes"){
|
|
||||||
resultMap = getContactResult('closed')
|
|
||||||
}
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0025': // Restore Report
|
|
||||||
if (garageSensor != "Yes"){
|
|
||||||
resultMap = getContactResult('open')
|
|
||||||
}
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0026': // Trouble/Failure
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0028': // Test Mode
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultMap
|
return resultMap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
//DEPRECATED - Using the smartsense-multi-sensor.groovy DTH for this device. Users need to be moved before deleting this DTH
|
//DEPRECATED - Using the smartsense-multi-sensor.groovy DTH for this device. Users need to be moved before deleting this DTH
|
||||||
|
import physicalgraph.zigbee.clusters.iaszone.ZoneStatus
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "SmartSense Open/Closed Accelerometer Sensor", namespace: "smartthings", author: "SmartThings", category: "C2") {
|
definition (name: "SmartSense Open/Closed Accelerometer Sensor", namespace: "smartthings", author: "SmartThings", category: "C2") {
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
capability "Refresh"
|
capability "Refresh"
|
||||||
capability "Temperature Measurement"
|
capability "Temperature Measurement"
|
||||||
capability "Health Check"
|
capability "Health Check"
|
||||||
|
capability "Sensor"
|
||||||
|
|
||||||
command "enrollResponse"
|
command "enrollResponse"
|
||||||
}
|
}
|
||||||
@@ -171,40 +173,9 @@ private Map parseCustomMessage(String description) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map parseIasMessage(String description) {
|
private Map parseIasMessage(String description) {
|
||||||
List parsedMsg = description.split(' ')
|
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
||||||
String msgCode = parsedMsg[2]
|
|
||||||
|
|
||||||
Map resultMap = [:]
|
return zs.isAlarm1Set() ? getContactResult('open') : getContactResult('closed')
|
||||||
switch(msgCode) {
|
|
||||||
case '0x0020': // Closed/No Motion/Dry
|
|
||||||
resultMap = getContactResult('closed')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0021': // Open/Motion/Wet
|
|
||||||
resultMap = getContactResult('open')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0022': // Tamper Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0023': // Battery Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0024': // Supervision Report
|
|
||||||
resultMap = getContactResult('closed')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0025': // Restore Report
|
|
||||||
resultMap = getContactResult('open')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0026': // Trouble/Failure
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0028': // Test Mode
|
|
||||||
break
|
|
||||||
}
|
|
||||||
return resultMap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def getTemperature(value) {
|
def getTemperature(value) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
* for the specific language governing permissions and limitations under the License.
|
* for the specific language governing permissions and limitations under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import physicalgraph.zigbee.clusters.iaszone.ZoneStatus
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "SmartSense Open/Closed Sensor", namespace: "smartthings", author: "SmartThings", category: "C2") {
|
definition (name: "SmartSense Open/Closed Sensor", namespace: "smartthings", author: "SmartThings", category: "C2") {
|
||||||
@@ -167,40 +168,8 @@ private Map parseCustomMessage(String description) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map parseIasMessage(String description) {
|
private Map parseIasMessage(String description) {
|
||||||
List parsedMsg = description.split(' ')
|
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
||||||
String msgCode = parsedMsg[2]
|
return zs.isAlarm1Set() ? getContactResult('open') : getContactResult('closed')
|
||||||
|
|
||||||
Map resultMap = [:]
|
|
||||||
switch(msgCode) {
|
|
||||||
case '0x0020': // Closed/No Motion/Dry
|
|
||||||
resultMap = getContactResult('closed')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0021': // Open/Motion/Wet
|
|
||||||
resultMap = getContactResult('open')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0022': // Tamper Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0023': // Battery Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0024': // Supervision Report
|
|
||||||
resultMap = getContactResult('closed')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0025': // Restore Report
|
|
||||||
resultMap = getContactResult('open')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0026': // Trouble/Failure
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0028': // Test Mode
|
|
||||||
break
|
|
||||||
}
|
|
||||||
return resultMap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def getTemperature(value) {
|
def getTemperature(value) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ metadata {
|
|||||||
capability "Temperature Measurement"
|
capability "Temperature Measurement"
|
||||||
capability "Relative Humidity Measurement"
|
capability "Relative Humidity Measurement"
|
||||||
capability "Health Check"
|
capability "Health Check"
|
||||||
|
capability "Sensor"
|
||||||
|
|
||||||
fingerprint endpointId: "01", inClusters: "0001,0003,0020,0402,0B05,FC45", outClusters: "0019,0003"
|
fingerprint endpointId: "01", inClusters: "0001,0003,0020,0402,0B05,FC45", outClusters: "0019,0003"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
metadata {
|
metadata {
|
||||||
definition (name: "Simulated Alarm", namespace: "smartthings/testing", author: "SmartThings") {
|
definition (name: "Simulated Alarm", namespace: "smartthings/testing", author: "SmartThings") {
|
||||||
capability "Alarm"
|
capability "Alarm"
|
||||||
|
capability "Sensor"
|
||||||
|
capability "Actuator"
|
||||||
}
|
}
|
||||||
|
|
||||||
simulator {
|
simulator {
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
metadata {
|
metadata {
|
||||||
definition (name: "Simulated Color Control", namespace: "smartthings/testing", author: "SmartThings") {
|
definition (name: "Simulated Color Control", namespace: "smartthings/testing", author: "SmartThings") {
|
||||||
capability "Color Control"
|
capability "Color Control"
|
||||||
|
capability "Sensor"
|
||||||
|
capability "Actuator"
|
||||||
}
|
}
|
||||||
|
|
||||||
simulator {
|
simulator {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ metadata {
|
|||||||
// Automatically generated. Make future change here.
|
// Automatically generated. Make future change here.
|
||||||
definition (name: "Simulated Contact Sensor", namespace: "smartthings/testing", author: "bob") {
|
definition (name: "Simulated Contact Sensor", namespace: "smartthings/testing", author: "bob") {
|
||||||
capability "Contact Sensor"
|
capability "Contact Sensor"
|
||||||
|
capability "Sensor"
|
||||||
|
|
||||||
command "open"
|
command "open"
|
||||||
command "close"
|
command "close"
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ metadata {
|
|||||||
// Automatically generated. Make future change here.
|
// Automatically generated. Make future change here.
|
||||||
definition (name: "Simulated Lock", namespace: "smartthings/testing", author: "bob") {
|
definition (name: "Simulated Lock", namespace: "smartthings/testing", author: "bob") {
|
||||||
capability "Lock"
|
capability "Lock"
|
||||||
|
capability "Sensor"
|
||||||
|
capability "Actuator"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simulated lock
|
// Simulated lock
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ metadata {
|
|||||||
// Automatically generated. Make future change here.
|
// Automatically generated. Make future change here.
|
||||||
definition (name: "Simulated Motion Sensor", namespace: "smartthings/testing", author: "bob") {
|
definition (name: "Simulated Motion Sensor", namespace: "smartthings/testing", author: "bob") {
|
||||||
capability "Motion Sensor"
|
capability "Motion Sensor"
|
||||||
|
capability "Sensor"
|
||||||
|
|
||||||
command "active"
|
command "active"
|
||||||
command "inactive"
|
command "inactive"
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ metadata {
|
|||||||
// Automatically generated. Make future change here.
|
// Automatically generated. Make future change here.
|
||||||
definition (name: "Simulated Presence Sensor", namespace: "smartthings/testing", author: "bob") {
|
definition (name: "Simulated Presence Sensor", namespace: "smartthings/testing", author: "bob") {
|
||||||
capability "Presence Sensor"
|
capability "Presence Sensor"
|
||||||
|
capability "Sensor"
|
||||||
|
|
||||||
command "arrived"
|
command "arrived"
|
||||||
command "departed"
|
command "departed"
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ metadata {
|
|||||||
definition (name: "Simulated Switch", namespace: "smartthings/testing", author: "bob") {
|
definition (name: "Simulated Switch", namespace: "smartthings/testing", author: "bob") {
|
||||||
capability "Switch"
|
capability "Switch"
|
||||||
capability "Relay Switch"
|
capability "Relay Switch"
|
||||||
|
capability "Sensor"
|
||||||
|
capability "Actuator"
|
||||||
|
|
||||||
command "onPhysical"
|
command "onPhysical"
|
||||||
command "offPhysical"
|
command "offPhysical"
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ metadata {
|
|||||||
definition (name: "Simulated Temperature Sensor", namespace: "smartthings/testing", author: "SmartThings") {
|
definition (name: "Simulated Temperature Sensor", namespace: "smartthings/testing", author: "SmartThings") {
|
||||||
capability "Temperature Measurement"
|
capability "Temperature Measurement"
|
||||||
capability "Switch Level"
|
capability "Switch Level"
|
||||||
|
capability "Sensor"
|
||||||
|
|
||||||
command "up"
|
command "up"
|
||||||
command "down"
|
command "down"
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ metadata {
|
|||||||
definition (name: "Simulated Thermostat", namespace: "smartthings/testing", author: "SmartThings") {
|
definition (name: "Simulated Thermostat", namespace: "smartthings/testing", author: "SmartThings") {
|
||||||
capability "Thermostat"
|
capability "Thermostat"
|
||||||
capability "Relative Humidity Measurement"
|
capability "Relative Humidity Measurement"
|
||||||
|
capability "Sensor"
|
||||||
|
capability "Actuator"
|
||||||
|
|
||||||
command "tempUp"
|
command "tempUp"
|
||||||
command "tempDown"
|
command "tempDown"
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ metadata {
|
|||||||
// Automatically generated. Make future change here.
|
// Automatically generated. Make future change here.
|
||||||
definition (name: "Simulated Water Sensor", namespace: "smartthings/testing", author: "SmartThings") {
|
definition (name: "Simulated Water Sensor", namespace: "smartthings/testing", author: "SmartThings") {
|
||||||
capability "Water Sensor"
|
capability "Water Sensor"
|
||||||
|
capability "Sensor"
|
||||||
|
|
||||||
command "wet"
|
command "wet"
|
||||||
command "dry"
|
command "dry"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
* for the specific language governing permissions and limitations under the License.
|
* for the specific language governing permissions and limitations under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
import physicalgraph.zigbee.clusters.iaszone.ZoneStatus
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Tyco Door/Window Sensor", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Tyco Door/Window Sensor", namespace: "smartthings", author: "SmartThings") {
|
||||||
@@ -161,40 +162,9 @@ private Map parseCustomMessage(String description) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map parseIasMessage(String description) {
|
private Map parseIasMessage(String description) {
|
||||||
List parsedMsg = description.split(' ')
|
ZoneStatus zs = zigbee.parseZoneStatus(description)
|
||||||
String msgCode = parsedMsg[2]
|
|
||||||
|
|
||||||
Map resultMap = [:]
|
return zs.isAlarm1Set() ? getContactResult('open') : getContactResult('closed')
|
||||||
switch(msgCode) {
|
|
||||||
case '0x0020': // Closed/No Motion/Dry
|
|
||||||
resultMap = getContactResult('closed')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0021': // Open/Motion/Wet
|
|
||||||
resultMap = getContactResult('open')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0022': // Tamper Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0023': // Battery Alarm
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0024': // Supervision Report
|
|
||||||
resultMap = getContactResult('closed')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0025': // Restore Report
|
|
||||||
resultMap = getContactResult('open')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0026': // Trouble/Failure
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0028': // Test Mode
|
|
||||||
break
|
|
||||||
}
|
|
||||||
return resultMap
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def getTemperature(value) {
|
def getTemperature(value) {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ metadata {
|
|||||||
capability "Switch"
|
capability "Switch"
|
||||||
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006"
|
||||||
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0006", outClusters: "0003, 0006, 0019, 0406", manufacturer: "Leviton", model: "ZSS-10", deviceJoinName: "Leviton Switch"
|
||||||
}
|
}
|
||||||
|
|
||||||
// simulator metadata
|
// simulator metadata
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 SmartThings
|
* Copyright 2016 SmartThings
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
* 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:
|
* in compliance with the License. You may obtain a copy of the License at:
|
||||||
@@ -11,100 +11,133 @@
|
|||||||
* for the specific language governing permissions and limitations under the License.
|
* for the specific language governing permissions and limitations under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
* Capabilities
|
|
||||||
* - Battery
|
|
||||||
* - Configuration
|
|
||||||
* - Refresh
|
|
||||||
* - Switch
|
|
||||||
* - Valve
|
|
||||||
*/
|
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Zigbee Valve", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "ZigBee Valve", namespace: "smartthings", author: "SmartThings") {
|
||||||
capability "Battery"
|
capability "Actuator"
|
||||||
capability "Configuration"
|
capability "Battery"
|
||||||
capability "Refresh"
|
capability "Configuration"
|
||||||
capability "Switch"
|
capability "Power Source"
|
||||||
capability "Valve"
|
capability "Refresh"
|
||||||
|
capability "Valve"
|
||||||
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000,0001,0003,0004,0005,0020,0006,0B02", outClusters: "0003"
|
fingerprint profileId: "0104", inClusters: "0000, 0001, 0003, 0006, 0020, 0B02, FC02", outClusters: "0019", manufacturer: "WAXMAN", model: "leakSMART Water Valve v2.10", deviceJoinName: "leakSMART Valve"
|
||||||
}
|
fingerprint profileId: "0104", inClusters: "0000, 0001, 0003, 0004, 0005, 0006, 0008, 000F, 0020, 0B02", outClusters: "0003, 0019", manufacturer: "WAXMAN", model: "House Water Valve - MDL-TBD", deviceJoinName: "Waxman House Water Valve"
|
||||||
|
}
|
||||||
|
|
||||||
// simulator metadata
|
// simulator metadata
|
||||||
simulator {
|
simulator {
|
||||||
// status messages
|
// status messages
|
||||||
status "on": "on/off: 1"
|
status "on": "on/off: 1"
|
||||||
status "off": "on/off: 0"
|
status "off": "on/off: 0"
|
||||||
|
|
||||||
// reply messages
|
// reply messages
|
||||||
reply "zcl on-off on": "on/off: 1"
|
reply "zcl on-off on": "on/off: 1"
|
||||||
reply "zcl on-off off": "on/off: 0"
|
reply "zcl on-off off": "on/off: 0"
|
||||||
}
|
}
|
||||||
|
|
||||||
// UI tile definitions
|
tiles(scale: 2) {
|
||||||
tiles {
|
multiAttributeTile(name:"valve", type: "generic", width: 6, height: 4, canChangeIcon: true){
|
||||||
standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
|
tileAttribute ("device.contact", key: "PRIMARY_CONTROL") {
|
||||||
state "off", label: 'closed', action: "switch.on", icon: "st.Outdoor.outdoor16", backgroundColor: "#e86d13"
|
attributeState "open", label: '${name}', action: "valve.close", icon: "st.valves.water.open", backgroundColor: "#53a7c0", nextState:"closing"
|
||||||
state "on", label: 'open', action: "switch.off", icon: "st.Outdoor.outdoor16", backgroundColor: "#53a7c0"
|
attributeState "closed", label: '${name}', action: "valve.open", icon: "st.valves.water.closed", backgroundColor: "#e86d13", nextState:"opening"
|
||||||
}
|
attributeState "opening", label: '${name}', action: "valve.close", icon: "st.valves.water.open", backgroundColor: "#53a7c0", nextState:"closing"
|
||||||
main "switch"
|
attributeState "closing", label: '${name}', action: "valve.open", icon: "st.valves.water.closed", backgroundColor: "#e86d13", nextState:"opening"
|
||||||
details(["switch"])
|
}
|
||||||
}
|
tileAttribute ("powerSource", key: "SECONDARY_CONTROL") {
|
||||||
|
attributeState "powerSource", label:'Power Source: ${currentValue}'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
valueTile("battery", "device.battery", inactiveLabel:false, decoration:"flat", width:2, height:2) {
|
||||||
|
state "battery", label:'${currentValue}% battery', unit:""
|
||||||
|
}
|
||||||
|
|
||||||
|
standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
|
||||||
|
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
|
||||||
|
}
|
||||||
|
|
||||||
|
main(["valve"])
|
||||||
|
details(["valve", "battery", "refresh"])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getCLUSTER_BASIC() { 0x0000 }
|
||||||
|
private getBASIC_ATTR_POWER_SOURCE() { 0x0007 }
|
||||||
|
private getCLUSTER_POWER() { 0x0001 }
|
||||||
|
private getPOWER_ATTR_BATTERY_PERCENTAGE_REMAINING() { 0x0021 }
|
||||||
|
private getTYPE_U8() { 0x20 }
|
||||||
|
private getTYPE_ENUM8() { 0x30 }
|
||||||
|
|
||||||
// Parse incoming device messages to generate events
|
// Parse incoming device messages to generate events
|
||||||
def parse(String description) {
|
def parse(String description) {
|
||||||
log.info description
|
log.debug "description is $description"
|
||||||
if (description?.startsWith("catchall:")) {
|
def event = zigbee.getEvent(description)
|
||||||
def value = name == "switch" ? (description?.endsWith(" 1") ? "on" : "off") : null
|
if (event) {
|
||||||
def result = createEvent(name: name, value: value)
|
if(event.name == "switch") {
|
||||||
def msg = zigbee.parse(description)
|
event.name = "contact" //0006 cluster in valve is tied to contact
|
||||||
log.debug "Parse returned ${result?.descriptionText}"
|
if(event.value == "on") {
|
||||||
return result
|
event.value = "open"
|
||||||
log.trace msg
|
}
|
||||||
log.trace "data: $msg.data"
|
else if(event.value == "off") {
|
||||||
}
|
event.value = "closed"
|
||||||
else {
|
}
|
||||||
def name = description?.startsWith("on/off: ") ? "switch" : null
|
}
|
||||||
def value = name == "switch" ? (description?.endsWith(" 1") ? "on" : "off") : null
|
sendEvent(event)
|
||||||
def result = createEvent(name: name, value: value)
|
}
|
||||||
log.debug "Parse returned ${result?.descriptionText}"
|
else {
|
||||||
return result
|
def descMap = zigbee.parseDescriptionAsMap(description)
|
||||||
}
|
if (descMap.clusterInt == CLUSTER_BASIC && descMap.attrInt == BASIC_ATTR_POWER_SOURCE){
|
||||||
}
|
def value = descMap.value
|
||||||
|
if (value == "01" || value == "02") {
|
||||||
// Commands to device
|
sendEvent(name: "powerSource", value: "Mains")
|
||||||
def on() {
|
}
|
||||||
log.debug "on()"
|
else if (value == "03") {
|
||||||
sendEvent(name: "switch", value: "on")
|
sendEvent(name: "powerSource", value: "Battery")
|
||||||
"st cmd 0x${device.deviceNetworkId} 1 6 1 {}"
|
}
|
||||||
}
|
else if (value == "04") {
|
||||||
|
sendEvent(name: "powerSource", value: "DC")
|
||||||
def off() {
|
}
|
||||||
log.debug "off()"
|
else {
|
||||||
sendEvent(name: "switch", value: "off")
|
sendEvent(name: "powerSource", value: "Unknown")
|
||||||
"st cmd 0x${device.deviceNetworkId} 1 6 0 {}"
|
}
|
||||||
|
}
|
||||||
|
else if (descMap.clusterInt == CLUSTER_POWER && descMap.attrInt == POWER_ATTR_BATTERY_PERCENTAGE_REMAINING) {
|
||||||
|
event.name = "battery"
|
||||||
|
event.value = Math.round(Integer.parseInt(descMap.value, 16) / 2)
|
||||||
|
sendEvent(event)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log.warn "DID NOT PARSE MESSAGE for description : $description"
|
||||||
|
log.debug descMap
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def open() {
|
def open() {
|
||||||
log.debug "on()"
|
zigbee.on()
|
||||||
sendEvent(name: "switch", value: "on")
|
|
||||||
"st cmd 0x${device.deviceNetworkId} 1 6 1 {}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def close() {
|
def close() {
|
||||||
log.debug "off()"
|
zigbee.off()
|
||||||
sendEvent(name: "switch", value: "off")
|
|
||||||
"st cmd 0x${device.deviceNetworkId} 1 6 0 {}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
log.debug "sending refresh command"
|
log.debug "refresh called"
|
||||||
"st rattr 0x${device.deviceNetworkId} 1 6 0"
|
zigbee.onOffRefresh() +
|
||||||
|
zigbee.readAttribute(CLUSTER_BASIC, BASIC_ATTR_POWER_SOURCE) +
|
||||||
|
zigbee.readAttribute(CLUSTER_POWER, POWER_ATTR_BATTERY_PERCENTAGE_REMAINING) +
|
||||||
|
zigbee.onOffConfig() +
|
||||||
|
zigbee.configureReporting(CLUSTER_POWER, POWER_ATTR_BATTERY_PERCENTAGE_REMAINING, TYPE_U8, 600, 21600, 1) +
|
||||||
|
zigbee.configureReporting(CLUSTER_BASIC, BASIC_ATTR_POWER_SOURCE, TYPE_ENUM8, 5, 21600, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
def configure() {
|
def configure() {
|
||||||
|
log.debug "Configuring Reporting and Bindings."
|
||||||
"zdo bind 0x${device.deviceNetworkId} 1 1 6 {${device.zigbeeId}} {}"
|
zigbee.onOffConfig() +
|
||||||
|
zigbee.configureReporting(CLUSTER_POWER, POWER_ATTR_BATTERY_PERCENTAGE_REMAINING, TYPE_U8, 600, 21600, 1) +
|
||||||
|
zigbee.configureReporting(CLUSTER_BASIC, BASIC_ATTR_POWER_SOURCE, TYPE_ENUM8, 5, 21600, 1) +
|
||||||
|
zigbee.onOffRefresh() +
|
||||||
|
zigbee.readAttribute(CLUSTER_BASIC, BASIC_ATTR_POWER_SOURCE) +
|
||||||
|
zigbee.readAttribute(CLUSTER_POWER, POWER_ATTR_BATTERY_PERCENTAGE_REMAINING)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,17 +24,24 @@ definition(
|
|||||||
iconX3Url: "http://www.gidjit.com/appicon@3x.png",
|
iconX3Url: "http://www.gidjit.com/appicon@3x.png",
|
||||||
oauth: [displayName: "Gidjit", displayLink: "www.gidjit.com"])
|
oauth: [displayName: "Gidjit", displayLink: "www.gidjit.com"])
|
||||||
|
|
||||||
|
preferences(oauthPage: "deviceAuthorization") {
|
||||||
|
// deviceAuthorization page is simply the devices to authorize
|
||||||
|
page(name: "deviceAuthorization", title: "Device Authorization", nextPage: "instructionPage",
|
||||||
|
install: false, uninstall: true) {
|
||||||
|
section ("Allow Gidjit to have access, thereby allowing you to quickly control and monitor your following devices. Privacy Policy can be found at http://priv.gidjit.com/privacy.html") {
|
||||||
|
input "switches", "capability.switch", title: "Control/Monitor your switches", multiple: true, required: false
|
||||||
|
input "thermostats", "capability.thermostat", title: "Control/Monitor your thermostats", multiple: true, required: false
|
||||||
|
input "windowShades", "capability.windowShade", title: "Control/Monitor your window shades", multiple: true, required: false //windowShade
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
preferences {
|
page(name: "instructionPage", title: "Device Discovery", install: true) {
|
||||||
section ("Allow Gidjit to have access, there by allowing you to quickly control and monitor the following devices") {
|
section() {
|
||||||
input "switches", "capability.switch", title: "Control/Monitor your switches", multiple: true, required: false
|
paragraph "Now the process is complete return to the Devices section of the Detected Screen. From there and you can add actions to each of your device panels, including launching SmartThings routines."
|
||||||
input "thermostats", "capability.thermostat", title: "Control/Monitor your thermostats", multiple: true, required: false
|
}
|
||||||
input "windowShades", "capability.windowShade", title: "Control/Monitor your window shades", multiple: true, required: false //windowShade
|
}
|
||||||
//input "bulbs", "capability.colorControl", title: "Control your lights", multiple: true, required: false //windowShade
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mappings {
|
mappings {
|
||||||
path("/structureinfo") {
|
path("/structureinfo") {
|
||||||
action: [
|
action: [
|
||||||
|
|||||||
Reference in New Issue
Block a user