From a5d95fb025f70ad551c278761f280b7a77127e0f Mon Sep 17 00:00:00 2001 From: Zach Varberg Date: Thu, 13 Oct 2016 10:19:20 -0500 Subject: [PATCH] Correctly parse zone status in zigbee-button Previously the DTH didn't handle the extended status from zone status reporting. This moves to use the library for parsing zone status which will handle the extended status properly. This resolves: https://smartthings.atlassian.net/browse/DPROT-180 --- .../smartthings/zigbee-button.src/zigbee-button.groovy | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/devicetypes/smartthings/zigbee-button.src/zigbee-button.groovy b/devicetypes/smartthings/zigbee-button.src/zigbee-button.groovy index 12e06ea..6bd1858 100644 --- a/devicetypes/smartthings/zigbee-button.src/zigbee-button.groovy +++ b/devicetypes/smartthings/zigbee-button.src/zigbee-button.groovy @@ -89,14 +89,8 @@ def parse(String description) { } private Map parseIasButtonMessage(String description) { - int zoneInt = Integer.parseInt((description - "zone status 0x"), 16) - if (zoneInt & 0x02) { - resultMap = getButtonResult('press') - } else { - resultMap = getButtonResult('release') - } - - return resultMap + def zs = zigbee.parseZoneStatus(description) + return zs.isAlarm2Set() ? getButtonResult("press") : getButtonResult("release") } private Map getBatteryResult(rawValue) {