From 69a6fc4f9e3420b002d980420959fd0b6d9bc571 Mon Sep 17 00:00:00 2001 From: Oso Technologies Date: Wed, 17 Feb 2016 13:34:04 -0600 Subject: [PATCH] MSA-884: This is a quick update to a previously published device handler to accept the "update" packet that occurs when the zigbee pairs with the hub to stop an exception due to it not being in the map format that other packets are in. --- devicetypes/osotech/plantlink.src/plantlink.groovy | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/devicetypes/osotech/plantlink.src/plantlink.groovy b/devicetypes/osotech/plantlink.src/plantlink.groovy index b1eb898..1633fb5 100644 --- a/devicetypes/osotech/plantlink.src/plantlink.groovy +++ b/devicetypes/osotech/plantlink.src/plantlink.groovy @@ -120,7 +120,7 @@ def setInstallSmartApp(value){ } def parse(String description) { - + log.debug description def description_map = parseDescriptionAsMap(description) def event_name = "" def measurement_map = [ @@ -129,10 +129,7 @@ def parse(String description) { zigbeedeviceid: device.zigbeeId, created: new Date().time /1000 as int ] - if (description_map.cluster == "0000"){ - /* version number, not used */ - - } else if (description_map.cluster == "0001"){ + if (description_map.cluster == "0001"){ /* battery voltage in mV (device needs minimium 2.1v to run) */ log.debug "PlantLink - id ${device.zigbeeId} battery ${description_map.value}" event_name = "battery_status" @@ -158,6 +155,10 @@ def parse(String description) { def parseDescriptionAsMap(description) { (description - "read attr - ").split(",").inject([:]) { map, param -> def nameAndValue = param.split(":") - map += [(nameAndValue[0].trim()):nameAndValue[1].trim()] + if(nameAndValue.length == 2){ + map += [(nameAndValue[0].trim()):nameAndValue[1].trim()] + }else{ + map += [] + } } } \ No newline at end of file