From 5e7ded1f7372a6c58f46ceb5c04625241b060fff Mon Sep 17 00:00:00 2001 From: "sushant.k1" Date: Wed, 22 Mar 2017 18:40:07 +0530 Subject: [PATCH] [CHF-572] Added Health Check Implementation for Zen Thermostat. --- .../zenwithin/zen-thermostat.src/.st-ignore | 2 + .../zenwithin/zen-thermostat.src/README.md | 37 +++++++++++++++++++ .../zen-thermostat.src/zen-thermostat.groovy | 16 +++++--- 3 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 devicetypes/zenwithin/zen-thermostat.src/.st-ignore create mode 100644 devicetypes/zenwithin/zen-thermostat.src/README.md diff --git a/devicetypes/zenwithin/zen-thermostat.src/.st-ignore b/devicetypes/zenwithin/zen-thermostat.src/.st-ignore new file mode 100644 index 0000000..f78b46e --- /dev/null +++ b/devicetypes/zenwithin/zen-thermostat.src/.st-ignore @@ -0,0 +1,2 @@ +.st-ignore +README.md diff --git a/devicetypes/zenwithin/zen-thermostat.src/README.md b/devicetypes/zenwithin/zen-thermostat.src/README.md new file mode 100644 index 0000000..8864ff4 --- /dev/null +++ b/devicetypes/zenwithin/zen-thermostat.src/README.md @@ -0,0 +1,37 @@ +# Zen Thermostat + +Cloud Execution + +Works with: + +* [Zen Thermostat](https://www.smartthings.com/works-with-smartthings/zen/zen-thermostat) + +## Table of contents + +* [Capabilities](#capabilities) +* [Health](#device-health) + +## Capabilities + +* **Actuator** - represents that a Device has commands +* **Thermostat** - allows for the control of a thermostat device +* **Temperature Measurement** - get the temperature from a Device that reports current temperature +* **Configuration** - _configure()_ command called when device is installed or device preferences updated +* **Refresh** - _refresh()_ command for status updates +* **Sensor** - it represents that a Device has attributes +* **Health Check** - indicates ability to get device health notifications + +## Device Health + +Zen Thermostat with reporting interval of 5 mins. +SmartThings platform will ping the device after `checkInterval` seconds of inactivity in last attempt to reach the device before marking it `OFFLINE` + +* __12min__ checkInterval + + +## Troubleshooting + +If the device doesn't pair when trying from the SmartThings mobile app, it is possible that the device is out of range. +Pairing needs to be tried again by placing the device closer to the hub. +Other troubleshooting tips are listed as follows: +* [Zen Thermostat Troubleshooting:](https://support.smartthings.com/hc/en-us/articles/204356564-Zen-Thermostat) diff --git a/devicetypes/zenwithin/zen-thermostat.src/zen-thermostat.groovy b/devicetypes/zenwithin/zen-thermostat.src/zen-thermostat.groovy index 2e046da..a3e54a9 100644 --- a/devicetypes/zenwithin/zen-thermostat.src/zen-thermostat.groovy +++ b/devicetypes/zenwithin/zen-thermostat.src/zen-thermostat.groovy @@ -12,8 +12,9 @@ metadata { capability "Configuration" capability "Refresh" capability "Sensor" - - fingerprint profileId: "0104", endpointId: "01", inClusters: "0000,0001,0003,0004,0005,0020,0201,0202,0204,0B05", outClusters: "000A, 0019" + capability "Health Check" + + fingerprint profileId: "0104", endpointId: "01", inClusters: "0000,0001,0003,0004,0005,0020,0201,0202,0204,0B05", outClusters: "000A, 0019", manufacturer: "Zen Within", model: "Zen-01", deviceJoinName: "Zen Thermostat" //attribute "temperatureUnit", "number" @@ -467,8 +468,12 @@ def fanAuto() { "st wattr 0x${device.deviceNetworkId} 1 0x202 0 0x30 {05}" } - - +/** + * PING is used by Device-Watch in attempt to reach the Device + * */ +def ping() { + refresh() +} // =============== SmartThings Default Fucntions: refresh, configure, poll =============== def refresh() @@ -502,6 +507,7 @@ def poll() def configure() { + sendEvent(name: "checkInterval", value: 60 * 12, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]) log.debug "configure() - binding & attribute report" [ //Set long poll interval to 2 qs @@ -511,7 +517,7 @@ def configure() //Thermostat - Cluster 201 "zdo bind 0x${device.deviceNetworkId} 1 1 0x201 {${device.zigbeeId}} {}", "delay 500", - "zcl global send-me-a-report 0x201 0 0x29 5 300 {3200}", + "zcl global send-me-a-report 0x201 0 0x29 5 300 {3200}", "send 0x${device.deviceNetworkId} 1 1", "delay 500", "zcl global send-me-a-report 0x201 0x0011 0x29 5 300 {3200}",