mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-24 21:04:00 +00:00
INTL-289 revert white space and fingerprint removal changes
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
#==============================================================================
|
#==============================================================================
|
||||||
# Copyright 2016 SmartThings
|
# Copyright 2016 SmartThings
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
# 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
|
# use this file except in compliance with the License. You may obtain a copy
|
||||||
# of the License at:
|
# of the License at:
|
||||||
#
|
#
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
# Purpose: SmartSense Motion Sensor i18n Translation File
|
# Purpose: SmartSense Motion Sensor i18n Translation File
|
||||||
@@ -35,5 +35,5 @@
|
|||||||
'''{{ device.displayName }} was {{ value }}°C'''.ko={{ device.displayName }}이(가){{ value }}°C였습니다.
|
'''{{ device.displayName }} was {{ value }}°C'''.ko={{ device.displayName }}이(가){{ value }}°C였습니다.
|
||||||
'''{{ device.displayName }} was {{ value }}°F'''.ko={{ device.displayName }}이(가) {{ value }}°F였습니다
|
'''{{ device.displayName }} was {{ value }}°F'''.ko={{ device.displayName }}이(가) {{ value }}°F였습니다
|
||||||
'''{{ device.displayName }} battery has too much power: (> 3.5) volts.'''.ko={{ device.displayName }} 배터리 전력이 너무 높습니다(3.5볼트 초과).
|
'''{{ device.displayName }} battery has too much power: (> 3.5) volts.'''.ko={{ device.displayName }} 배터리 전력이 너무 높습니다(3.5볼트 초과).
|
||||||
'''{{ device.displayName }} battery was {{ value }}'''.ko={{ device.displayName }}남아있는 배터리는 {{ value }}입니다.
|
'''{{ device.displayName }} battery was {{ value }}%'''.ko={{ device.displayName }}남아있는 배터리는 {{ value }}%입니다.
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
|
|||||||
@@ -3,15 +3,15 @@
|
|||||||
* Copyright 2016 SmartThings
|
* Copyright 2016 SmartThings
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
* 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
|
* use this file except in compliance with the License. You may obtain a copy
|
||||||
* of the License at:
|
* of the License at:
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
* License for the specific language governing permissions and limitations
|
* License for the specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
===============================================================================
|
===============================================================================
|
||||||
* Purpose: SmartSense Motion Sensor DTH File
|
* Purpose: SmartSense Motion Sensor DTH File
|
||||||
@@ -29,17 +29,18 @@ metadata {
|
|||||||
capability "Motion Sensor"
|
capability "Motion Sensor"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
capability "Temperature Measurement"
|
capability "Temperature Measurement"
|
||||||
capability "Refresh"
|
capability "Refresh"
|
||||||
|
|
||||||
command "enrollResponse"
|
command "enrollResponse"
|
||||||
|
|
||||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3305-S"
|
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3305-S"
|
||||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3325-S", deviceJoinName: "Motion Sensor"
|
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3325-S", deviceJoinName: "Motion Sensor"
|
||||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3305"
|
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3305"
|
||||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3325"
|
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3325"
|
||||||
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3326"
|
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3326"
|
||||||
fingerprint inClusters: "0000,0001,0003,000F,0020,0402,0500", outClusters: "0019", manufacturer: "SmartThings", model: "motionv4", deviceJoinName: "Motion Sensor"
|
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05", outClusters: "0019", manufacturer: "CentraLite", model: "3326-L", deviceJoinName: "Iris Motion Sensor"
|
||||||
|
fingerprint inClusters: "0000,0001,0003,000F,0020,0402,0500", outClusters: "0019", manufacturer: "SmartThings", model: "motionv4", deviceJoinName: "Motion Sensor"
|
||||||
}
|
}
|
||||||
|
|
||||||
simulator {
|
simulator {
|
||||||
@@ -95,7 +96,7 @@ metadata {
|
|||||||
|
|
||||||
def parse(String description) {
|
def parse(String description) {
|
||||||
log.debug "description: $description"
|
log.debug "description: $description"
|
||||||
|
|
||||||
Map map = [:]
|
Map map = [:]
|
||||||
if (description?.startsWith('catchall:')) {
|
if (description?.startsWith('catchall:')) {
|
||||||
map = parseCatchAllMessage(description)
|
map = parseCatchAllMessage(description)
|
||||||
@@ -106,55 +107,55 @@ def parse(String description) {
|
|||||||
else if (description?.startsWith('temperature: ')) {
|
else if (description?.startsWith('temperature: ')) {
|
||||||
map = parseCustomMessage(description)
|
map = parseCustomMessage(description)
|
||||||
}
|
}
|
||||||
else if (description?.startsWith('zone status')) {
|
else if (description?.startsWith('zone status')) {
|
||||||
map = parseIasMessage(description)
|
map = parseIasMessage(description)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.debug "Parse returned $map"
|
log.debug "Parse returned $map"
|
||||||
def result = map ? createEvent(map) : null
|
def result = map ? createEvent(map) : null
|
||||||
|
|
||||||
if (description?.startsWith('enroll request')) {
|
if (description?.startsWith('enroll request')) {
|
||||||
List cmds = enrollResponse()
|
List cmds = enrollResponse()
|
||||||
log.debug "enroll response: ${cmds}"
|
log.debug "enroll response: ${cmds}"
|
||||||
result = cmds?.collect { new physicalgraph.device.HubAction(it) }
|
result = cmds?.collect { new physicalgraph.device.HubAction(it) }
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map parseCatchAllMessage(String description) {
|
private Map parseCatchAllMessage(String description) {
|
||||||
Map resultMap = [:]
|
Map resultMap = [:]
|
||||||
def cluster = zigbee.parse(description)
|
def cluster = zigbee.parse(description)
|
||||||
if (shouldProcessMessage(cluster)) {
|
if (shouldProcessMessage(cluster)) {
|
||||||
switch(cluster.clusterId) {
|
switch(cluster.clusterId) {
|
||||||
case 0x0001:
|
case 0x0001:
|
||||||
resultMap = getBatteryResult(cluster.data.last())
|
resultMap = getBatteryResult(cluster.data.last())
|
||||||
break
|
break
|
||||||
|
|
||||||
case 0x0402:
|
case 0x0402:
|
||||||
// temp is last 2 data values. reverse to swap endian
|
// temp is last 2 data values. reverse to swap endian
|
||||||
String temp = cluster.data[-2..-1].reverse().collect { cluster.hex1(it) }.join()
|
String temp = cluster.data[-2..-1].reverse().collect { cluster.hex1(it) }.join()
|
||||||
def value = getTemperature(temp)
|
def value = getTemperature(temp)
|
||||||
resultMap = getTemperatureResult(value)
|
resultMap = getTemperatureResult(value)
|
||||||
break
|
break
|
||||||
|
|
||||||
case 0x0406:
|
case 0x0406:
|
||||||
log.debug 'motion'
|
log.debug 'motion'
|
||||||
resultMap.name = 'motion'
|
resultMap.name = 'motion'
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultMap
|
return resultMap
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldProcessMessage(cluster) {
|
private boolean shouldProcessMessage(cluster) {
|
||||||
// 0x0B is default response indicating message got through
|
// 0x0B is default response indicating message got through
|
||||||
// 0x07 is bind message
|
// 0x07 is bind message
|
||||||
boolean ignoredMessage = cluster.profileId != 0x0104 ||
|
boolean ignoredMessage = cluster.profileId != 0x0104 ||
|
||||||
cluster.command == 0x0B ||
|
cluster.command == 0x0B ||
|
||||||
cluster.command == 0x07 ||
|
cluster.command == 0x07 ||
|
||||||
(cluster.data.size() > 0 && cluster.data.first() == 0x3e)
|
(cluster.data.size() > 0 && cluster.data.first() == 0x3e)
|
||||||
return !ignoredMessage
|
return !ignoredMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map parseReportAttributeMessage(String description) {
|
private Map parseReportAttributeMessage(String description) {
|
||||||
@@ -163,7 +164,7 @@ private Map parseReportAttributeMessage(String description) {
|
|||||||
map += [(nameAndValue[0].trim()):nameAndValue[1].trim()]
|
map += [(nameAndValue[0].trim()):nameAndValue[1].trim()]
|
||||||
}
|
}
|
||||||
log.debug "Desc Map: $descMap"
|
log.debug "Desc Map: $descMap"
|
||||||
|
|
||||||
Map resultMap = [:]
|
Map resultMap = [:]
|
||||||
if (descMap.cluster == "0402" && descMap.attrId == "0000") {
|
if (descMap.cluster == "0402" && descMap.attrId == "0000") {
|
||||||
def value = getTemperature(descMap.value)
|
def value = getTemperature(descMap.value)
|
||||||
@@ -172,14 +173,14 @@ private Map parseReportAttributeMessage(String description) {
|
|||||||
else if (descMap.cluster == "0001" && descMap.attrId == "0020") {
|
else if (descMap.cluster == "0001" && descMap.attrId == "0020") {
|
||||||
resultMap = getBatteryResult(Integer.parseInt(descMap.value, 16))
|
resultMap = getBatteryResult(Integer.parseInt(descMap.value, 16))
|
||||||
}
|
}
|
||||||
else if (descMap.cluster == "0406" && descMap.attrId == "0000") {
|
else if (descMap.cluster == "0406" && descMap.attrId == "0000") {
|
||||||
def value = descMap.value.endsWith("01") ? "active" : "inactive"
|
def value = descMap.value.endsWith("01") ? "active" : "inactive"
|
||||||
resultMap = getMotionResult(value)
|
resultMap = getMotionResult(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultMap
|
return resultMap
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map parseCustomMessage(String description) {
|
private Map parseCustomMessage(String description) {
|
||||||
Map resultMap = [:]
|
Map resultMap = [:]
|
||||||
if (description?.startsWith('temperature: ')) {
|
if (description?.startsWith('temperature: ')) {
|
||||||
@@ -190,44 +191,44 @@ private Map parseCustomMessage(String description) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map parseIasMessage(String description) {
|
private Map parseIasMessage(String description) {
|
||||||
List parsedMsg = description.split(' ')
|
List parsedMsg = description.split(' ')
|
||||||
String msgCode = parsedMsg[2]
|
String msgCode = parsedMsg[2]
|
||||||
|
|
||||||
Map resultMap = [:]
|
|
||||||
switch(msgCode) {
|
|
||||||
case '0x0020': // Closed/No Motion/Dry
|
|
||||||
resultMap = getMotionResult('inactive')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0021': // Open/Motion/Wet
|
Map resultMap = [:]
|
||||||
resultMap = getMotionResult('active')
|
switch(msgCode) {
|
||||||
break
|
case '0x0020': // Closed/No Motion/Dry
|
||||||
|
resultMap = getMotionResult('inactive')
|
||||||
|
break
|
||||||
|
|
||||||
case '0x0022': // Tamper Alarm
|
case '0x0021': // Open/Motion/Wet
|
||||||
log.debug 'motion with tamper alarm'
|
resultMap = getMotionResult('active')
|
||||||
resultMap = getMotionResult('active')
|
break
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0023': // Battery Alarm
|
case '0x0022': // Tamper Alarm
|
||||||
break
|
log.debug 'motion with tamper alarm'
|
||||||
|
resultMap = getMotionResult('active')
|
||||||
|
break
|
||||||
|
|
||||||
case '0x0024': // Supervision Report
|
case '0x0023': // Battery Alarm
|
||||||
log.debug 'no motion with tamper alarm'
|
break
|
||||||
resultMap = getMotionResult('inactive')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0025': // Restore Report
|
case '0x0024': // Supervision Report
|
||||||
break
|
log.debug 'no motion with tamper alarm'
|
||||||
|
resultMap = getMotionResult('inactive')
|
||||||
|
break
|
||||||
|
|
||||||
case '0x0026': // Trouble/Failure
|
case '0x0025': // Restore Report
|
||||||
log.debug 'motion with failure alarm'
|
break
|
||||||
resultMap = getMotionResult('active')
|
|
||||||
break
|
|
||||||
|
|
||||||
case '0x0028': // Test Mode
|
case '0x0026': // Trouble/Failure
|
||||||
break
|
log.debug 'motion with failure alarm'
|
||||||
}
|
resultMap = getMotionResult('active')
|
||||||
return resultMap
|
break
|
||||||
|
|
||||||
|
case '0x0028': // Test Mode
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return resultMap
|
||||||
}
|
}
|
||||||
|
|
||||||
def getTemperature(value) {
|
def getTemperature(value) {
|
||||||
@@ -257,7 +258,7 @@ private Map getBatteryResult(rawValue) {
|
|||||||
result.descriptionText = "{{ device.displayName }} battery has too much power: (> 3.5) volts."
|
result.descriptionText = "{{ device.displayName }} battery has too much power: (> 3.5) volts."
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (device.getDataValue("manufacturer") == "SmartThings") {
|
if (device.getDataValue("manufacturer") == "SmartThings") {
|
||||||
volts = rawValue // For the batteryMap to work the key needs to be an int
|
volts = rawValue // For the batteryMap to work the key needs to be an int
|
||||||
def batteryMap = [28:100, 27:100, 26:100, 25:90, 24:90, 23:70,
|
def batteryMap = [28:100, 27:100, 26:100, 25:90, 24:90, 23:70,
|
||||||
22:70, 21:50, 20:50, 19:30, 18:30, 17:15, 16:1, 15:0]
|
22:70, 21:50, 20:50, 19:30, 18:30, 17:15, 16:1, 15:0]
|
||||||
@@ -272,7 +273,7 @@ private Map getBatteryResult(rawValue) {
|
|||||||
if (pct != null) {
|
if (pct != null) {
|
||||||
result.value = pct
|
result.value = pct
|
||||||
def value = pct
|
def value = pct
|
||||||
result.descriptionText = "{{ device.displayName }} battery was {{ value }}"
|
result.descriptionText = "{{ device.displayName }} battery was {{ value }}%"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -280,7 +281,7 @@ private Map getBatteryResult(rawValue) {
|
|||||||
def maxVolts = 3.0
|
def maxVolts = 3.0
|
||||||
def pct = (volts - minVolts) / (maxVolts - minVolts)
|
def pct = (volts - minVolts) / (maxVolts - minVolts)
|
||||||
result.value = Math.min(100, (int) pct * 100)
|
result.value = Math.min(100, (int) pct * 100)
|
||||||
result.descriptionText = "{{ device.displayName }} battery was {{ value }}"
|
result.descriptionText = "{{ device.displayName }} battery was {{ value }}%"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,7 +313,6 @@ private Map getTemperatureResult(value) {
|
|||||||
private Map getMotionResult(value) {
|
private Map getMotionResult(value) {
|
||||||
log.debug 'motion'
|
log.debug 'motion'
|
||||||
String descriptionText = value == 'active' ? "{{ device.displayName }} detected motion" : "{{ device.displayName }} motion has stopped"
|
String descriptionText = value == 'active' ? "{{ device.displayName }} detected motion" : "{{ device.displayName }} motion has stopped"
|
||||||
//String descriptionText = '{{ device.displayName }} is {{ value | translate }}'
|
|
||||||
return [
|
return [
|
||||||
name: 'motion',
|
name: 'motion',
|
||||||
value: value,
|
value: value,
|
||||||
@@ -322,7 +322,7 @@ private Map getMotionResult(value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
log.debug "refresh executed"
|
log.debug "refresh called"
|
||||||
def refreshCmds = [
|
def refreshCmds = [
|
||||||
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 200",
|
"st rattr 0x${device.deviceNetworkId} 1 0x402 0", "delay 200",
|
||||||
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 200"
|
"st rattr 0x${device.deviceNetworkId} 1 1 0x20", "delay 200"
|
||||||
@@ -372,19 +372,19 @@ private hex(value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String swapEndianHex(String hex) {
|
private String swapEndianHex(String hex) {
|
||||||
reverseArray(hex.decodeHex()).encodeHex()
|
reverseArray(hex.decodeHex()).encodeHex()
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] reverseArray(byte[] array) {
|
private byte[] reverseArray(byte[] array) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int j = array.length - 1;
|
int j = array.length - 1;
|
||||||
byte tmp;
|
byte tmp;
|
||||||
while (j > i) {
|
while (j > i) {
|
||||||
tmp = array[j];
|
tmp = array[j];
|
||||||
array[j] = array[i];
|
array[j] = array[i];
|
||||||
array[i] = tmp;
|
array[i] = tmp;
|
||||||
j--;
|
j--;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user