From 01b8399893c5c02ada58885bf99ac07108fab771 Mon Sep 17 00:00:00 2001 From: jackchi Date: Fri, 9 Sep 2016 14:48:19 -0700 Subject: [PATCH 1/5] [CHF-201] Removing DTH workaround now that all events go to Kafka --- .../smartthings/cree-bulb.src/cree-bulb.groovy | 16 +--------------- .../smartpower-outlet.groovy | 16 +--------------- .../smartsense-moisture-sensor.groovy | 17 +---------------- .../smartsense-motion-sensor.groovy | 17 +---------------- .../smartsense-multi-sensor.groovy | 17 +---------------- .../smartsense-open-closed-sensor.groovy | 17 +---------------- .../smartsense-temp-humidity-sensor.groovy | 16 +--------------- .../zigbee-dimmer.src/zigbee-dimmer.groovy | 16 +--------------- .../zigbee-rgbw-bulb.groovy | 16 +--------------- .../zigbee-white-color-temperature-bulb.groovy | 16 +--------------- 10 files changed, 10 insertions(+), 154 deletions(-) diff --git a/devicetypes/smartthings/cree-bulb.src/cree-bulb.groovy b/devicetypes/smartthings/cree-bulb.src/cree-bulb.groovy index ed5e751..5837ba1 100644 --- a/devicetypes/smartthings/cree-bulb.src/cree-bulb.groovy +++ b/devicetypes/smartthings/cree-bulb.src/cree-bulb.groovy @@ -67,12 +67,6 @@ def parse(String description) { def resultMap = zigbee.getEvent(description) if (resultMap) { sendEvent(resultMap) - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() } else { log.debug "DID NOT PARSE MESSAGE for description : $description" @@ -96,15 +90,7 @@ def setLevel(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.levelRefresh() - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.levelRefresh() } def refresh() { diff --git a/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy b/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy index b978cc0..fe9d0be 100644 --- a/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy +++ b/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy @@ -101,12 +101,6 @@ def parse(String description) { else { def descriptionText = finalResult.value == "on" ? '{{ device.displayName }} is On' : '{{ device.displayName }} is Off' sendEvent(name: finalResult.type, value: finalResult.value, descriptionText: descriptionText, translatable: true) - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() } } else { @@ -126,15 +120,7 @@ def on() { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.onOffRefresh() - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.onOffRefresh() } def refresh() { 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 2e9745d..f8ea7d9 100644 --- a/devicetypes/smartthings/smartsense-moisture-sensor.src/smartsense-moisture-sensor.groovy +++ b/devicetypes/smartthings/smartsense-moisture-sensor.src/smartsense-moisture-sensor.groovy @@ -101,13 +101,6 @@ def parse(String description) { map = parseIasMessage(description) } - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() - log.debug "Parse returned $map" def result = map ? createEvent(map) : null @@ -285,15 +278,7 @@ private Map getMoistureResult(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level } def refresh() { 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 c5128b1..a278644 100644 --- a/devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy +++ b/devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy @@ -105,13 +105,6 @@ def parse(String description) { map = parseIasMessage(description) } - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() - log.debug "Parse returned $map" def result = map ? createEvent(map) : null @@ -296,15 +289,7 @@ private Map getMotionResult(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level } def refresh() { 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 94575bd..5fa2139 100644 --- a/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy +++ b/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy @@ -127,13 +127,6 @@ def parse(String description) { map = parseIasMessage(description) } - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() - def result = map ? createEvent(map) : null if (description?.startsWith('enroll request')) { @@ -378,15 +371,7 @@ private getAccelerationResult(numValue) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level } def refresh() { 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 7fbd099..8bee02a 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 @@ -92,13 +92,6 @@ def parse(String description) { map = parseIasMessage(description) } - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() - log.debug "Parse returned $map" def result = map ? createEvent(map) : null @@ -248,15 +241,7 @@ private Map getContactResult(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level } def refresh() { diff --git a/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy b/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy index b320853..26955c1 100644 --- a/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy +++ b/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy @@ -83,13 +83,6 @@ def parse(String description) { map = parseCustomMessage(description) } - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() - log.debug "Parse returned $map" return map ? createEvent(map) : null } @@ -253,14 +246,7 @@ private Map getHumidityResult(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.readAttribute(0x001, 0x0020) // Read the Battery Level } def refresh() diff --git a/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy b/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy index 1326496..ed71f9a 100644 --- a/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy +++ b/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy @@ -54,12 +54,6 @@ def parse(String description) { def event = zigbee.getEvent(description) if (event) { - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() if (event.name=="level" && event.value==0) {} else { sendEvent(event) @@ -86,15 +80,7 @@ def setLevel(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.onOffRefresh() - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.onOffRefresh() } def refresh() { diff --git a/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy b/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy index e7137b6..f578311 100644 --- a/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy +++ b/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy @@ -85,12 +85,6 @@ def parse(String description) { def event = zigbee.getEvent(description) if (event) { log.debug event - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() if (event.name=="level" && event.value==0) {} else { if (event.name=="colorTemperature") { @@ -130,15 +124,7 @@ def off() { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.onOffRefresh() - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.onOffRefresh() } def refresh() { diff --git a/devicetypes/smartthings/zigbee-white-color-temperature-bulb.src/zigbee-white-color-temperature-bulb.groovy b/devicetypes/smartthings/zigbee-white-color-temperature-bulb.src/zigbee-white-color-temperature-bulb.groovy index de8424d..6d06b35 100644 --- a/devicetypes/smartthings/zigbee-white-color-temperature-bulb.src/zigbee-white-color-temperature-bulb.groovy +++ b/devicetypes/smartthings/zigbee-white-color-temperature-bulb.src/zigbee-white-color-temperature-bulb.groovy @@ -74,12 +74,6 @@ def parse(String description) { log.debug "description is $description" def event = zigbee.getEvent(description) if (event) { - // Temporary fix for the case when Device is OFFLINE and is connected again - if (state.lastActivity == null){ - state.lastActivity = now() - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } - state.lastActivity = now() if (event.name=="level" && event.value==0) {} else { if (event.name=="colorTemperature") { @@ -110,15 +104,7 @@ def setLevel(value) { * PING is used by Device-Watch in attempt to reach the Device * */ def ping() { - - if (state.lastActivity < (now() - (1000 * device.currentValue("checkInterval"))) ){ - log.info "ping, alive=no, lastActivity=${state.lastActivity}" - state.lastActivity = null - return zigbee.onOffRefresh() - } else { - log.info "ping, alive=yes, lastActivity=${state.lastActivity}" - sendEvent(name: "deviceWatch-lastActivity", value: state.lastActivity, description: "Last Activity is on ${new Date((long)state.lastActivity)}", displayed: false, isStateChange: true) - } + return zigbee.onOffRefresh() } def refresh() { From 3d05d42cb8940f1ad697c75c6159fce447566d35 Mon Sep 17 00:00:00 2001 From: Lars Finander Date: Sun, 11 Sep 2016 22:56:24 -0600 Subject: [PATCH 2/5] Add offline events to Philips Hue -Handles case when bridge goes offline -Handles case when indiviudual lights go offline --- .../hue-connect.src/hue-connect.groovy | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/smartapps/smartthings/hue-connect.src/hue-connect.groovy b/smartapps/smartthings/hue-connect.src/hue-connect.groovy index f0aad65..577168f 100644 --- a/smartapps/smartthings/hue-connect.src/hue-connect.groovy +++ b/smartapps/smartthings/hue-connect.src/hue-connect.groovy @@ -740,16 +740,21 @@ private void checkBridgeStatus() { d.sendEvent(name: "idNumber", value: it.value.idNumber) } - if (it.value.lastActivity < time) { // it.value.lastActivity != null && - log.warn "Bridge $it.key is Offline" - d.sendEvent(name: "status", value: "Offline") - // set all lights to offline since bridge is not reachable - state.bulbs?.each {it.value.online = false} - } else { + if (it.value.lastActivity < time) { // it.value.lastActivity != null && + log.warn "Bridge $it.key is Offline" + d.sendEvent(name: "status", value: "Offline") + + state.bulbs?.each { + it.value.online = false + } + getChildDevices().each { + it.sendEvent(name: "DeviceWatch-DeviceOffline", value: "offline") + } + } else { d.sendEvent(name: "status", value: "Online")//setOnline(false) - } - } - } + } + } + } } def isValidSource(macAddress) { @@ -955,6 +960,7 @@ private handlePoll(body) { } else { state.bulbs[bulb.key]?.online = false log.warn "$device is not reachable by Hue bridge" + device.sendEvent(name: "DeviceWatch-DeviceOffline", value: "offline") } } } From 7149a81c85cbda67ae6ff740e0020240df588ed0 Mon Sep 17 00:00:00 2001 From: jackchi Date: Mon, 12 Sep 2016 12:00:04 -0700 Subject: [PATCH 3/5] [CHF-348] Set 10 VD required devices to report in at 5 minutes --- .../smartthings/cree-bulb.src/cree-bulb.groovy | 6 ++++-- .../smartpower-outlet.groovy | 6 ++++-- .../smartsense-moisture-sensor.groovy | 18 +++++++----------- .../smartsense-motion-sensor.groovy | 17 ++++++----------- .../smartsense-multi-sensor.groovy | 7 +++++-- .../smartsense-open-closed-sensor.groovy | 18 +++++++----------- .../smartsense-temp-humidity-sensor.groovy | 18 +++++++----------- .../zigbee-dimmer.src/zigbee-dimmer.groovy | 7 ++++--- .../zigbee-rgbw-bulb.groovy | 7 ++++--- .../zigbee-white-color-temperature-bulb.groovy | 7 ++++--- 10 files changed, 52 insertions(+), 59 deletions(-) diff --git a/devicetypes/smartthings/cree-bulb.src/cree-bulb.groovy b/devicetypes/smartthings/cree-bulb.src/cree-bulb.groovy index 5837ba1..f956800 100644 --- a/devicetypes/smartthings/cree-bulb.src/cree-bulb.groovy +++ b/devicetypes/smartthings/cree-bulb.src/cree-bulb.groovy @@ -103,6 +103,8 @@ def poll() { def configure() { log.debug "Configuring Reporting and Bindings." - sendEvent(name: "checkInterval", value: 1200, displayed: false, data: [protocol: "zigbee"]) - zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) + // minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() } diff --git a/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy b/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy index fe9d0be..f4e6e0d 100644 --- a/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy +++ b/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy @@ -128,8 +128,10 @@ def refresh() { } def configure() { - sendEvent(name: "checkInterval", value: 1200, displayed: false, data: [protocol: "zigbee"]) - zigbee.onOffConfig() + powerConfig() + refresh() + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) + // OnOff minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity + zigbee.onOffConfig(0, 300) + powerConfig() + refresh() } //power config for devices with min reporting interval as 1 seconds and reporting interval if no activity as 10min (600s) 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 f8ea7d9..415fd73 100644 --- a/devicetypes/smartthings/smartsense-moisture-sensor.src/smartsense-moisture-sensor.groovy +++ b/devicetypes/smartthings/smartsense-moisture-sensor.src/smartsense-moisture-sensor.groovy @@ -292,23 +292,19 @@ def refresh() { } def configure() { - sendEvent(name: "checkInterval", value: 14400, displayed: false, data: [protocol: "zigbee"]) + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) log.debug "Configuring Reporting, IAS CIE, and Bindings." - def configCmds = [ + def enrollCmds = [ "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 1", "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} ${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 + + // temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity + // battery minReport 30 seconds, maxReportTime 6 hrs by default + return enrollCmds + zigbee.batteryConfig() + zigbee.temperatureConfig(30, 300) + refresh() // send refresh cmds as part of config } def enrollResponse() { 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 a278644..1a7ecec 100644 --- a/devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy +++ b/devicetypes/smartthings/smartsense-motion-sensor.src/smartsense-motion-sensor.groovy @@ -303,24 +303,19 @@ def refresh() { } def configure() { - sendEvent(name: "checkInterval", value: 14400, displayed: false, data: [protocol: "zigbee"]) + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) log.debug "Configuring Reporting, IAS CIE, and Bindings." - def configCmds = [ + def enrollCmds = [ "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 ${endpointId}", "delay 500", - - "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} ${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" ] - return configCmds + refresh() // send refresh cmds as part of config + // temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity + // battery minReport 30 seconds, maxReportTime 6 hrs by default + return enrollCmds + zigbee.batteryConfig() + zigbee.temperatureConfig(30, 300) + refresh() // send refresh cmds as part of config } def enrollResponse() { 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 5fa2139..6ce4044 100644 --- a/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy +++ b/devicetypes/smartthings/smartsense-multi-sensor.src/smartsense-multi-sensor.groovy @@ -401,13 +401,16 @@ def refresh() { } def configure() { - sendEvent(name: "checkInterval", value: 14400, displayed: false, data: [protocol: "zigbee"]) + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) log.debug "Configuring Reporting" + // temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity + // battery minReport 30 seconds, maxReportTime 6 hrs by default def configCmds = enrollResponse() + zigbee.batteryConfig() + - zigbee.temperatureConfig() + + zigbee.temperatureConfig(30, 300) + zigbee.configureReporting(0xFC02, 0x0010, 0x18, 10, 3600, 0x01, [mfgCode: manufacturerCode]) + zigbee.configureReporting(0xFC02, 0x0012, 0x29, 1, 3600, 0x0001, [mfgCode: manufacturerCode]) + zigbee.configureReporting(0xFC02, 0x0013, 0x29, 1, 3600, 0x0001, [mfgCode: manufacturerCode]) + 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 8bee02a..7d9c4c9 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 @@ -255,23 +255,19 @@ def refresh() { } def configure() { - sendEvent(name: "checkInterval", value: 14400, displayed: false, data: [protocol: "zigbee"]) + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) String zigbeeEui = swapEndianHex(device.hub.zigbeeEui) log.debug "Configuring Reporting, IAS CIE, and Bindings." - def configCmds = [ + def enrollCmds = [ "zcl global write 0x500 0x10 0xf0 {${zigbeeEui}}", "delay 200", "send 0x${device.deviceNetworkId} 1 1", "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} ${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 + + // temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity + // battery minReport 30 seconds, maxReportTime 6 hrs by default + return enrollCmds + zigbee.batteryConfig() + zigbee.temperatureConfig(30, 300) + refresh() // send refresh cmds as part of config } def enrollResponse() { diff --git a/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy b/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy index 26955c1..96b56e5 100644 --- a/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy +++ b/devicetypes/smartthings/smartsense-temp-humidity-sensor.src/smartsense-temp-humidity-sensor.groovy @@ -264,23 +264,19 @@ def refresh() } def configure() { - sendEvent(name: "checkInterval", value: 14400, displayed: false, data: [protocol: "zigbee"]) + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) log.debug "Configuring Reporting and Bindings." - def configCmds = [ - "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", - "zcl global send-me-a-report 0x402 0 0x29 30 3600 {6400}", - "send 0x${device.deviceNetworkId} 1 1", "delay 500", - + def humidityConfigCmds = [ "zdo bind 0x${device.deviceNetworkId} 1 1 0xFC45 {${device.zigbeeId}} {}", "delay 500", "zcl global send-me-a-report 0xFC45 0 0x29 30 3600 {6400}", "send 0x${device.deviceNetworkId} 1 1", "delay 500" ] - return configCmds + refresh() // send refresh cmds as part of config + + // temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity + // battery minReport 30 seconds, maxReportTime 6 hrs by default + return humidityConfigCmds + zigbee.batteryConfig() + zigbee.temperatureConfig(30, 300) + refresh() // send refresh cmds as part of config } private hex(value) { diff --git a/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy b/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy index ed71f9a..b977c8b 100644 --- a/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy +++ b/devicetypes/smartthings/zigbee-dimmer.src/zigbee-dimmer.groovy @@ -89,7 +89,8 @@ def refresh() { def configure() { log.debug "Configuring Reporting and Bindings." - // Enrolls device to Device-Watch with 3 x Reporting interval 30min - sendEvent(name: "checkInterval", value: 1800, displayed: false, data: [protocol: "zigbee"]) - zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) + // OnOff minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() } diff --git a/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy b/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy index f1e760f..367e480 100644 --- a/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy +++ b/devicetypes/smartthings/zigbee-rgbw-bulb.src/zigbee-rgbw-bulb.groovy @@ -133,9 +133,10 @@ def refresh() { def configure() { log.debug "Configuring Reporting and Bindings." - // Enrolls device to Device-Watch with 3 x Reporting interval 30min - sendEvent(name: "checkInterval", value: 1800, displayed: false, data: [protocol: "zigbee"]) - zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE, 0x20, 1, 3600, 0x01) + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION, 0x20, 1, 3600, 0x01) + zigbee.readAttribute(0x0006, 0x00) + zigbee.readAttribute(0x0008, 0x00) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, 0x00) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_COLOR_TEMPERATURE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) + // OnOff minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE, 0x20, 1, 3600, 0x01) + zigbee.configureReporting(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION, 0x20, 1, 3600, 0x01) + zigbee.readAttribute(0x0006, 0x00) + zigbee.readAttribute(0x0008, 0x00) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, 0x00) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_COLOR_TEMPERATURE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_HUE) + zigbee.readAttribute(COLOR_CONTROL_CLUSTER, ATTRIBUTE_SATURATION) } def setColorTemperature(value) { diff --git a/devicetypes/smartthings/zigbee-white-color-temperature-bulb.src/zigbee-white-color-temperature-bulb.groovy b/devicetypes/smartthings/zigbee-white-color-temperature-bulb.src/zigbee-white-color-temperature-bulb.groovy index 6d06b35..5a37fab 100644 --- a/devicetypes/smartthings/zigbee-white-color-temperature-bulb.src/zigbee-white-color-temperature-bulb.groovy +++ b/devicetypes/smartthings/zigbee-white-color-temperature-bulb.src/zigbee-white-color-temperature-bulb.groovy @@ -113,9 +113,10 @@ def refresh() { def configure() { log.debug "Configuring Reporting and Bindings." - // Enrolls device to Device-Watch with 3 x Reporting interval 30min - sendEvent(name: "checkInterval", value: 1800, displayed: false, data: [protocol: "zigbee"]) - zigbee.onOffConfig() + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh() + // Device-Watch allows 3 check-in misses from device. 300 seconds x 3 = 15min + sendEvent(name: "checkInterval", value: 900, displayed: false, data: [protocol: "zigbee"]) + // OnOff minReportTime 0 seconds, maxReportTime 5 min. Reporting interval if no activity + zigbee.onOffConfig(0, 300) + zigbee.levelConfig() + zigbee.colorTemperatureConfig() + zigbee.onOffRefresh() + zigbee.levelRefresh() + zigbee.colorTemperatureRefresh() } def setColorTemperature(value) { From 079919260b4124a3d8728a8a074b25de2e08dbb6 Mon Sep 17 00:00:00 2001 From: Lars Finander Date: Mon, 12 Sep 2016 17:08:57 -0600 Subject: [PATCH 4/5] CHF-348 Philips Hue: Change offline time to 16 min --- .../smartthings/hue-bloom.src/hue-bloom.groovy | 2 +- devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy | 2 +- .../smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy | 2 +- .../hue-white-ambiance-bulb.groovy | 2 +- .../smartthings/hue-connect.src/hue-connect.groovy | 12 ++++++------ 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/devicetypes/smartthings/hue-bloom.src/hue-bloom.groovy b/devicetypes/smartthings/hue-bloom.src/hue-bloom.groovy index 9f7d804..ff4405a 100644 --- a/devicetypes/smartthings/hue-bloom.src/hue-bloom.groovy +++ b/devicetypes/smartthings/hue-bloom.src/hue-bloom.groovy @@ -57,7 +57,7 @@ metadata { } void installed() { - sendEvent(name: "checkInterval", value: 60 * 30, data: [protocol: "lan"], displayed: false) + sendEvent(name: "checkInterval", value: 60 * 15, data: [protocol: "lan"], displayed: false) } // parse events into attributes diff --git a/devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy b/devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy index 1f63b09..6642672 100644 --- a/devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy +++ b/devicetypes/smartthings/hue-bulb.src/hue-bulb.groovy @@ -66,7 +66,7 @@ metadata { } void installed() { - sendEvent(name: "checkInterval", value: 60 * 30, data: [protocol: "lan"], displayed: false) + sendEvent(name: "checkInterval", value: 60 * 15, data: [protocol: "lan"], displayed: false) } // parse events into attributes diff --git a/devicetypes/smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy b/devicetypes/smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy index b1f076d..4d8bfbb 100644 --- a/devicetypes/smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy +++ b/devicetypes/smartthings/hue-lux-bulb.src/hue-lux-bulb.groovy @@ -50,7 +50,7 @@ metadata { } void installed() { - sendEvent(name: "checkInterval", value: 60 * 30, data: [protocol: "lan"], displayed: false) + sendEvent(name: "checkInterval", value: 60 * 15, data: [protocol: "lan"], displayed: false) } // parse events into attributes diff --git a/devicetypes/smartthings/hue-white-ambiance-bulb.src/hue-white-ambiance-bulb.groovy b/devicetypes/smartthings/hue-white-ambiance-bulb.src/hue-white-ambiance-bulb.groovy index fd8c8bf..b24b1dd 100644 --- a/devicetypes/smartthings/hue-white-ambiance-bulb.src/hue-white-ambiance-bulb.groovy +++ b/devicetypes/smartthings/hue-white-ambiance-bulb.src/hue-white-ambiance-bulb.groovy @@ -55,7 +55,7 @@ metadata { } void installed() { - sendEvent(name: "checkInterval", value: 60 * 30, data: [protocol: "lan"], displayed: false) + sendEvent(name: "checkInterval", value: 60 * 15, data: [protocol: "lan"], displayed: false) } // parse events into attributes diff --git a/smartapps/smartthings/hue-connect.src/hue-connect.groovy b/smartapps/smartthings/hue-connect.src/hue-connect.groovy index 577168f..8df8621 100644 --- a/smartapps/smartthings/hue-connect.src/hue-connect.groovy +++ b/smartapps/smartthings/hue-connect.src/hue-connect.groovy @@ -724,13 +724,13 @@ private void updateBridgeStatus(childDevice) { } /** - * Check if all Hue bridges have been heard from in the last 16 minutes, if not an Offline event will be sent - * for the bridge. Also, set ID number on bridge if not done previously. + * Check if all Hue bridges have been heard from in the last 11 minutes, if not an Offline event will be sent + * for the bridge and all connected lights. Also, set ID number on bridge if not done previously. */ private void checkBridgeStatus() { def bridges = getHueBridges() - // Check if each bridge has been heard from within the last 16 minutes (3 poll intervals times 5 minutes plus buffer) - def time = now() - (1000 * 60 * 30) + // Check if each bridge has been heard from within the last 11 minutes (2 poll intervals times 5 minutes plus buffer) + def time = now() - (1000 * 60 * 11) bridges.each { def d = getChildDevice(it.value.mac) if(d) { @@ -748,7 +748,7 @@ private void checkBridgeStatus() { it.value.online = false } getChildDevices().each { - it.sendEvent(name: "DeviceWatch-DeviceOffline", value: "offline") + it.sendEvent(name: "DeviceWatch-DeviceOffline", value: "offline", isStateChange: true, displayed: false) } } else { d.sendEvent(name: "status", value: "Online")//setOnline(false) @@ -960,7 +960,7 @@ private handlePoll(body) { } else { state.bulbs[bulb.key]?.online = false log.warn "$device is not reachable by Hue bridge" - device.sendEvent(name: "DeviceWatch-DeviceOffline", value: "offline") + device.sendEvent(name: "DeviceWatch-DeviceOffline", value: "offline", displayed: false, isStateChange: true) } } } From d5329dbde3b14e578fc34c6f039fa28dc3b96d9a Mon Sep 17 00:00:00 2001 From: juano2310 Date: Mon, 12 Sep 2016 20:58:36 -0400 Subject: [PATCH 5/5] SSVD-2733 - Typo fix --- smartapps/smartthings/energy-alerts.src/energy-alerts.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smartapps/smartthings/energy-alerts.src/energy-alerts.groovy b/smartapps/smartthings/energy-alerts.src/energy-alerts.groovy index 4a4c9ff..bd394a1 100644 --- a/smartapps/smartthings/energy-alerts.src/energy-alerts.groovy +++ b/smartapps/smartthings/energy-alerts.src/energy-alerts.groovy @@ -64,7 +64,7 @@ def meterHandler(evt) { def lastValue = atomicState.lastValue as double atomicState.lastValue = meterValue - def dUnit ? evt.unit : "Watts" + def dUnit = evt.unit ?: "Watts" def aboveThresholdValue = aboveThreshold as int if (meterValue > aboveThresholdValue) {