From b63d4a91568248fe5feaac11c7da2fb17e8d63cf Mon Sep 17 00:00:00 2001
From: "piyush.c"
Date: Wed, 19 Oct 2016 10:06:38 +0530
Subject: [PATCH] CHF-406 Updated HealthCheck Implementation for Z-wave Dimmer
(GE 12718, GE 12724, GE 12729) with checkInterval of 32min
---
.../smartthings/dimmer-switch.src/.st-ignore | 2 +
.../smartthings/dimmer-switch.src/README.md | 45 +++++++++++++++++++
.../dimmer-switch.src/dimmer-switch.groovy | 10 +++++
3 files changed, 57 insertions(+)
create mode 100644 devicetypes/smartthings/dimmer-switch.src/.st-ignore
create mode 100644 devicetypes/smartthings/dimmer-switch.src/README.md
diff --git a/devicetypes/smartthings/dimmer-switch.src/.st-ignore b/devicetypes/smartthings/dimmer-switch.src/.st-ignore
new file mode 100644
index 0000000..f78b46e
--- /dev/null
+++ b/devicetypes/smartthings/dimmer-switch.src/.st-ignore
@@ -0,0 +1,2 @@
+.st-ignore
+README.md
diff --git a/devicetypes/smartthings/dimmer-switch.src/README.md b/devicetypes/smartthings/dimmer-switch.src/README.md
new file mode 100644
index 0000000..3c2cdaf
--- /dev/null
+++ b/devicetypes/smartthings/dimmer-switch.src/README.md
@@ -0,0 +1,45 @@
+# Z-wave Dimmer Switch
+
+
+
+Works with:
+
+* [GE Z-Wave In-Wall Smart Dimmer (GE 12724)](http://products.z-wavealliance.org/products/1197)
+* [GE Z-Wave In-Wall Smart Dimmer (Toggle) (GE 12729)](http://products.z-wavealliance.org/products/1201)
+* [GE Z-Wave Plug-in Smart Dimmer (GE 12718)](http://products.z-wavealliance.org/products/1191)
+
+## Table of contents
+
+* [Capabilities](#capabilities)
+* [Health](#device-health)
+* [Troubleshooting](#Troubleshooting)
+
+## Capabilities
+
+* **Switch Level** - it's defined to accept two parameters, the level and the rate of dimming
+* **Actuator** - represents that a Device has commands
+* **Indicator** - gives you the ability to set the indicator LED light on a Z-Wave switch
+* **Switch** - can detect state (possible values: on/off)
+* **Polling** - represents that poll() can be implemented for the device
+* **Refresh** - _refresh()_ command for status updates
+* **Sensor** - detects sensor events
+* **Health Check** - indicates ability to get device health notifications
+
+## Device Health
+
+Z-Wave Smart Dimmers (In-Wall, In-Wall(Toggle), Plug-In) are polled by the hub.
+As of hubCore version 0.14.38 the hub sends up reports every 15 minutes regardless of whether the state changed.
+Check-in interval = 32 mins.
+Not to mention after going OFFLINE when the device is plugged back in, it might take a considerable amount of time for
+the device to appear as ONLINE again. This is because if this listening device does not respond to two poll requests in a row,
+it is not polled for 5 minutes by the hub. This can delay up the process of being marked ONLINE by quite some time.
+
+## 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.
+Instructions related to pairing, resetting and removing the device from SmartThings can be found in the following link:
+* [General Z-Wave Dimmer/Switch Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/200955890-Troubleshooting-GE-in-wall-switch-or-dimmer-won-t-respond-to-commands-or-automations-Z-Wave-)
+* [GE Z-Wave In-Wall Smart Dimmer (GE 12724) Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/200902600-GE-In-Wall-Paddle-Dimmer-Switch-GE-12724-Z-Wave-)
+* [GE Z-Wave In-Wall Smart Dimmer (Toggle) (GE 12729) Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/207568463-GE-In-Wall-Smart-Toggle-Dimmer-GE-12729-Z-Wave-)
+* [GE Z-Wave Plug-in Smart Dimmer (GE 12718) Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/202088474-GE-Plug-In-Smart-Dimmer-GE-12718-Z-Wave-)
\ No newline at end of file
diff --git a/devicetypes/smartthings/dimmer-switch.src/dimmer-switch.groovy b/devicetypes/smartthings/dimmer-switch.src/dimmer-switch.groovy
index df06581..bcf0146 100644
--- a/devicetypes/smartthings/dimmer-switch.src/dimmer-switch.groovy
+++ b/devicetypes/smartthings/dimmer-switch.src/dimmer-switch.groovy
@@ -20,6 +20,7 @@ metadata {
capability "Polling"
capability "Refresh"
capability "Sensor"
+ capability "Health Check"
fingerprint mfr:"0063", prod:"4457", deviceJoinName: "Z-Wave Wall Dimmer"
fingerprint mfr:"0063", prod:"4944", deviceJoinName: "Z-Wave Wall Dimmer"
@@ -82,6 +83,8 @@ metadata {
}
def updated(){
+ // Device-Watch simply pings if no device events received for 32min(checkInterval)
+ sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
switch (ledIndicator) {
case "on":
indicatorWhenOn()
@@ -215,6 +218,13 @@ def poll() {
zwave.switchMultilevelV1.switchMultilevelGet().format()
}
+/**
+ * PING is used by Device-Watch in attempt to reach the Device
+ * */
+def ping() {
+ refresh()
+}
+
def refresh() {
log.debug "refresh() is called"
def commands = []