diff --git a/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy b/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy index 62a7fc3..033708a 100644 --- a/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy +++ b/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy @@ -192,6 +192,10 @@ private List parseAxis(List attrData) { def y = hexToSignedInt(attrData.find { it.attrInt == 0x0013 }?.value) def z = hexToSignedInt(attrData.find { it.attrInt == 0x0014 }?.value) + if ([x, y ,z].any { it == null }) { + return [] + } + def xyzResults = [:] if (device.getDataValue("manufacturer") == "SmartThings") { // This mapping matches the current behavior of the Device Handler for the Centralite sensors @@ -372,6 +376,10 @@ def updated() { } private hexToSignedInt(hexVal) { + if (!hexVal) { + return null + } + def unsignedVal = hexToInt(hexVal) unsignedVal > 32767 ? unsignedVal - 65536 : unsignedVal }