mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 05:31:56 +00:00
Merge pull request #1934 from SmartThingsCommunity/multi-sensor-accel-fix
DVCSMP-2573: Acceleration axis validation (Multi sensor DTH)
This commit is contained in:
@@ -192,6 +192,10 @@ private List<Map> parseAxis(List<Map> attrData) {
|
|||||||
def y = hexToSignedInt(attrData.find { it.attrInt == 0x0013 }?.value)
|
def y = hexToSignedInt(attrData.find { it.attrInt == 0x0013 }?.value)
|
||||||
def z = hexToSignedInt(attrData.find { it.attrInt == 0x0014 }?.value)
|
def z = hexToSignedInt(attrData.find { it.attrInt == 0x0014 }?.value)
|
||||||
|
|
||||||
|
if ([x, y ,z].any { it == null }) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
def xyzResults = [:]
|
def xyzResults = [:]
|
||||||
if (device.getDataValue("manufacturer") == "SmartThings") {
|
if (device.getDataValue("manufacturer") == "SmartThings") {
|
||||||
// This mapping matches the current behavior of the Device Handler for the Centralite sensors
|
// This mapping matches the current behavior of the Device Handler for the Centralite sensors
|
||||||
@@ -372,6 +376,10 @@ def updated() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private hexToSignedInt(hexVal) {
|
private hexToSignedInt(hexVal) {
|
||||||
|
if (!hexVal) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
def unsignedVal = hexToInt(hexVal)
|
def unsignedVal = hexToInt(hexVal)
|
||||||
unsignedVal > 32767 ? unsignedVal - 65536 : unsignedVal
|
unsignedVal > 32767 ? unsignedVal - 65536 : unsignedVal
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user