From 140431d3bf8f4a2df60fce8c9e2b49be97424480 Mon Sep 17 00:00:00 2001 From: Vinay Rao Date: Wed, 5 Aug 2015 10:27:10 -0700 Subject: [PATCH] fixing errors due to missing if case parsing OTA data --- .../smartpower-outlet.src/smartpower-outlet.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy b/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy index d2302b8..fda4a4d 100644 --- a/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy +++ b/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy @@ -60,8 +60,8 @@ def parse(String description) { if (descMap.cluster == "0006" && descMap.attrId == "0000") { name = "switch" value = descMap.value.endsWith("01") ? "on" : "off" - } else { - def reportValue = description.split(",").find {it.split(":")[0].trim() == "value"}?.split(":")[1].trim() + } else if (descMap.cluster.equalsIgnoreCase("0B04") && descMap.attrId.equalsIgnoreCase("050b")) { + def reportValue = descMap.value name = "power" // assume 16 bit signed for encoding and power divisor is 10 value = Integer.parseInt(reportValue, 16) / 10