From eb8d861c6c0086ec2acaf176149a4ca3678b9754 Mon Sep 17 00:00:00 2001 From: Vinay Rao Date: Wed, 9 Sep 2015 19:05:17 -0700 Subject: [PATCH 1/3] Updating Device Config Making sure that the bind commands are before the reporting --- .../smartsense-moisture-sensor.groovy | 18 ++++----- .../smartsense-motion-sensor.groovy | 18 ++++----- .../smartsense-motion-temp-sensor.groovy | 16 ++++---- .../smartsense-multi-sensor.groovy | 39 +++++++++---------- ...se-open-closed-accelerometer-sensor.groovy | 10 ++--- .../smartsense-open-closed-sensor.groovy | 24 +++++------- 6 files changed, 56 insertions(+), 69 deletions(-) diff --git a/devicetypes/smartthings/smartsense-moisture-sensor.src/smartsense-moisture-sensor.groovy b/devicetypes/smartthings/smartsense-moisture-sensor.src/smartsense-moisture-sensor.groovy index 5f32ea7..03303f2 100644 --- a/devicetypes/smartthings/smartsense-moisture-sensor.src/smartsense-moisture-sensor.groovy +++ b/devicetypes/smartthings/smartsense-moisture-sensor.src/smartsense-moisture-sensor.groovy @@ -280,16 +280,14 @@ def configure() { def configCmds = [ "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 1", "delay 500", - - "zcl global send-me-a-report 1 0x20 0x20 300 0600 {01}", "delay 200", + + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 1 {${device.zigbeeId}} {}", "delay 500", + "zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs "send 0x${device.deviceNetworkId} 1 1", "delay 500", - - "zcl global send-me-a-report 0x402 0 0x29 300 3600 {6400}", "delay 200", - "send 0x${device.deviceNetworkId} 1 1", "delay 500", - - - "zdo bind 0x${device.deviceNetworkId} 1 1 0x402 {${device.zigbeeId}} {}", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 1 0x001 {${device.zigbeeId}} {}", "delay 500" + + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0x402 {${device.zigbeeId}} {}", "delay 500", + "zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}", + "send 0x${device.deviceNetworkId} 1 1", "delay 500" ] return configCmds + refresh() // send refresh cmds as part of config } @@ -299,7 +297,7 @@ def enrollResponse() { String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) [ //Resending the CIE in case the enroll request is sent before CIE is written - "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", + "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", //Enroll Response "raw 0x500 {01 23 00 00 00}", diff --git a/devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy b/devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy index e07d009..337a75b 100644 --- a/devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy +++ b/devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy @@ -301,20 +301,18 @@ def configure() { log.debug "Configuring Reporting, IAS CIE, and Bindings." def configCmds = [ - "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", + "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x20 {${device.zigbeeId}} {}", "delay 200", - "zcl global send-me-a-report 1 0x20 0x20 300 3600 {01}", + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 1 {${device.zigbeeId}} {}", "delay 200", + "zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x402 {${device.zigbeeId}} {}", "delay 200", + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0x402 {${device.zigbeeId}} {}", "delay 200", "zcl global send-me-a-report 0x402 0 0x29 300 3600 {6400}", - "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - - "zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 1 {${device.zigbeeId}} {}", "delay 200" + "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500" ] - return configCmds + refresh() // send refresh cmds as part of config + return configCmds + refresh() // send refresh cmds as part of config } def enrollResponse() { @@ -322,12 +320,12 @@ def enrollResponse() { String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) [ //Resending the CIE in case the enroll request is sent before CIE is written - "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", + "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", //Enroll Response "raw 0x500 {01 23 00 00 00}", "send 0x${device.deviceNetworkId} 1 1", "delay 200" - ] + ] } private getEndpointId() { diff --git a/devicetypes/smartthings/smartsense-motion-temp-sensor.src/smartsense-motion-temp-sensor.groovy b/devicetypes/smartthings/smartsense-motion-temp-sensor.src/smartsense-motion-temp-sensor.groovy index 9ec0618..0c19877 100644 --- a/devicetypes/smartthings/smartsense-motion-temp-sensor.src/smartsense-motion-temp-sensor.groovy +++ b/devicetypes/smartthings/smartsense-motion-temp-sensor.src/smartsense-motion-temp-sensor.groovy @@ -292,18 +292,16 @@ def configure() { log.debug "Configuring Reporting, IAS CIE, and Bindings." def configCmds = [ - "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", + "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x20 {${device.zigbeeId}} {}", "delay 200", - "zcl global send-me-a-report 1 0x20 0x20 300 3600 {01}", + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 1 {${device.zigbeeId}} {}", "delay 200", + "zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x402 {${device.zigbeeId}} {}", "delay 200", - "zcl global send-me-a-report 0x402 0 0x29 300 3600 {6400}", - "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - - "zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 1 {${device.zigbeeId}} {}", "delay 200" + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0x402 {${device.zigbeeId}} {}", "delay 200", + "zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}", + "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500" ] return configCmds + refresh() // send refresh cmds as part of config } @@ -313,7 +311,7 @@ def enrollResponse() { String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) [ //Resending the CIE in case the enroll request is sent before CIE is written - "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", + "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", //Enroll Response "raw 0x500 {01 23 00 00 00}", 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 10b29a8..562799a 100644 --- a/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy +++ b/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy @@ -395,35 +395,34 @@ def getTemperature(value) { String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) log.debug "Configuring Reporting" - def configCmds = [ - - "zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 1 {${device.zigbeeId}} {}", "delay 200", - "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", + def configCmds = [ + + "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x20 {${device.zigbeeId}} {}", "delay 200", - "zcl global send-me-a-report 1 0x20 0x20 600 3600 {01}", + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 1 {${device.zigbeeId}} {}", "delay 200", + "zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x402 {${device.zigbeeId}} {}", "delay 200", - "zcl global send-me-a-report 0x402 0 0x29 300 3600 {6400}", + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0x402 {${device.zigbeeId}} {}", "delay 200", + "zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0xFC02 {${device.zigbeeId}} {}", "delay 200", + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0xFC02 {${device.zigbeeId}} {}", "delay 200", "zcl mfg-code 0x104E", - "zcl global send-me-a-report 0xFC02 0x0010 0x18 300 3600 {01}", + "zcl global send-me-a-report 0xFC02 0x0010 0x18 10 3600 {01}", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - - "zcl mfg-code 0x104E", - "zcl global send-me-a-report 0xFC02 0x0012 0x29 300 3600 {01}", + + "zcl mfg-code 0x104E", + "zcl global send-me-a-report 0xFC02 0x0012 0x29 1 3600 {01}", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - - "zcl mfg-code 0x104E", - "zcl global send-me-a-report 0xFC02 0x0013 0x29 300 3600 {01}", + + "zcl mfg-code 0x104E", + "zcl global send-me-a-report 0xFC02 0x0013 0x29 1 3600 {01}", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - - "zcl mfg-code 0x104E", - "zcl global send-me-a-report 0xFC02 0x0014 0x29 300 3600 {01}", + + "zcl mfg-code 0x104E", + "zcl global send-me-a-report 0xFC02 0x0014 0x29 1 3600 {01}", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500" ] @@ -440,7 +439,7 @@ def enrollResponse() { String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) [ //Resending the CIE in case the enroll request is sent before CIE is written - "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", + "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", //Enroll Response "raw 0x500 {01 23 00 00 00}", diff --git a/devicetypes/smartthings/smartsense-open-closed-accelerometer-sensor.src/smartsense-open-closed-accelerometer-sensor.groovy b/devicetypes/smartthings/smartsense-open-closed-accelerometer-sensor.src/smartsense-open-closed-accelerometer-sensor.groovy index 2582580..0a21f0b 100644 --- a/devicetypes/smartthings/smartsense-open-closed-accelerometer-sensor.src/smartsense-open-closed-accelerometer-sensor.groovy +++ b/devicetypes/smartthings/smartsense-open-closed-accelerometer-sensor.src/smartsense-open-closed-accelerometer-sensor.groovy @@ -302,15 +302,15 @@ def getTemperature(value) { String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) log.debug "Configuring Reporting, IAS CIE, and Bindings." def configCmds = [ - "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", + "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 1", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 ${endpointId} 0x20 {${device.zigbeeId}} {}", "delay 200", - "zcl global send-me-a-report 1 0x20 0x20 600 3600 {01}", + "zdo bind 0x${device.deviceNetworkId} 1 1 0x20 {${device.zigbeeId}} {}", "delay 200", + "zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs "send 0x${device.deviceNetworkId} 1 1", "delay 500", "zdo bind 0x${device.deviceNetworkId} 1 1 0x402 {${device.zigbeeId}} {}", "delay 500", - "zcl global send-me-a-report 0x402 0 0x29 300 3600 {6400}", + "zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}", "send 0x${device.deviceNetworkId} 1 1", "delay 500", "zdo bind 0x${device.deviceNetworkId} 1 1 0xFC02 {${device.zigbeeId}} {}", "delay 500", @@ -327,7 +327,7 @@ def enrollResponse() { String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) [ //Resending the CIE in case the enroll request is sent before CIE is written - "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", + "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", //Enroll Response "raw 0x500 {01 23 00 00 00}", diff --git a/devicetypes/smartthings/smartsense-open-closed-sensor.src/smartsense-open-closed-sensor.groovy b/devicetypes/smartthings/smartsense-open-closed-sensor.src/smartsense-open-closed-sensor.groovy index cde1438..f383810 100644 --- a/devicetypes/smartthings/smartsense-open-closed-sensor.src/smartsense-open-closed-sensor.groovy +++ b/devicetypes/smartthings/smartsense-open-closed-sensor.src/smartsense-open-closed-sensor.groovy @@ -275,22 +275,16 @@ def configure() { String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) log.debug "Configuring Reporting, IAS CIE, and Bindings." def configCmds = [ - "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", + "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 1", "delay 500", - - "zcl global send-me-a-report 1 0x20 0x20 600 3600 {01}", - "send 0x${device.deviceNetworkId} 1 1", "delay 500", - - "zcl global send-me-a-report 0x402 0 0x29 300 3600 {6400}", - "send 0x${device.deviceNetworkId} 1 1", "delay 500", - - - //"raw 0x500 {01 23 00 00 00}", "delay 200", - //"send 0x${device.deviceNetworkId} 1 1", "delay 1500", - - + + "zdo bind 0x${device.deviceNetworkId} 1 1 1 {${device.zigbeeId}} {}", "delay 500", + "zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs + "send 0x${device.deviceNetworkId} 1 1", "delay 500", + "zdo bind 0x${device.deviceNetworkId} 1 1 0x402 {${device.zigbeeId}} {}", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 1 1 {${device.zigbeeId}} {}", "delay 500" + "zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}", + "send 0x${device.deviceNetworkId} 1 1", "delay 500" ] return configCmds + refresh() // send refresh cmds as part of config } @@ -300,7 +294,7 @@ def enrollResponse() { String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) [ //Resending the CIE in case the enroll request is sent before CIE is written - "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", + "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", //Enroll Response "raw 0x500 {01 23 00 00 00}", From 6c3a7886ed29a2721a23341a08c3f170396e9d69 Mon Sep 17 00:00:00 2001 From: Vinay Rao Date: Thu, 10 Sep 2015 09:54:49 -0700 Subject: [PATCH 2/3] adding endpoint to make it consistent. --- .../smartsense-open-closed-sensor.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devicetypes/smartthings/smartsense-open-closed-sensor.src/smartsense-open-closed-sensor.groovy b/devicetypes/smartthings/smartsense-open-closed-sensor.src/smartsense-open-closed-sensor.groovy index f383810..499d471 100644 --- a/devicetypes/smartthings/smartsense-open-closed-sensor.src/smartsense-open-closed-sensor.groovy +++ b/devicetypes/smartthings/smartsense-open-closed-sensor.src/smartsense-open-closed-sensor.groovy @@ -278,11 +278,11 @@ def configure() { "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 1", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 1 1 {${device.zigbeeId}} {}", "delay 500", + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 1 {${device.zigbeeId}} {}", "delay 500", "zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs "send 0x${device.deviceNetworkId} 1 1", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 1 0x402 {${device.zigbeeId}} {}", "delay 500", + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0x402 {${device.zigbeeId}} {}", "delay 500", "zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}", "send 0x${device.deviceNetworkId} 1 1", "delay 500" ] From ab00d703bf513e220a9947b02050077ff9afedfc Mon Sep 17 00:00:00 2001 From: Vinay Rao Date: Thu, 10 Sep 2015 09:59:14 -0700 Subject: [PATCH 3/3] endpoint addition and binding fixes --- ...se-open-closed-accelerometer-sensor.groovy | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/devicetypes/smartthings/smartsense-open-closed-accelerometer-sensor.src/smartsense-open-closed-accelerometer-sensor.groovy b/devicetypes/smartthings/smartsense-open-closed-accelerometer-sensor.src/smartsense-open-closed-accelerometer-sensor.groovy index 0a21f0b..f801ef0 100644 --- a/devicetypes/smartthings/smartsense-open-closed-accelerometer-sensor.src/smartsense-open-closed-accelerometer-sensor.groovy +++ b/devicetypes/smartthings/smartsense-open-closed-accelerometer-sensor.src/smartsense-open-closed-accelerometer-sensor.groovy @@ -297,29 +297,27 @@ def getTemperature(value) { return refreshCmds + enrollResponse() } - def configure() { +def configure() { - String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) - log.debug "Configuring Reporting, IAS CIE, and Bindings." - def configCmds = [ + String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) + log.debug "Configuring Reporting, IAS CIE, and Bindings." + def configCmds = [ "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", - "send 0x${device.deviceNetworkId} 1 1", "delay 500", + "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 1 0x20 {${device.zigbeeId}} {}", "delay 200", + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 1 {${device.zigbeeId}} {}", "delay 200", "zcl global send-me-a-report 1 0x20 0x20 30 21600 {01}", //checkin time 6 hrs - "send 0x${device.deviceNetworkId} 1 1", "delay 500", + "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 1 0x402 {${device.zigbeeId}} {}", "delay 500", + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0x402 {${device.zigbeeId}} {}", "delay 500", "zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}", - "send 0x${device.deviceNetworkId} 1 1", "delay 500", + "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - "zdo bind 0x${device.deviceNetworkId} 1 1 0xFC02 {${device.zigbeeId}} {}", "delay 500", - "zcl global send-me-a-report 0xFC02 2 0x18 300 3600 {01}", - "send 0x${device.deviceNetworkId} 1 1", "delay 500", - - "zdo bind 0x${device.deviceNetworkId} 1 1 1 {${device.zigbeeId}} {}", "delay 500" - ] - return configCmds + refresh() // send refresh cmds as part of config + "zdo bind 0x${device.deviceNetworkId} ${endpointId} 1 0xFC02 {${device.zigbeeId}} {}", "delay 500", + "zcl global send-me-a-report 0xFC02 2 0x18 30 3600 {01}", + "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500" + ] + return configCmds + refresh() // send refresh cmds as part of config } def enrollResponse() {