From b7288b5bebc42ba7096543a3563a5912cb4f64de Mon Sep 17 00:00:00 2001
From: "piyush.c"
Date: Wed, 22 Mar 2017 18:25:42 +0530
Subject: [PATCH] [CHF-568] Health Check keen-home-smart-vent
---
.../keen-home-smart-vent.src/.st-ignore | 2 +
.../keen-home-smart-vent.src/README.md | 39 +++++++++++++++++++
.../keen-home-smart-vent.groovy | 23 ++++++++---
3 files changed, 58 insertions(+), 6 deletions(-)
create mode 100644 devicetypes/keen-home/keen-home-smart-vent.src/.st-ignore
create mode 100644 devicetypes/keen-home/keen-home-smart-vent.src/README.md
diff --git a/devicetypes/keen-home/keen-home-smart-vent.src/.st-ignore b/devicetypes/keen-home/keen-home-smart-vent.src/.st-ignore
new file mode 100644
index 0000000..f78b46e
--- /dev/null
+++ b/devicetypes/keen-home/keen-home-smart-vent.src/.st-ignore
@@ -0,0 +1,2 @@
+.st-ignore
+README.md
diff --git a/devicetypes/keen-home/keen-home-smart-vent.src/README.md b/devicetypes/keen-home/keen-home-smart-vent.src/README.md
new file mode 100644
index 0000000..808ca0a
--- /dev/null
+++ b/devicetypes/keen-home/keen-home-smart-vent.src/README.md
@@ -0,0 +1,39 @@
+# Keen Home Smart Vent
+
+Cloud Execution
+
+Works with:
+
+* [Keen Home Smart Vent](https://www.smartthings.com/works-with-smartthings/keen-home/keen-home-smart-vent)
+
+## Table of contents
+
+* [Capabilities](#capabilities)
+* [Health](#device-health)
+* [Troubleshooting](#Troubleshooting)
+
+## Capabilities
+
+* **Switch** - can detect state (possible values: on/off)
+* **Switch Level** - represents current light level, usually 0-100 in percent
+* **Sensor** - detects sensor events
+* **Temperature Measurement** - represents capability to measure temperature
+* **Configuration** - _configure()_ command called when device is installed or device preferences updated
+* **Battery** - defines device uses a battery
+* **Refresh** - _refresh()_ command for status updates
+* **Health Check** - indicates ability to get device health notifications
+
+## Device Health
+
+Keen Home Smart Vent 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 sensor is out of range.
+Pairing needs to be tried again by placing the sensor closer to the hub.
+Instructions related to pairing, resetting and removing the different motion sensors from SmartThings can be found in the following links
+for the different models:
+* [Keen Home Smart Vent Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/205302050-Keen-Home-Smart-Vent)
diff --git a/devicetypes/keen-home/keen-home-smart-vent.src/keen-home-smart-vent.groovy b/devicetypes/keen-home/keen-home-smart-vent.src/keen-home-smart-vent.groovy
index 93703ef..2b18b8f 100644
--- a/devicetypes/keen-home/keen-home-smart-vent.src/keen-home-smart-vent.groovy
+++ b/devicetypes/keen-home/keen-home-smart-vent.src/keen-home-smart-vent.groovy
@@ -11,6 +11,7 @@ metadata {
capability "Sensor"
capability "Temperature Measurement"
capability "Battery"
+ capability "Health Check"
command "getLevel"
command "getOnOff"
@@ -20,10 +21,8 @@ metadata {
command "setZigBeeIdTile"
command "clearObstruction"
- fingerprint endpoint: "1",
- profileId: "0104",
- inClusters: "0000,0001,0003,0004,0005,0006,0008,0020,0402,0403,0B05,FC01,FC02",
- outClusters: "0019"
+ fingerprint endpoint: "1", profileId: "0104", inClusters: "0000,0001,0003,0004,0005,0006,0008,0020,0402,0403,0B05,FC01,FC02", outClusters: "0019"
+ fingerprint endpoint: "1", profileId: "0104", inClusters: "0000,0001,0003,0004,0005,0006,0008,0020,0402,0403,0B05,FC01,FC02", outClusters: "0019", manufacturer: "Keen Home Inc", model: "SV01-410-DV-1.0", deviceJoinName: "Keen Home Smart Vent"
}
// simulator metadata
@@ -466,15 +465,27 @@ def refresh() {
getBattery()
}
+/**
+ * PING is used by Device-Watch in attempt to reach the Device
+ * */
+def ping() {
+ return refresh()
+}
+
def configure() {
log.debug "CONFIGURE"
+ // Device-Watch allows 2 check-in misses from device + ping (plus 1 min lag time)
+ // enrolls with default periodic reporting until newer 5 min interval is confirmed
+ sendEvent(name: "checkInterval", value: 2 * 10 * 60 + 2 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
+
// get ZigBee ID by hidden tile because that's the only way we can do it
setZigBeeIdTile()
def configCmds = [
// bind reporting clusters to hub
- "zdo bind 0x${device.deviceNetworkId} 1 1 0x0006 {${device.zigbeeId}} {}", "delay 500",
+ //commenting out switch cluster bind as using wrapper onOffConfig of zigbee class
+ //"zdo bind 0x${device.deviceNetworkId} 1 1 0x0006 {${device.zigbeeId}} {}", "delay 500",
"zdo bind 0x${device.deviceNetworkId} 1 1 0x0008 {${device.zigbeeId}} {}", "delay 500",
"zdo bind 0x${device.deviceNetworkId} 1 1 0x0402 {${device.zigbeeId}} {}", "delay 500",
"zdo bind 0x${device.deviceNetworkId} 1 1 0x0403 {${device.zigbeeId}} {}", "delay 500",
@@ -510,5 +521,5 @@ def configure() {
// "send 0x${device.deviceNetworkId} 1 1", "delay 1500",
]
- return configCmds + refresh()
+ return configCmds + zigbee.onOffConfig() + refresh()
}