diff --git a/devicetypes/plaidsystems/spruce-controller.src/.st-ignore b/devicetypes/plaidsystems/spruce-controller.src/.st-ignore new file mode 100644 index 0000000..f78b46e --- /dev/null +++ b/devicetypes/plaidsystems/spruce-controller.src/.st-ignore @@ -0,0 +1,2 @@ +.st-ignore +README.md diff --git a/devicetypes/plaidsystems/spruce-controller.src/README.md b/devicetypes/plaidsystems/spruce-controller.src/README.md new file mode 100644 index 0000000..1ace86e --- /dev/null +++ b/devicetypes/plaidsystems/spruce-controller.src/README.md @@ -0,0 +1,37 @@ +# Spruce Controller + +Cloud Execution + +Works with: + +* [Spruce Irrigation Controller](https://www.smartthings.com/works-with-smartthings/spruce/spruce-irrigation-controller) + +## Table of contents + +* [Capabilities](#capabilities) +* [Health](#device-health) +* [Troubleshooting](#troubleshooting) + +## Capabilities + +* **Switch** - can detect state (possible values: on/off) +* **Configuration** - _configure()_ command called when device is installed or device preferences updated +* **Refresh** - _refresh()_ command for status updates +* **Actuator** - represents that a Device has commands +* **Valve** - allows for the control of a valve device +* **Health Check** - indicates ability to get device health notifications + +## Device Health + +Spruce Controller with reporting interval of 10 mins. +SmartThings platform will ping the device after `checkInterval` seconds of inactivity in last attempt to reach the device before marking it `OFFLINE` + +* __22min__ 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: +* [Spruce Irrigation Controller Troubleshooting:](https://support.smartthings.com/hc/en-us/articles/208053773-Spruce-Irrigation-Controller-Sensor) diff --git a/devicetypes/plaidsystems/spruce-controller.src/spruce-controller.groovy b/devicetypes/plaidsystems/spruce-controller.src/spruce-controller.groovy index baf2f1a..bdde1b1 100644 --- a/devicetypes/plaidsystems/spruce-controller.src/spruce-controller.groovy +++ b/devicetypes/plaidsystems/spruce-controller.src/spruce-controller.groovy @@ -26,7 +26,8 @@ metadata { capability "Configuration" capability "Refresh" capability "Actuator" - capability "Valve" + capability "Valve" + capability "Health Check" attribute "switch", "string" attribute "switch1", "string" @@ -96,7 +97,7 @@ metadata { command "notify" command "updated" - fingerprint endpointId: "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18", profileId: "0104", deviceId: "0002", deviceVersion: "00", inClusters: "0000,0003,0004,0005,0006,000F", outClusters: "0003, 0019", manufacturer: "PLAID SYSTEMS", model: "PS-SPRZ16-01" + fingerprint endpointId: "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18", profileId: "0104", deviceId: "0002", deviceVersion: "00", inClusters: "0000,0003,0004,0005,0006,000F", outClusters: "0003, 0019", manufacturer: "PLAID SYSTEMS", model: "PS-SPRZ16-01", deviceJoinName: "Spruce Irrigation Controller" } @@ -248,8 +249,8 @@ def parse(String description) { log.debug "Alarm" map = getAlarm(descMap) } - } - + } + if (map) { result = createEvent(map) } @@ -366,14 +367,14 @@ def writeTime(wEP, runTime){ //set reporting and binding def configure() { - + // Device-Watch allows 2 check-in misses from device (plus 2 mins lag time) + sendEvent(name: "checkInterval", value: 2 * 10 * 60 + 2 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID]) String zigbeeId = swapEndianHex(device.hub.zigbeeId) log.debug "Confuguring Reporting and Bindings ${device.deviceNetworkId} ${device.zigbeeId}" sendEvent(name: 'configuration',value: 100, descriptionText: "Configuration initialized") def configCmds = [ //program on/off - "zdo bind 0x${device.deviceNetworkId} 1 1 6 {${device.zigbeeId}} {}", "delay 1000", "zdo bind 0x${device.deviceNetworkId} 1 1 0x09 {${device.zigbeeId}} {}", "delay 1000", "zdo bind 0x${device.deviceNetworkId} 1 1 0x0F {${device.zigbeeId}} {}", "delay 1000", //zones 1-8 @@ -396,10 +397,7 @@ def configure() { "zdo bind 0x${device.deviceNetworkId} 17 1 0x0F {${device.zigbeeId}} {}", "delay 1000", //rain sensor "zdo bind 0x${device.deviceNetworkId} 18 1 0x0F {${device.zigbeeId}} {}", - - "zcl global send-me-a-report 6 0 0x10 1 0 {01}", "delay 500", - "send 0x${device.deviceNetworkId} 1 1", "delay 500", - + "zcl global send-me-a-report 0x0F 0x55 0x10 1 0 {01}", "delay 500", "send 0x${device.deviceNetworkId} 1 1", "delay 500", @@ -458,7 +456,7 @@ def configure() { "zcl global send-me-a-report 0x09 0x00 0x21 1 0 {00}", "delay 500", "send 0x${device.deviceNetworkId} 1 1", "delay 500" ] - return configCmds + rain() + manual() + return configCmds + zigbee.onOffConfig() + rain() + manual() } @@ -483,7 +481,14 @@ private byte[] reverseArray(byte[] array) { i++; } return array -} +} + +/** + * PING is used by Device-Watch in attempt to reach the Device + * */ +def ping() { + refresh() +} def refresh() {