diff --git a/devicetypes/smartthings/homeseer-multisensor.src/homeseer-multisensor.groovy b/devicetypes/smartthings/homeseer-multisensor.src/homeseer-multisensor.groovy index b6d495e..778eda8 100644 --- a/devicetypes/smartthings/homeseer-multisensor.src/homeseer-multisensor.groovy +++ b/devicetypes/smartthings/homeseer-multisensor.src/homeseer-multisensor.groovy @@ -80,19 +80,12 @@ def parse(String description) { if (cmd) { result = zwaveEvent(cmd) } - // log.debug "Parsed ${description.inspect()} to ${result.inspect()}" + log.debug "Parsed ${description.inspect()} to ${result.inspect()}" return result } def zwaveEvent(physicalgraph.zwave.commands.multiinstancev1.MultiInstanceCmdEncap cmd) { - def encapsulated = null - if (cmd.respondsTo("encapsulatedCommand")) { - encapsulated = cmd.encapsulatedCommand() - } else { - def hex1 = { n -> String.format("%02X", n) } - def sorry = "command: ${hex1(cmd.commandClass)}${hex1(cmd.command)}, payload: " + cmd.parameter.collect{ hex1(it) }.join(" ") - encapsulated = zwave.parse(sorry, [0x31: 1, 0x84: 2, 0x60: 1, 0x85: 1, 0x70: 1]) - } + def encapsulated = cmd.encapsulatedCommand([0x31: 1, 0x84: 2, 0x60: 1, 0x85: 1, 0x70: 1]) return encapsulated ? zwaveEvent(encapsulated) : null } 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 7c6a423..de53cb3 100644 --- a/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy +++ b/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy @@ -487,11 +487,6 @@ def enrollResponse() { } private Map parseAxis(String description) { - def hexToSignedInt = { hexVal -> - def unsignedVal = hexToInt(hexVal) - unsignedVal > 32767 ? unsignedVal - 65536 : unsignedVal - } - def z = hexToSignedInt(description[0..3]) def y = hexToSignedInt(description[10..13]) def x = hexToSignedInt(description[20..23]) @@ -518,6 +513,11 @@ private Map parseAxis(String description) { getXyzResult(xyzResults, description) } +private hexToSignedInt(hexVal) { + def unsignedVal = hexToInt(hexVal) + unsignedVal > 32767 ? unsignedVal - 65536 : unsignedVal +} + def garageEvent(zValue) { def absValue = zValue.abs() def contactValue = null