From b270bd335661df40254bea053d02912fe676be6d Mon Sep 17 00:00:00 2001 From: Kianoosh Karami Date: Fri, 6 Dec 2019 11:35:51 -0600 Subject: [PATCH] [CHAD-4106] Set Association Group 1 at initialized() and once later if needed --- .../zwave-door-window-sensor.groovy | 21 ++++++++++++++++++ .../zwave-smoke-alarm.groovy | 22 +++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/devicetypes/smartthings/zwave-door-window-sensor.src/zwave-door-window-sensor.groovy b/devicetypes/smartthings/zwave-door-window-sensor.src/zwave-door-window-sensor.groovy index 391d2804f30..b723afcedd8 100644 --- a/devicetypes/smartthings/zwave-door-window-sensor.src/zwave-door-window-sensor.groovy +++ b/devicetypes/smartthings/zwave-door-window-sensor.src/zwave-door-window-sensor.groovy @@ -100,6 +100,20 @@ def parse(String description) { if (cmd) { result = zwaveEvent(cmd) } + + if (!state.setAssociation) + { + // This change is to fix the issue introduced in 28.11 where association was not getting set at inclusion + // time. + // + // This change will set the association to group id 1 only once, even for the devices that were added + // prior to the 28.11 hub firmware release. The association is set here because not all the device will + // support wake up command class, so we are going to set the association once we hear something from the + // device which is our clue that the device is awake to receive the message. + def hubCmds = [new physicalgraph.device.HubAction(zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format())] + sendHubCommand(hubCmds) + state.setAssociation = true + } } log.debug "parsed '$description' to $result" return result @@ -297,6 +311,13 @@ def initialPoll() { request << zwave.batteryV1.batteryGet() request << zwave.sensorBinaryV2.sensorBinaryGet(sensorType: zwave.sensorBinaryV2.SENSOR_TYPE_DOOR_WINDOW) request << zwave.manufacturerSpecificV2.manufacturerSpecificGet() + + // NOTE: 28.11 hub firmware only associates groupID 1 if the device is Z-Wave Plus. As a workaround, we are going to + // associate with group 1 at installed() to circumvent the issue introduced by 28.11 + // Once the issue in 28.11 is resolved, this change will then need to be removed, but associating twice is not + // harmful + request << zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId]) + state.setAssociation = true commands(request, 500) + ["delay 6000", command(zwave.wakeUpV1.wakeUpNoMoreInformation())] } diff --git a/devicetypes/smartthings/zwave-smoke-alarm.src/zwave-smoke-alarm.groovy b/devicetypes/smartthings/zwave-smoke-alarm.src/zwave-smoke-alarm.groovy index 1cd75fa26bd..dd307ed3b95 100644 --- a/devicetypes/smartthings/zwave-smoke-alarm.src/zwave-smoke-alarm.groovy +++ b/devicetypes/smartthings/zwave-smoke-alarm.src/zwave-smoke-alarm.groovy @@ -59,6 +59,14 @@ def installed() { def cmds = [] createSmokeOrCOEvents("allClear", cmds) // allClear to set inital states for smoke and CO cmds.each { cmd -> sendEvent(cmd) } + + // NOTE: 28.11 hub firmware only associates groupID 1 if the device is Z-Wave Plus. As a workaround, we are going to + // associate with group 1 at installed() to circumvent the issue introduced by 28.11 + // Once the issue in 28.11 is resolved, this change will then need to be removed, but associating twice is not + // harmful + def hubCmds = [new physicalgraph.device.HubAction(zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId]).format())] + sendHubCommand(hubCmds) + state.setAssociation = true } def updated() { @@ -75,6 +83,20 @@ def parse(String description) { if (cmd) { zwaveEvent(cmd, results) } + + if (!state.setAssociation) + { + // This change is to fix the issue introduced in 28.11 where association was not getting set at inclusion + // time. + // + // This change will set the association to group id 1 only once, even for the devices that were added + // prior to the 28.11 hub firmware release. The association is set here because not all the device will + // support wake up command class, so we are going to set the association once we hear something from the + // device which is our clue that the device is awake to receive the message. + results << response(zwave.associationV1.associationSet(groupingIdentifier:1, nodeId:[zwaveHubNodeId])) + state.setAssociation = true + } + } log.debug "'$description' parsed to ${results.inspect()}" return results