mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-04-09 06:13:07 +01:00
Fix whitespace issues - no code changes
Replaced spaces with tabs for indentation and removed some unnecessary white space.
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "SmartSense Multi Sensor", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "SmartSense Multi Sensor", namespace: "smartthings", author: "SmartThings") {
|
||||||
|
|
||||||
capability "Three Axis"
|
capability "Three Axis"
|
||||||
@@ -141,7 +141,7 @@ def parse(String description) {
|
|||||||
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)
|
||||||
log.debug cluster
|
log.debug cluster
|
||||||
@@ -166,7 +166,7 @@ def parse(String description) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
@@ -302,7 +302,7 @@ def getTemperature(value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map getBatteryResult(rawValue) {
|
private Map getBatteryResult(rawValue) {
|
||||||
log.debug "Battery"
|
log.debug "Battery"
|
||||||
log.debug rawValue
|
log.debug rawValue
|
||||||
def linkText = getLinkText(device)
|
def linkText = getLinkText(device)
|
||||||
@@ -317,7 +317,6 @@ def getTemperature(value) {
|
|||||||
|
|
||||||
if (rawValue == 255) {}
|
if (rawValue == 255) {}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
if (volts > 3.5) {
|
if (volts > 3.5) {
|
||||||
result.descriptionText = "${linkText} battery has too much power (${volts} volts)."
|
result.descriptionText = "${linkText} battery has too much power (${volts} volts)."
|
||||||
}
|
}
|
||||||
@@ -327,12 +326,13 @@ def getTemperature(value) {
|
|||||||
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 = "${linkText} battery was ${result.value}%"
|
result.descriptionText = "${linkText} battery was ${result.value}%"
|
||||||
}}
|
}
|
||||||
|
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map getTemperatureResult(value) {
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map getTemperatureResult(value) {
|
||||||
log.debug "Temperature"
|
log.debug "Temperature"
|
||||||
def linkText = getLinkText(device)
|
def linkText = getLinkText(device)
|
||||||
if (tempOffset) {
|
if (tempOffset) {
|
||||||
@@ -346,17 +346,17 @@ def getTemperature(value) {
|
|||||||
value: value,
|
value: value,
|
||||||
descriptionText: descriptionText
|
descriptionText: descriptionText
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map getContactResult(value) {
|
private Map getContactResult(value) {
|
||||||
log.debug "Contact"
|
log.debug "Contact"
|
||||||
def linkText = getLinkText(device)
|
def linkText = getLinkText(device)
|
||||||
def descriptionText = "${linkText} was ${value == 'open' ? 'opened' : 'closed'}"
|
def descriptionText = "${linkText} was ${value == 'open' ? 'opened' : 'closed'}"
|
||||||
sendEvent(name: 'contact', value: value, descriptionText: descriptionText, displayed:false)
|
sendEvent(name: 'contact', value: value, descriptionText: descriptionText, displayed:false)
|
||||||
sendEvent(name: 'status', value: value, descriptionText: descriptionText)
|
sendEvent(name: 'status', value: value, descriptionText: descriptionText)
|
||||||
}
|
}
|
||||||
|
|
||||||
private getAccelerationResult(numValue) {
|
private getAccelerationResult(numValue) {
|
||||||
log.debug "Acceleration"
|
log.debug "Acceleration"
|
||||||
def name = "acceleration"
|
def name = "acceleration"
|
||||||
def value = numValue.endsWith("1") ? "active" : "inactive"
|
def value = numValue.endsWith("1") ? "active" : "inactive"
|
||||||
@@ -369,18 +369,16 @@ def getTemperature(value) {
|
|||||||
descriptionText: descriptionText,
|
descriptionText: descriptionText,
|
||||||
isStateChange: isStateChange
|
isStateChange: isStateChange
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
log.debug "Refreshing Values "
|
log.debug "Refreshing Values "
|
||||||
|
|
||||||
def refreshCmds = []
|
def refreshCmds = []
|
||||||
|
|
||||||
if (device.getDataValue("manufacturer") == "SmartThings") {
|
if (device.getDataValue("manufacturer") == "SmartThings") {
|
||||||
|
|
||||||
log.debug "Refreshing Values for manufacturer: SmartThings "
|
log.debug "Refreshing Values for manufacturer: SmartThings "
|
||||||
refreshCmds = refreshCmds + [
|
refreshCmds = refreshCmds + [
|
||||||
|
|
||||||
/* These values of Motion Threshold Multiplier(01) and Motion Threshold (7602)
|
/* These values of Motion Threshold Multiplier(01) and Motion Threshold (7602)
|
||||||
seem to be giving pretty accurate results for the XYZ co-ordinates for this manufacturer.
|
seem to be giving pretty accurate results for the XYZ co-ordinates for this manufacturer.
|
||||||
Separating these out in a separate if-else because I do not want to touch Centralite part
|
Separating these out in a separate if-else because I do not want to touch Centralite part
|
||||||
@@ -394,13 +392,9 @@ def getTemperature(value) {
|
|||||||
"zcl mfg-code ${manufacturerCode}", "delay 200",
|
"zcl mfg-code ${manufacturerCode}", "delay 200",
|
||||||
"zcl global write 0xFC02 2 0x21 {7602}", "delay 200",
|
"zcl global write 0xFC02 2 0x21 {7602}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 1", "delay 400",
|
"send 0x${device.deviceNetworkId} 1 1", "delay 400",
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
refreshCmds = refreshCmds + [
|
refreshCmds = refreshCmds + [
|
||||||
|
|
||||||
/* sensitivity - default value (8) */
|
/* sensitivity - default value (8) */
|
||||||
"zcl mfg-code ${manufacturerCode}", "delay 200",
|
"zcl mfg-code ${manufacturerCode}", "delay 200",
|
||||||
"zcl global write 0xFC02 0 0x20 {02}", "delay 200",
|
"zcl global write 0xFC02 0 0x20 {02}", "delay 200",
|
||||||
@@ -419,15 +413,13 @@ def getTemperature(value) {
|
|||||||
]
|
]
|
||||||
|
|
||||||
return refreshCmds + enrollResponse()
|
return refreshCmds + enrollResponse()
|
||||||
}
|
}
|
||||||
|
|
||||||
def configure() {
|
|
||||||
|
|
||||||
|
def configure() {
|
||||||
String zigbeeEui = swapEndianHex(device.hub.zigbeeEui)
|
String zigbeeEui = swapEndianHex(device.hub.zigbeeEui)
|
||||||
log.debug "Configuring Reporting"
|
log.debug "Configuring Reporting"
|
||||||
|
|
||||||
def configCmds = [
|
def configCmds = [
|
||||||
|
|
||||||
"zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200",
|
"zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500",
|
||||||
|
|
||||||
@@ -455,7 +447,6 @@ def getTemperature(value) {
|
|||||||
"zcl mfg-code ${manufacturerCode}",
|
"zcl mfg-code ${manufacturerCode}",
|
||||||
"zcl global send-me-a-report 0xFC02 0x0014 0x29 1 3600 {01}",
|
"zcl global send-me-a-report 0xFC02 0x0014 0x29 1 3600 {01}",
|
||||||
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500"
|
"send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500"
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
return configCmds + refresh()
|
return configCmds + refresh()
|
||||||
@@ -582,5 +573,3 @@ private byte[] reverseArray(byte[] array) {
|
|||||||
}
|
}
|
||||||
return array
|
return array
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user