mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-18 21:03:39 +00:00
Compare commits
45 Commits
PROD_2017.
...
MSA-1890-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1dd36140d | ||
|
|
b3dc4714b6 | ||
|
|
949fa0e9e8 | ||
|
|
076187f6d4 | ||
|
|
65884a2d91 | ||
|
|
d5d2fb8560 | ||
|
|
0b4b4b3244 | ||
|
|
664197052e | ||
|
|
e5739fd425 | ||
|
|
6448a5bc7c | ||
|
|
1db3765a9c | ||
|
|
e4642e300f | ||
|
|
b4eed54ddd | ||
|
|
b2b03604a7 | ||
|
|
2b05817843 | ||
|
|
1f6a27f381 | ||
|
|
157bc3ef56 | ||
|
|
096f4f767f | ||
|
|
c15a21b8bf | ||
|
|
daefec9d1f | ||
|
|
a28c90e492 | ||
|
|
664b300b37 | ||
|
|
2b6d978d13 | ||
|
|
8197097e1d | ||
|
|
4644362465 | ||
|
|
2c25e293c0 | ||
|
|
63d8e6444b | ||
|
|
24f63a514a | ||
|
|
36fe6428ab | ||
|
|
2bc44e0205 | ||
|
|
24d079db7c | ||
|
|
283ed425d8 | ||
|
|
1545707ae3 | ||
|
|
2fd8cf1416 | ||
|
|
fe4a5239c7 | ||
|
|
ec781b18be | ||
|
|
43bedd41a8 | ||
|
|
f75e8a6b2d | ||
|
|
515fab9fa4 | ||
|
|
100e696d02 | ||
|
|
3e988ce657 | ||
|
|
00224c2d0b | ||
|
|
f05daf2f34 | ||
|
|
6fae023f7a | ||
|
|
ef8611d2ea |
@@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Fibaro Door/Window Sensor ZW5 with Temperature", namespace: "fibargroup", author: "Fibar Group S.A.") {
|
definition (name: "Fibaro Door/Window Sensor ZW5 with Temperature", namespace: "fibargroup", author: "Fibar Group S.A.", ocfDeviceType: "x.com.st.d.sensor.contact") {
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
capability "Contact Sensor"
|
capability "Contact Sensor"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Fibaro Door/Window Sensor ZW5", namespace: "fibargroup", author: "Fibar Group S.A.") {
|
definition (name: "Fibaro Door/Window Sensor ZW5", namespace: "fibargroup", author: "Fibar Group S.A.", ocfDeviceType: "x.com.st.d.sensor.contact") {
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
capability "Contact Sensor"
|
capability "Contact Sensor"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Fibaro Flood Sensor ZW5", namespace: "fibargroup", author: "Fibar Group S.A.") {
|
definition (name: "Fibaro Flood Sensor ZW5", namespace: "fibargroup", author: "Fibar Group S.A.", ocfDeviceType: "x.com.st.d.sensor.moisture") {
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Fibaro Motion Sensor ZW5", namespace: "fibargroup", author: "Fibar Group S.A.") {
|
definition (name: "Fibaro Motion Sensor ZW5", namespace: "fibargroup", author: "Fibar Group S.A.", ocfDeviceType: "x.com.st.d.sensor.motion") {
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Illuminance Measurement"
|
capability "Illuminance Measurement"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ metadata {
|
|||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Temperature Measurement"
|
capability "Temperature Measurement"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
// capability "Health Check"
|
capability "Health Check"
|
||||||
|
|
||||||
command "getLevel"
|
command "getLevel"
|
||||||
command "getOnOff"
|
command "getOnOff"
|
||||||
@@ -476,7 +476,7 @@ def configure() {
|
|||||||
|
|
||||||
// Device-Watch allows 2 check-in misses from device + ping (plus 1 min lag time)
|
// 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
|
// 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])
|
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
|
// get ZigBee ID by hidden tile because that's the only way we can do it
|
||||||
setZigBeeIdTile()
|
setZigBeeIdTile()
|
||||||
|
|||||||
@@ -100,6 +100,11 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed(){
|
||||||
|
// 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])
|
||||||
|
}
|
||||||
|
|
||||||
def updated(){
|
def updated(){
|
||||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
// 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])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
// 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])
|
||||||
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
// 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])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Cree Bulb", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Cree Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
|
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
|
|||||||
@@ -84,6 +84,11 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
// 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])
|
||||||
|
}
|
||||||
|
|
||||||
def updated(){
|
def updated(){
|
||||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
// 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])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ metadata {
|
|||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Polling"
|
capability "Polling"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
// capability "Health Check"
|
capability "Health Check"
|
||||||
|
|
||||||
command "open"
|
command "open"
|
||||||
command "close"
|
command "close"
|
||||||
|
|
||||||
fingerprint deviceId: "0x1100", inClusters: "0x26,0x72,0x86,0x77,0x80,0x20"
|
fingerprint deviceId: "0x1100", inClusters: "0x26,0x72,0x86,0x77,0x80,0x20"
|
||||||
// fingerprint mfr:"0157", prod:"0100", model:"0100", deviceJoinName: "EcoNet Controls Z-Wave Vent"
|
fingerprint mfr:"0157", prod:"0100", model:"0100", deviceJoinName: "EcoNet Controls Z-Wave Vent"
|
||||||
}
|
}
|
||||||
|
|
||||||
simulator {
|
simulator {
|
||||||
@@ -85,10 +85,15 @@ def parse(String description) {
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
// 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])
|
||||||
|
}
|
||||||
|
|
||||||
//send the command to stop polling
|
//send the command to stop polling
|
||||||
def updated() {
|
def updated() {
|
||||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
// 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])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
response("poll stop")
|
response("poll stop")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Everspring Flood Sensor", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Everspring Flood Sensor", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.moisture") {
|
||||||
capability "Water Sensor"
|
capability "Water Sensor"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Fibaro Motion Sensor", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Fibaro Motion Sensor", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.motion") {
|
||||||
capability "Motion Sensor"
|
capability "Motion Sensor"
|
||||||
capability "Temperature Measurement"
|
capability "Temperature Measurement"
|
||||||
capability "Acceleration Sensor"
|
capability "Acceleration Sensor"
|
||||||
@@ -436,4 +436,3 @@ def listCurrentParams() {
|
|||||||
|
|
||||||
delayBetween(cmds, 500)
|
delayBetween(cmds, 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed(){
|
||||||
|
// 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])
|
||||||
|
}
|
||||||
|
|
||||||
def updated(){
|
def updated(){
|
||||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
// 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])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "GE Link Bulb", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "GE Link Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
|
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
|
|||||||
@@ -57,10 +57,20 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void installed() {
|
def initialize() {
|
||||||
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"LAN\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device.hub.hardwareID}\"}", displayed: false)
|
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"LAN\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device.hub.hardwareID}\"}", displayed: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void installed() {
|
||||||
|
log.debug "installed()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "updated()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
// parse events into attributes
|
// parse events into attributes
|
||||||
def parse(description) {
|
def parse(description) {
|
||||||
log.debug "parse() - $description"
|
log.debug "parse() - $description"
|
||||||
|
|||||||
@@ -45,10 +45,20 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void installed() {
|
def initialize() {
|
||||||
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"LAN\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device.hub.hardwareID}\"}", displayed: false)
|
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"LAN\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device.hub.hardwareID}\"}", displayed: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void installed() {
|
||||||
|
log.debug "installed()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "updated()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
// parse events into attributes
|
// parse events into attributes
|
||||||
def parse(description) {
|
def parse(description) {
|
||||||
log.debug "Parsing '${description}'"
|
log.debug "Parsing '${description}'"
|
||||||
|
|||||||
@@ -66,10 +66,20 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void installed() {
|
def initialize() {
|
||||||
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"LAN\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device.hub.hardwareID}\"}", displayed: false)
|
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"LAN\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device.hub.hardwareID}\"}", displayed: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void installed() {
|
||||||
|
log.debug "installed()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "updated()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
// parse events into attributes
|
// parse events into attributes
|
||||||
def parse(description) {
|
def parse(description) {
|
||||||
log.debug "parse() - $description"
|
log.debug "parse() - $description"
|
||||||
|
|||||||
@@ -50,10 +50,19 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void installed() {
|
def initialize() {
|
||||||
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"LAN\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device.hub.hardwareID}\"}", displayed: false)
|
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"LAN\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device.hub.hardwareID}\"}", displayed: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void installed() {
|
||||||
|
log.debug "installed()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
// parse events into attributes
|
// parse events into attributes
|
||||||
def parse(description) {
|
def parse(description) {
|
||||||
log.debug "parse() - $description"
|
log.debug "parse() - $description"
|
||||||
|
|||||||
@@ -55,10 +55,20 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void installed() {
|
def initialize() {
|
||||||
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"LAN\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device.hub.hardwareID}\"}", displayed: false)
|
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"LAN\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device.hub.hardwareID}\"}", displayed: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void installed() {
|
||||||
|
log.debug "installed()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "updated()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
// parse events into attributes
|
// parse events into attributes
|
||||||
def parse(description) {
|
def parse(description) {
|
||||||
log.debug "parse() - $description"
|
log.debug "parse() - $description"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "LIFX Color Bulb", namespace: "smartthings", author: "LIFX") {
|
definition (name: "LIFX Color Bulb", namespace: "smartthings", author: "LIFX", ocfDeviceType: "oic.d.light") {
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Color Control"
|
capability "Color Control"
|
||||||
capability "Color Temperature"
|
capability "Color Temperature"
|
||||||
@@ -64,8 +64,18 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
|
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"cloud\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device?.hub?.hardwareID}\"}", displayed: false)
|
||||||
|
}
|
||||||
|
|
||||||
void installed() {
|
void installed() {
|
||||||
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"cloud\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device?.hub?.hardwareID}\"}")
|
log.debug "installed()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "updated()"
|
||||||
|
initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle commands
|
// handle commands
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "LIFX White Bulb", namespace: "smartthings", author: "LIFX") {
|
definition (name: "LIFX White Bulb", namespace: "smartthings", author: "LIFX", ocfDeviceType: "oic.d.light") {
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Color Temperature"
|
capability "Color Temperature"
|
||||||
capability "Switch"
|
capability "Switch"
|
||||||
@@ -55,8 +55,18 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
|
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"cloud\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device?.hub?.hardwareID}\"}", displayed: false)
|
||||||
|
}
|
||||||
|
|
||||||
void installed() {
|
void installed() {
|
||||||
sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"cloud\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${device?.hub?.hardwareID}\"}")
|
log.debug "installed()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "updated()"
|
||||||
|
initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle commands
|
// handle commands
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import groovy.json.JsonOutput
|
||||||
/**
|
/**
|
||||||
* Logitech Harmony Hub
|
* Logitech Harmony Hub
|
||||||
*
|
*
|
||||||
@@ -7,6 +8,7 @@ metadata {
|
|||||||
definition (name: "Logitech Harmony Hub C2C", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Logitech Harmony Hub C2C", namespace: "smartthings", author: "SmartThings") {
|
||||||
capability "Media Controller"
|
capability "Media Controller"
|
||||||
capability "Refresh"
|
capability "Refresh"
|
||||||
|
capability "Health Check"
|
||||||
|
|
||||||
command "activityoff"
|
command "activityoff"
|
||||||
command "alloff"
|
command "alloff"
|
||||||
@@ -38,6 +40,20 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
|
sendEvent(name: "DeviceWatch-Enroll", value: JsonOutput.toJson([protocol: "cloud", scheme:"untracked"]), displayed: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
log.debug "installed()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "updated()"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
def startActivity(String activityId) {
|
def startActivity(String activityId) {
|
||||||
log.debug "Executing 'Start Activity'"
|
log.debug "Executing 'Start Activity'"
|
||||||
log.trace parent.activity("$device.deviceNetworkId-$activityId","start")
|
log.trace parent.activity("$device.deviceNetworkId-$activityId","start")
|
||||||
@@ -58,6 +74,10 @@ def poll() {
|
|||||||
log.trace parent.poll()
|
log.trace parent.poll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def ping() {
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
log.debug "Executing 'Refresh'"
|
log.debug "Executing 'Refresh'"
|
||||||
log.trace parent.poll()
|
log.trace parent.poll()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Open/Closed Sensor", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Open/Closed Sensor", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.contact") {
|
||||||
capability "Contact Sensor"
|
capability "Contact Sensor"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "RGBW Light", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "RGBW Light", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
capability "Switch Level"
|
capability "Switch Level"
|
||||||
capability "Color Control"
|
capability "Color Control"
|
||||||
capability "Color Temperature"
|
capability "Color Temperature"
|
||||||
|
|||||||
@@ -91,6 +91,11 @@ def parse(String description) {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
// Device-Watch simply pings if no device events received for 482min(checkInterval)
|
||||||
|
sendEvent(name: "checkInterval", value: 2 * 4 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
// Device-Watch simply pings if no device events received for 482min(checkInterval)
|
// Device-Watch simply pings if no device events received for 482min(checkInterval)
|
||||||
sendEvent(name: "checkInterval", value: 2 * 4 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
sendEvent(name: "checkInterval", value: 2 * 4 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -135,10 +135,7 @@ def refresh() {
|
|||||||
return zigbee.readAttribute(0xFC45, 0x0000, ["mfgCode": 0x104E]) + // New firmware
|
return zigbee.readAttribute(0xFC45, 0x0000, ["mfgCode": 0x104E]) + // New firmware
|
||||||
zigbee.readAttribute(0xFC45, 0x0000, ["mfgCode": 0xC2DF]) + // Original firmware
|
zigbee.readAttribute(0xFC45, 0x0000, ["mfgCode": 0xC2DF]) + // Original firmware
|
||||||
zigbee.readAttribute(zigbee.TEMPERATURE_MEASUREMENT_CLUSTER, 0x0000) +
|
zigbee.readAttribute(zigbee.TEMPERATURE_MEASUREMENT_CLUSTER, 0x0000) +
|
||||||
zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x0020) +
|
zigbee.readAttribute(zigbee.POWER_CONFIGURATION_CLUSTER, 0x0020)
|
||||||
zigbee.configureReporting(0xFC45, 0x0000, DataType.INT16, 30, 3600, 100) +
|
|
||||||
zigbee.batteryConfig() +
|
|
||||||
zigbee.temperatureConfig(30, 300)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def configure() {
|
def configure() {
|
||||||
@@ -150,5 +147,10 @@ def configure() {
|
|||||||
|
|
||||||
// temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity
|
// temperature minReportTime 30 seconds, maxReportTime 5 min. Reporting interval if no activity
|
||||||
// battery minReport 30 seconds, maxReportTime 6 hrs by default
|
// battery minReport 30 seconds, maxReportTime 6 hrs by default
|
||||||
return refresh()
|
return refresh() +
|
||||||
|
zigbee.configureReporting(0xFC45, 0x0000, DataType.UINT16, 30, 3600, 100, ["mfgCode": 0x104E]) + // New firmware
|
||||||
|
zigbee.configureReporting(0xFC45, 0x0000, DataType.UINT16, 30, 3600, 100, ["mfgCode": 0xC2DF]) + // Original firmware
|
||||||
|
zigbee.batteryConfig() +
|
||||||
|
zigbee.temperatureConfig(30, 300)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
//DEPRECATED - Using the generic DTH for this device. Users need to be moved before deleting this DTH
|
//DEPRECATED - Using the generic DTH for this device. Users need to be moved before deleting this DTH
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Sylvania Ultra iQ", namespace:"smartthings", author: "SmartThings") {
|
definition (name: "Sylvania Ultra iQ", namespace:"smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
capability "Switch Level"
|
capability "Switch Level"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Switch"
|
capability "Switch"
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2017 SmartThings
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License. You may obtain a copy of the License at:
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
|
||||||
|
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing permissions and limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
metadata {
|
||||||
|
definition (name: "Simulated Refrigerator Door", namespace: "smartthings/testing", author: "SmartThings") {
|
||||||
|
capability "Contact Sensor"
|
||||||
|
capability "Sensor"
|
||||||
|
|
||||||
|
command "open"
|
||||||
|
command "close"
|
||||||
|
}
|
||||||
|
|
||||||
|
tiles {
|
||||||
|
standardTile("contact", "device.contact", width: 2, height: 2) {
|
||||||
|
state("closed", label:'${name}', icon:"st.contact.contact.closed", backgroundColor:"#79b821", action: "open")
|
||||||
|
state("open", label:'${name}', icon:"st.contact.contact.open", backgroundColor:"#ffa81e", action: "close")
|
||||||
|
}
|
||||||
|
standardTile("freezerDoor", "device.contact", width: 2, height: 2, decoration: "flat") {
|
||||||
|
state("closed", label:'Freezer', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
|
||||||
|
state("open", label:'Freezer', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
|
||||||
|
}
|
||||||
|
standardTile("mainDoor", "device.contact", width: 2, height: 2, decoration: "flat") {
|
||||||
|
state("closed", label:'Fridge', icon:"st.contact.contact.closed", backgroundColor:"#79b821")
|
||||||
|
state("open", label:'Fridge', icon:"st.contact.contact.open", backgroundColor:"#ffa81e")
|
||||||
|
}
|
||||||
|
standardTile("control", "device.contact", width: 1, height: 1, decoration: "flat") {
|
||||||
|
state("closed", label:'${name}', icon:"st.contact.contact.closed", action: "open")
|
||||||
|
state("open", label:'${name}', icon:"st.contact.contact.open", action: "close")
|
||||||
|
}
|
||||||
|
main "contact"
|
||||||
|
details "contact"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
sendEvent(name: "contact", value: "closed")
|
||||||
|
}
|
||||||
|
|
||||||
|
def open() {
|
||||||
|
sendEvent(name: "contact", value: "open")
|
||||||
|
parent.doorOpen(device.deviceNetworkId)
|
||||||
|
}
|
||||||
|
|
||||||
|
def close() {
|
||||||
|
sendEvent(name: "contact", value: "closed")
|
||||||
|
parent.doorClosed(device.deviceNetworkId)
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/**
|
||||||
|
* Simulated Refrigerator Temperature Control
|
||||||
|
*
|
||||||
|
* Copyright 2017 SmartThings
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License. You may obtain a copy of the License at:
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
|
||||||
|
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing permissions and limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
metadata {
|
||||||
|
definition (name: "Simulated Refrigerator Temperature Control", namespace: "smartthings/testing", author: "SmartThings") {
|
||||||
|
capability "Temperature Measurement"
|
||||||
|
capability "Thermostat Cooling Setpoint"
|
||||||
|
|
||||||
|
command "tempUp"
|
||||||
|
command "tempDown"
|
||||||
|
command "setpointUp"
|
||||||
|
command "setpointDown"
|
||||||
|
}
|
||||||
|
|
||||||
|
tiles {
|
||||||
|
valueTile("refrigerator", "device.temperature", width: 2, height: 2, canChangeBackground: true) {
|
||||||
|
state("temperature", label:'${currentValue}°', unit:"F",
|
||||||
|
backgroundColors:[
|
||||||
|
[value: 0, color: "#153591"],
|
||||||
|
[value: 40, color: "#1e9cbb"],
|
||||||
|
[value: 45, color: "#f1d801"]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
valueTile("freezer", "device.temperature", width: 2, height: 2, canChangeBackground: true) {
|
||||||
|
state("temperature", label:'${currentValue}°', unit:"F",
|
||||||
|
backgroundColors:[
|
||||||
|
[value: 0, color: "#153591"],
|
||||||
|
[value: 5, color: "#1e9cbb"],
|
||||||
|
[value: 15, color: "#f1d801"]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
valueTile("freezerSetpoint", "device.coolingSetpoint", inactiveLabel: false, decoration: "flat") {
|
||||||
|
state "setpoint", label:'Freezer Set: ${currentValue}°', unit:"F"
|
||||||
|
}
|
||||||
|
valueTile("refrigeratorSetpoint", "device.coolingSetpoint", inactiveLabel: false, decoration: "flat") {
|
||||||
|
state "heat", label:'Fridge Set: ${currentValue}°', unit:"F"
|
||||||
|
}
|
||||||
|
standardTile("tempUp", "device.temperature", inactiveLabel: false, decoration: "flat") {
|
||||||
|
state "default", action:"tempUp", icon:"st.thermostat.thermostat-up"
|
||||||
|
}
|
||||||
|
standardTile("tempDown", "device.temperature", inactiveLabel: false, decoration: "flat") {
|
||||||
|
state "default", action:"tempDown", icon:"st.thermostat.thermostat-down"
|
||||||
|
}
|
||||||
|
standardTile("setpointUp", "device.coolingSetpoint", inactiveLabel: false, decoration: "flat") {
|
||||||
|
state "default", action:"setpointUp", icon:"st.thermostat.thermostat-up"
|
||||||
|
}
|
||||||
|
standardTile("setpointDown", "device.coolingSetpoint", inactiveLabel: false, decoration: "flat") {
|
||||||
|
state "default", action:"setpointDown", icon:"st.thermostat.thermostat-down"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
sendEvent(name: "temperature", value: device.componentName == "freezer" ? 2 : 40)
|
||||||
|
sendEvent(name: "coolingSetpoint", value: device.componentName == "freezer" ? 2 : 40)
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
installed()
|
||||||
|
}
|
||||||
|
|
||||||
|
void tempUp() {
|
||||||
|
def value = device.currentValue("temperature") as Integer
|
||||||
|
sendEvent(name: "temperature", value: value + 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
void tempDown() {
|
||||||
|
def value = device.currentValue("temperature") as Integer
|
||||||
|
sendEvent(name: "temperature", value: value - 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
void setpointUp() {
|
||||||
|
def value = device.currentValue("coolingSetpoint") as Integer
|
||||||
|
sendEvent(name: "coolingSetpoint", value: value + 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
void setpointDown() {
|
||||||
|
def value = device.currentValue("coolingSetpoint") as Integer
|
||||||
|
sendEvent(name: "coolingSetpoint", value: value - 1)
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
/**
|
||||||
|
* Simulated Refrigerator
|
||||||
|
*
|
||||||
|
* Example composite device handler that simulates a refrigerator with a freezer compartment and a main compartment.
|
||||||
|
* Each of these compartments has its own door, temperature, and temperature setpoint. Each compartment modeled
|
||||||
|
* as a child device of the main refrigerator device so that temperature-based SmartApps can be used with each
|
||||||
|
* compartment
|
||||||
|
*
|
||||||
|
* Copyright 2017 SmartThings
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License. You may obtain a copy of the License at:
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
|
||||||
|
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing permissions and limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
metadata {
|
||||||
|
definition (name: "Simulated Refrigerator", namespace: "smartthings/testing", author: "SmartThings") {
|
||||||
|
capability "Contact Sensor"
|
||||||
|
}
|
||||||
|
|
||||||
|
tiles(scale: 2) {
|
||||||
|
standardTile("contact", "device.contact", width: 4, height: 4) {
|
||||||
|
state("closed", label:'${name}', icon:"st.fridge.fridge-closed", backgroundColor:"#79b821")
|
||||||
|
state("open", label:'${name}', icon:"st.fridge.fridge-open", backgroundColor:"#ffa81e")
|
||||||
|
}
|
||||||
|
childDeviceTile("freezerDoor", "freezerDoor", height: 2, width: 2, childTileName: "freezerDoor")
|
||||||
|
childDeviceTile("mainDoor", "mainDoor", height: 2, width: 2, childTileName: "mainDoor")
|
||||||
|
childDeviceTile("freezer", "freezer", height: 2, width: 2, childTileName: "freezer")
|
||||||
|
childDeviceTile("refrigerator", "refrigerator", height: 2, width: 2, childTileName: "refrigerator")
|
||||||
|
childDeviceTile("freezerSetpoint", "freezer", height: 1, width: 2, childTileName: "freezerSetpoint")
|
||||||
|
childDeviceTile("refrigeratorSetpoint", "refrigerator", height: 1, width: 2, childTileName: "refrigeratorSetpoint")
|
||||||
|
|
||||||
|
// for simulator
|
||||||
|
childDeviceTile("freezerUp", "freezer", height: 1, width: 1, childTileName: "tempUp")
|
||||||
|
childDeviceTile("freezerDown", "freezer", height: 1, width: 1, childTileName: "tempDown")
|
||||||
|
childDeviceTile("refrigeratorUp", "refrigerator", height: 1, width: 1, childTileName: "tempUp")
|
||||||
|
childDeviceTile("refrigeratorDown", "refrigerator", height: 1, width: 1, childTileName: "tempDown")
|
||||||
|
childDeviceTile("freezerDoorControl", "freezerDoor", height: 1, width: 1, childTileName: "control")
|
||||||
|
childDeviceTile("mainDoorControl", "mainDoor", height: 1, width: 1, childTileName: "control")
|
||||||
|
childDeviceTile("freezerSetpointUp", "freezer", height: 1, width: 1, childTileName: "setpointUp")
|
||||||
|
childDeviceTile("freezerSetpointDown", "freezer", height: 1, width: 1, childTileName: "setpointDown")
|
||||||
|
childDeviceTile("refrigeratorSetpointUp", "refrigerator", height: 1, width: 1, childTileName: "setpointUp")
|
||||||
|
childDeviceTile("refrigeratorSetpointDown", "refrigerator", height: 1, width: 1, childTileName: "setpointDown")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
state.counter = state.counter ? state.counter + 1 : 1
|
||||||
|
if (state.counter == 1) {
|
||||||
|
addChildDevice(
|
||||||
|
"Simulated Refrigerator Door",
|
||||||
|
"${device.deviceNetworkId}.1",
|
||||||
|
null,
|
||||||
|
[completedSetup: true, label: "${device.label} (Freezer Door)", componentName: "freezerDoor", componentLabel: "Freezer Door"])
|
||||||
|
|
||||||
|
addChildDevice(
|
||||||
|
"Simulated Refrigerator Door",
|
||||||
|
"${device.deviceNetworkId}.2",
|
||||||
|
null,
|
||||||
|
[completedSetup: true, label: "${device.label} (Main Door)", componentName: "mainDoor", componentLabel: "Main Door"])
|
||||||
|
|
||||||
|
addChildDevice(
|
||||||
|
"Simulated Refrigerator Temperature Control",
|
||||||
|
"${device.deviceNetworkId}.3",
|
||||||
|
null,
|
||||||
|
[completedSetup: true, label: "${device.label} (Freezer)", componentName: "freezer", componentLabel: "Freezer"])
|
||||||
|
|
||||||
|
addChildDevice(
|
||||||
|
"Simulated Refrigerator Temperature Control",
|
||||||
|
"${device.deviceNetworkId}.3",
|
||||||
|
null,
|
||||||
|
[completedSetup: true, label: "${device.label} (Fridge)", componentName: "refrigerator", componentLabel: "Fridge"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def doorOpen(dni) {
|
||||||
|
// If any door opens, then the refrigerator is considered to be open
|
||||||
|
sendEvent(name: "contact", value: "open")
|
||||||
|
}
|
||||||
|
|
||||||
|
def doorClosed(dni) {
|
||||||
|
// Both doors must be closed for the refrigerator to be considered closed
|
||||||
|
if (!childDevices.find{it.deviceNetworkId != dni && it.currentValue("contact") == "open"}) {
|
||||||
|
sendEvent(name: "contact", value: "closed")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,6 +20,7 @@ metadata {
|
|||||||
definition(name: "Wattvision", namespace: "smartthings", author: "Steve Vlaminck") {
|
definition(name: "Wattvision", namespace: "smartthings", author: "Steve Vlaminck") {
|
||||||
capability "Power Meter"
|
capability "Power Meter"
|
||||||
capability "Refresh"
|
capability "Refresh"
|
||||||
|
capability "Sensor"
|
||||||
attribute "powerContent", "string"
|
attribute "powerContent", "string"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
//DEPRECATED - Using the generic DTH for this device. Users need to be moved before deleting this DTH
|
//DEPRECATED - Using the generic DTH for this device. Users need to be moved before deleting this DTH
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "WeMo Bulb", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "WeMo Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
|
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ metadata {
|
|||||||
command "enrollResponse"
|
command "enrollResponse"
|
||||||
|
|
||||||
fingerprint inClusters: "0000, 0001, 0003, 0020, 0402, 0B05", outClusters: "0003, 0006, 0008, 0019", manufacturer: "OSRAM", model: "LIGHTIFY Dimming Switch", deviceJoinName: "OSRAM LIGHTIFY Dimming Switch"
|
fingerprint inClusters: "0000, 0001, 0003, 0020, 0402, 0B05", outClusters: "0003, 0006, 0008, 0019", manufacturer: "OSRAM", model: "LIGHTIFY Dimming Switch", deviceJoinName: "OSRAM LIGHTIFY Dimming Switch"
|
||||||
|
fingerprint inClusters: "0000, 0001, 0003, 0020, 0402, 0B05", outClusters: "0003, 0006, 0008, 0019", manufacturer: "CentraLite", model: "3130", deviceJoinName: "Centralite Zigbee Smart Switch"
|
||||||
//fingerprint inClusters: "0000, 0001, 0003, 0020, 0500", outClusters: "0003,0019", manufacturer: "CentraLite", model: "3455-L", deviceJoinName: "Iris Care Pendant"
|
//fingerprint inClusters: "0000, 0001, 0003, 0020, 0500", outClusters: "0003,0019", manufacturer: "CentraLite", model: "3455-L", deviceJoinName: "Iris Care Pendant"
|
||||||
fingerprint inClusters: "0000, 0001, 0003, 0007, 0020, 0402, 0B05", outClusters: "0003, 0006, 0019", manufacturer: "CentraLite", model: "3460-L", deviceJoinName: "Iris Smart Button"
|
fingerprint inClusters: "0000, 0001, 0003, 0007, 0020, 0402, 0B05", outClusters: "0003, 0006, 0019", manufacturer: "CentraLite", model: "3460-L", deviceJoinName: "Iris Smart Button"
|
||||||
fingerprint inClusters: "0000, 0001, 0003, 0007, 0020, 0B05", outClusters: "0003, 0006, 0019", manufacturer: "CentraLite", model:"3450-L", deviceJoinName: "Iris KeyFob"
|
fingerprint inClusters: "0000, 0001, 0003, 0007, 0020, 0B05", outClusters: "0003, 0006, 0019", manufacturer: "CentraLite", model:"3450-L", deviceJoinName: "Iris KeyFob"
|
||||||
@@ -251,12 +252,19 @@ def initialize() {
|
|||||||
if ((device.getDataValue("manufacturer") == "OSRAM") && (device.getDataValue("model") == "LIGHTIFY Dimming Switch")) {
|
if ((device.getDataValue("manufacturer") == "OSRAM") && (device.getDataValue("model") == "LIGHTIFY Dimming Switch")) {
|
||||||
sendEvent(name: "numberOfButtons", value: 2)
|
sendEvent(name: "numberOfButtons", value: 2)
|
||||||
}
|
}
|
||||||
else if ((device.getDataValue("manufacturer") == "CentraLite") &&
|
else if (device.getDataValue("manufacturer") == "CentraLite") {
|
||||||
((device.getDataValue("model") == "3455-L") || (device.getDataValue("model") == "3460-L"))) {
|
if (device.getDataValue("model") == "3130") {
|
||||||
sendEvent(name: "numberOfButtons", value: 1)
|
sendEvent(name: "numberOfButtons", value: 2)
|
||||||
}
|
}
|
||||||
else if ((device.getDataValue("manufacturer") == "CentraLite") && (device.getDataValue("model") == "3450-L")) {
|
else if ((device.getDataValue("model") == "3455-L") || (device.getDataValue("model") == "3460-L")) {
|
||||||
sendEvent(name: "numberOfButtons", value: 4)
|
sendEvent(name: "numberOfButtons", value: 1)
|
||||||
|
}
|
||||||
|
else if (device.getDataValue("model") == "3450-L") {
|
||||||
|
sendEvent(name: "numberOfButtons", value: 4)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sendEvent(name: "numberOfButtons", value: 4) //default case. can be changed later.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//default. can be changed
|
//default. can be changed
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "ZigBee Dimmer Power", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.switch") {
|
definition (name: "ZigBee Dimmer Power", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Refresh"
|
capability "Refresh"
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "ZigBee Dimmer", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.switch") {
|
definition (name: "ZigBee Dimmer", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Refresh"
|
capability "Refresh"
|
||||||
|
|||||||
46
devicetypes/smartthings/zigbee-lock.src/README.md
Normal file
46
devicetypes/smartthings/zigbee-lock.src/README.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# Zigbee Lock
|
||||||
|
|
||||||
|
Cloud Execution
|
||||||
|
|
||||||
|
Works with:
|
||||||
|
|
||||||
|
* [Yale Push Button Deadbolt (YRD210-HA)](https://www.smartthings.com/works-with-smartthings/door-locks/yale-push-button-deadbolt-yrd210)
|
||||||
|
* [Yale Touchscreen Lever (YRL220-ZB)](https://www.smartthings.com/works-with-smartthings/door-locks/yale-touchscreen-lever-yrl220)
|
||||||
|
* [Yale Touchscreen Deadbolt (YRD220-HA))](https://www.smartthings.com/works-with-smartthings/door-locks/yale-touchscreen-deadbolt-yrd220)
|
||||||
|
* [Yale Key Free Touchscreen Deadbolt (YRD240-HA)](https://www.smartthings.com/works-with-smartthings/door-locks/yale-key-free-touchscreen-deadbolt-yrd240)
|
||||||
|
* [Yale Push Button Lever Lock (YRL210-HA)](https://www.smartthings.com/works-with-smartthings/door-locks/yale-push-button-lever-lock-yrl210)
|
||||||
|
|
||||||
|
## Table of contents
|
||||||
|
|
||||||
|
* [Capabilities](#capabilities)
|
||||||
|
* [Health](#device-health)
|
||||||
|
* [Battery](#battery-specification)
|
||||||
|
* [Troubleshooting](#troubleshooting)
|
||||||
|
|
||||||
|
## Capabilities
|
||||||
|
|
||||||
|
* **Actuator** - represents that a Device has commands
|
||||||
|
* **Lock** - allows for the control of a lock device
|
||||||
|
* **Refresh** - _refresh()_ command for status updates
|
||||||
|
* **Sensor** - detects sensor events
|
||||||
|
* **Battery** - defines device uses a battery
|
||||||
|
* **Configuration** - _configure()_ command called when device is installed or device preferences updated
|
||||||
|
* **Health Check** - indicates ability to get device health notifications
|
||||||
|
|
||||||
|
## Device Health
|
||||||
|
|
||||||
|
Yale Push Button Deadbolt (YRD210-HA) is a Zigbee device and checks in every 1 hour.
|
||||||
|
Device-Watch allows 2 check-in misses from device plus some lag time. So Check-in interval = (2*60 + 2)mins = 122 mins.
|
||||||
|
|
||||||
|
* __122min__ checkInterval
|
||||||
|
|
||||||
|
## Battery Specification
|
||||||
|
|
||||||
|
Four AA 1.5V batteries are required.
|
||||||
|
|
||||||
|
## 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 sensor from SmartThings can be found in the following link:
|
||||||
|
* [Yale Locks Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/205138400)
|
||||||
@@ -24,6 +24,7 @@ import physicalgraph.zigbee.zcl.DataType
|
|||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
|
capability "Health Check"
|
||||||
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000,0001,0003,0004,0005,0009,0020,0101,0402,0B05,FDBD", outClusters: "000A,0019", manufacturer: "Kwikset", model: "SMARTCODE_DEADBOLT_5", deviceJoinName: "Kwikset 5-Button Deadbolt"
|
fingerprint profileId: "0104", inClusters: "0000,0001,0003,0004,0005,0009,0020,0101,0402,0B05,FDBD", outClusters: "000A,0019", manufacturer: "Kwikset", model: "SMARTCODE_DEADBOLT_5", deviceJoinName: "Kwikset 5-Button Deadbolt"
|
||||||
fingerprint profileId: "0104", inClusters: "0000,0001,0003,0004,0005,0009,0020,0101,0402,0B05,FDBD", outClusters: "000A,0019", manufacturer: "Kwikset", model: "SMARTCODE_LEVER_5", deviceJoinName: "Kwikset 5-Button Lever"
|
fingerprint profileId: "0104", inClusters: "0000,0001,0003,0004,0005,0009,0020,0101,0402,0B05,FDBD", outClusters: "000A,0019", manufacturer: "Kwikset", model: "SMARTCODE_LEVER_5", deviceJoinName: "Kwikset 5-Button Lever"
|
||||||
@@ -83,6 +84,9 @@ def uninstalled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def configure() {
|
def configure() {
|
||||||
|
// Device-Watch allows 2 check-in misses from device + ping (plus 2 min lag time)
|
||||||
|
sendEvent(name: "checkInterval", value: 2 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zigbee", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|
||||||
def cmds =
|
def cmds =
|
||||||
zigbee.configureReporting(CLUSTER_DOORLOCK, DOORLOCK_ATTR_LOCKSTATE,
|
zigbee.configureReporting(CLUSTER_DOORLOCK, DOORLOCK_ATTR_LOCKSTATE,
|
||||||
DataType.ENUM8, 0, 3600, null) +
|
DataType.ENUM8, 0, 3600, null) +
|
||||||
@@ -92,6 +96,13 @@ def configure() {
|
|||||||
return refresh() + cmds // send refresh cmds as part of config
|
return refresh() + cmds // send refresh cmds as part of config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
|
* */
|
||||||
|
def ping() {
|
||||||
|
zigbee.readAttribute(CLUSTER_DOORLOCK, DOORLOCK_ATTR_LOCKSTATE)
|
||||||
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
def cmds =
|
def cmds =
|
||||||
zigbee.readAttribute(CLUSTER_DOORLOCK, DOORLOCK_ATTR_LOCKSTATE) +
|
zigbee.readAttribute(CLUSTER_DOORLOCK, DOORLOCK_ATTR_LOCKSTATE) +
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import groovy.transform.Field
|
|||||||
@Field Boolean hasConfiguredHealthCheck = false
|
@Field Boolean hasConfiguredHealthCheck = false
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "ZLL Dimmer Bulb", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "ZLL Dimmer Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
|
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
import physicalgraph.zigbee.zcl.DataType
|
import physicalgraph.zigbee.zcl.DataType
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "ZLL RGB Bulb", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "ZLL RGB Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
|
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Color Control"
|
capability "Color Control"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
import physicalgraph.zigbee.zcl.DataType
|
import physicalgraph.zigbee.zcl.DataType
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "ZLL RGBW Bulb", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "ZLL RGBW Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
|
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Color Control"
|
capability "Color Control"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import groovy.transform.Field
|
|||||||
@Field Boolean hasConfiguredHealthCheck = false
|
@Field Boolean hasConfiguredHealthCheck = false
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "ZLL White Color Temperature Bulb 5000K", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "ZLL White Color Temperature Bulb 5000K", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
|
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Color Temperature"
|
capability "Color Temperature"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import groovy.transform.Field
|
|||||||
@Field Boolean hasConfiguredHealthCheck = false
|
@Field Boolean hasConfiguredHealthCheck = false
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "ZLL White Color Temperature Bulb", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "ZLL White Color Temperature Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
|
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Color Temperature"
|
capability "Color Temperature"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Z-Wave Dimmer Switch Generic", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.switch") {
|
definition (name: "Z-Wave Dimmer Switch Generic", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
|
||||||
capability "Switch Level"
|
capability "Switch Level"
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Health Check"
|
capability "Health Check"
|
||||||
@@ -78,6 +78,11 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed(){
|
||||||
|
// 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])
|
||||||
|
}
|
||||||
|
|
||||||
def updated(){
|
def updated(){
|
||||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
// 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])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Z-Wave Door/Window Sensor", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Z-Wave Door/Window Sensor", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.contact") {
|
||||||
capability "Contact Sensor"
|
capability "Contact Sensor"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
@@ -79,6 +79,11 @@ def parse(String description) {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
// Device-Watch simply pings if no device events received for 482min(checkInterval)
|
||||||
|
sendEvent(name: "checkInterval", value: 2 * 4 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
// Device-Watch simply pings if no device events received for 482min(checkInterval)
|
// Device-Watch simply pings if no device events received for 482min(checkInterval)
|
||||||
sendEvent(name: "checkInterval", value: 2 * 4 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
sendEvent(name: "checkInterval", value: 2 * 4 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ metadata {
|
|||||||
|
|
||||||
import physicalgraph.zwave.commands.barrieroperatorv1.*
|
import physicalgraph.zwave.commands.barrieroperatorv1.*
|
||||||
|
|
||||||
|
def installed(){
|
||||||
|
// 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])
|
||||||
|
}
|
||||||
|
|
||||||
def updated(){
|
def updated(){
|
||||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
// 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])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -68,6 +68,11 @@ metadata {
|
|||||||
import physicalgraph.zwave.commands.doorlockv1.*
|
import physicalgraph.zwave.commands.doorlockv1.*
|
||||||
import physicalgraph.zwave.commands.usercodev1.*
|
import physicalgraph.zwave.commands.usercodev1.*
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
// 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])
|
||||||
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
// 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])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -25,11 +25,13 @@ metadata {
|
|||||||
capability "Switch Level"
|
capability "Switch Level"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
|
capability "Health Check"
|
||||||
capability "Light"
|
capability "Light"
|
||||||
|
|
||||||
command "reset"
|
command "reset"
|
||||||
|
|
||||||
fingerprint inClusters: "0x26,0x32"
|
fingerprint inClusters: "0x26,0x32"
|
||||||
|
fingerprint mfr:"0086", prod:"0003", model:"001B", deviceJoinName: "Aeon Labs Micro Smart Dimmer 2E"
|
||||||
}
|
}
|
||||||
|
|
||||||
simulator {
|
simulator {
|
||||||
@@ -98,7 +100,15 @@ def parse(String description) {
|
|||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
// 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])
|
||||||
|
}
|
||||||
|
|
||||||
def updated() {
|
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])
|
||||||
|
|
||||||
response(refresh())
|
response(refresh())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,6 +173,14 @@ def poll() {
|
|||||||
], 1000)
|
], 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PING is used by Device-Watch in attempt to reach the Device
|
||||||
|
* */
|
||||||
|
def ping() {
|
||||||
|
log.debug "ping() called"
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
delayBetween([
|
delayBetween([
|
||||||
zwave.switchMultilevelV1.switchMultilevelGet().format(),
|
zwave.switchMultilevelV1.switchMultilevelGet().format(),
|
||||||
|
|||||||
@@ -74,6 +74,11 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
// 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])
|
||||||
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
// 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])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Z-Wave Motion Sensor", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Z-Wave Motion Sensor", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.motion") {
|
||||||
capability "Motion Sensor"
|
capability "Motion Sensor"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
@@ -51,7 +51,12 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def updated(){
|
def installed() {
|
||||||
|
// Device wakes up every 4 hours, this interval allows us to miss one wakeup notification before marking offline
|
||||||
|
sendEvent(name: "checkInterval", value: 8 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
// Device wakes up every 4 hours, this interval allows us to miss one wakeup notification before marking offline
|
// Device wakes up every 4 hours, this interval allows us to miss one wakeup notification before marking offline
|
||||||
sendEvent(name: "checkInterval", value: 8 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
sendEvent(name: "checkInterval", value: 8 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Z-Wave Plus Door/Window Sensor", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Z-Wave Plus Door/Window Sensor", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.contact") {
|
||||||
capability "Contact Sensor"
|
capability "Contact Sensor"
|
||||||
capability "Configuration"
|
capability "Configuration"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
# Z-wave Siren
|
|
||||||
|
|
||||||
Cloud Execution
|
|
||||||
|
|
||||||
Works with:
|
|
||||||
|
|
||||||
* [FortrezZ Siren Strobe Alarm](https://www.smartthings.com/works-with-smartthings/other/fortrezz-water-valve)
|
|
||||||
|
|
||||||
## Table of contents
|
|
||||||
|
|
||||||
* [Capabilities](#capabilities)
|
|
||||||
* [Health](#device-health)
|
|
||||||
* [Troubleshooting](#troubleshooting)
|
|
||||||
|
|
||||||
## Capabilities
|
|
||||||
|
|
||||||
* **Actuator** - represents that a Device has commands
|
|
||||||
* **Alarm** - allows for interacting with devices that serve as alarms
|
|
||||||
* **Battery** - defines device uses a battery
|
|
||||||
* **Health Check** - indicates ability to get device health notifications
|
|
||||||
* **Polling** - represents that poll() can be implemented for the device
|
|
||||||
* **Refresh** - _refresh()_ command for status updates
|
|
||||||
* **Sensor** - detects sensor events
|
|
||||||
* **Switch** - can detect state (possible values: on/off)
|
|
||||||
|
|
||||||
## Device Health
|
|
||||||
|
|
||||||
FortrezZ Siren Strobe Alarm is 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.
|
|
||||||
Device-Watch allows 2 check-in misses from device plus some lag time. So Check-in interval = (2*15 + 2)mins = 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.
|
|
||||||
|
|
||||||
* __32min__ 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.
|
|
||||||
Instructions related to pairing, resetting and removing the device from SmartThings can be found in the following link:
|
|
||||||
* [FortrezZ Siren Strobe Alarm Troubleshooting Tips](https://support.smartthings.com/hc/en-us/articles/202294760-FortrezZ-Siren-Strobe-Alarm)
|
|
||||||
@@ -20,7 +20,6 @@ metadata {
|
|||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Alarm"
|
capability "Alarm"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
capability "Health Check"
|
|
||||||
capability "Polling"
|
capability "Polling"
|
||||||
capability "Refresh"
|
capability "Refresh"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
@@ -28,7 +27,6 @@ metadata {
|
|||||||
|
|
||||||
|
|
||||||
fingerprint inClusters: "0x20,0x25,0x86,0x80,0x85,0x72,0x71"
|
fingerprint inClusters: "0x20,0x25,0x86,0x80,0x85,0x72,0x71"
|
||||||
fingerprint mfr:"0084", prod:"0313", model:"010B", deviceJoinName: "FortrezZ Siren Strobe Alarm"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
simulator {
|
simulator {
|
||||||
@@ -60,11 +58,6 @@ 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])
|
|
||||||
}
|
|
||||||
|
|
||||||
def createEvents(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
|
def createEvents(physicalgraph.zwave.commands.batteryv1.BatteryReport cmd) {
|
||||||
def map = [ name: "battery", unit: "%" ]
|
def map = [ name: "battery", unit: "%" ]
|
||||||
if (cmd.batteryLevel == 0xFF) {
|
if (cmd.batteryLevel == 0xFF) {
|
||||||
@@ -126,13 +119,6 @@ def both() {
|
|||||||
on()
|
on()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* PING is used by Device-Watch in attempt to reach the Device
|
|
||||||
* */
|
|
||||||
def ping() {
|
|
||||||
refresh()
|
|
||||||
}
|
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
log.debug "sending battery refresh command"
|
log.debug "sending battery refresh command"
|
||||||
zwave.batteryV1.batteryGet().format()
|
zwave.batteryV1.batteryGet().format()
|
||||||
|
|||||||
@@ -53,7 +53,12 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def updated(){
|
def installed() {
|
||||||
|
// Device checks in every hour, this interval allows us to miss one check-in notification before marking offline
|
||||||
|
sendEvent(name: "checkInterval", value: 2 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
// Device checks in every hour, this interval allows us to miss one check-in notification before marking offline
|
// Device checks in every hour, this interval allows us to miss one check-in notification before marking offline
|
||||||
sendEvent(name: "checkInterval", value: 2 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
sendEvent(name: "checkInterval", value: 2 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,11 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed(){
|
||||||
|
// Device-Watch simply pings if no device events received for checkInterval duration of 32min = 2 * 15min + 2min lag time
|
||||||
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
}
|
||||||
|
|
||||||
def updated(){
|
def updated(){
|
||||||
// Device-Watch simply pings if no device events received for checkInterval duration of 32min = 2 * 15min + 2min lag time
|
// Device-Watch simply pings if no device events received for checkInterval duration of 32min = 2 * 15min + 2min lag time
|
||||||
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
// 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])
|
||||||
|
}
|
||||||
|
|
||||||
def updated(){
|
def updated(){
|
||||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
// 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])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -124,6 +124,11 @@ metadata {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def installed(){
|
||||||
|
// 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])
|
||||||
|
}
|
||||||
|
|
||||||
def updated(){
|
def updated(){
|
||||||
// Device-Watch simply pings if no device events received for 32min(checkInterval)
|
// 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])
|
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID])
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
* Date: 2013-03-07
|
* Date: 2013-03-07
|
||||||
*/
|
*/
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Z-Wave Virtual Momentary Contact Switch", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Z-Wave Virtual Momentary Contact Switch", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.contact") {
|
||||||
capability "Actuator"
|
capability "Actuator"
|
||||||
capability "Switch"
|
capability "Switch"
|
||||||
capability "Refresh"
|
capability "Refresh"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Z-Wave Water Sensor", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "Z-Wave Water Sensor", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.moisture") {
|
||||||
capability "Water Sensor"
|
capability "Water Sensor"
|
||||||
capability "Sensor"
|
capability "Sensor"
|
||||||
capability "Battery"
|
capability "Battery"
|
||||||
|
|||||||
@@ -0,0 +1,649 @@
|
|||||||
|
import javax.crypto.Mac;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
|
||||||
|
definition(
|
||||||
|
name: "OpenT2T SmartApp Test",
|
||||||
|
namespace: "opent2t",
|
||||||
|
author: "Microsoft",
|
||||||
|
description: "SmartApp for end to end SmartThings scenarios via OpenT2T",
|
||||||
|
category: "SmartThings Labs",
|
||||||
|
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
|
||||||
|
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
|
||||||
|
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
|
||||||
|
|
||||||
|
/** --------------------+---------------+-----------------------+------------------------------------
|
||||||
|
* Device Type | Attribute Name| Commands | Attribute Values
|
||||||
|
* --------------------+---------------+-----------------------+------------------------------------
|
||||||
|
* switches | switch | on, off | on, off
|
||||||
|
* motionSensors | motion | | active, inactive
|
||||||
|
* contactSensors | contact | | open, closed
|
||||||
|
* presenceSensors | presence | | present, 'not present'
|
||||||
|
* temperatureSensors | temperature | | <numeric, F or C according to unit>
|
||||||
|
* accelerationSensors | acceleration | | active, inactive
|
||||||
|
* waterSensors | water | | wet, dry
|
||||||
|
* lightSensors | illuminance | | <numeric, lux>
|
||||||
|
* humiditySensors | humidity | | <numeric, percent>
|
||||||
|
* locks | lock | lock, unlock | locked, unlocked
|
||||||
|
* garageDoors | door | open, close | unknown, closed, open, closing, opening
|
||||||
|
* cameras | image | take | <String>
|
||||||
|
* thermostats | thermostat | setHeatingSetpoint, | temperature, heatingSetpoint, coolingSetpoint,
|
||||||
|
* | | setCoolingSetpoint, | thermostatSetpoint, thermostatMode,
|
||||||
|
* | | off, heat, cool, auto,| thermostatFanMode, thermostatOperatingState
|
||||||
|
* | | emergencyHeat, |
|
||||||
|
* | | setThermostatMode, |
|
||||||
|
* | | fanOn, fanAuto, |
|
||||||
|
* | | fanCirculate, |
|
||||||
|
* | | setThermostatFanMode |
|
||||||
|
* --------------------+---------------+-----------------------+------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
//Device Inputs
|
||||||
|
preferences {
|
||||||
|
section("Allow Microsoft to control these things...") {
|
||||||
|
// input "contactSensors", "capability.contactSensor", title: "Which Contact Sensors", multiple: true, required: false, hideWhenEmpty: true
|
||||||
|
// input "garageDoors", "capability.garageDoorControl", title: "Which Garage Doors?", multiple: true, required: false, hideWhenEmpty: true
|
||||||
|
// input "locks", "capability.lock", title: "Which Locks?", multiple: true, required: false, hideWhenEmpty: true
|
||||||
|
// input "cameras", "capability.videoCapture", title: "Which Cameras?", multiple: true, required: false, hideWhenEmpty: true
|
||||||
|
// input "motionSensors", "capability.motionSensor", title: "Which Motion Sensors?", multiple: true, required: false, hideWhenEmpty: true
|
||||||
|
// input "presenceSensors", "capability.presenceSensor", title: "Which Presence Sensors", multiple: true, required: false, hideWhenEmpty: true
|
||||||
|
input "switches", "capability.switch", title: "Which Switches and Lights?", multiple: true, required: false, hideWhenEmpty: true
|
||||||
|
input "thermostats", "capability.thermostat", title: "Which Thermostat?", multiple: true, required: false, hideWhenEmpty: true
|
||||||
|
// input "waterSensors", "capability.waterSensor", title: "Which Water Leak Sensors?", multiple: true, required: false, hideWhenEmpty: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def getInputs() {
|
||||||
|
def inputList = []
|
||||||
|
inputList += contactSensors?: []
|
||||||
|
inputList += garageDoors?: []
|
||||||
|
inputList += locks?: []
|
||||||
|
inputList += cameras?: []
|
||||||
|
inputList += motionSensors?: []
|
||||||
|
inputList += presenceSensors?: []
|
||||||
|
inputList += switches?: []
|
||||||
|
inputList += thermostats?: []
|
||||||
|
inputList += waterSensors?: []
|
||||||
|
return inputList
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//API external Endpoints
|
||||||
|
mappings {
|
||||||
|
path("/devices") {
|
||||||
|
action: [
|
||||||
|
GET: "getDevices"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/devices/:id") {
|
||||||
|
action: [
|
||||||
|
GET: "getDevice"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/update/:id") {
|
||||||
|
action: [
|
||||||
|
PUT: "updateDevice"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/deviceSubscription") {
|
||||||
|
action: [
|
||||||
|
POST: "registerDeviceChange",
|
||||||
|
DELETE: "unregisterDeviceChange"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
path("/locationSubscription") {
|
||||||
|
action: [
|
||||||
|
POST: "registerDeviceGraph",
|
||||||
|
DELETE: "unregisterDeviceGraph"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def installed() {
|
||||||
|
log.debug "Installing with settings: ${settings}"
|
||||||
|
initialize()
|
||||||
|
}
|
||||||
|
|
||||||
|
def updated() {
|
||||||
|
log.debug "Updating with settings: ${settings}"
|
||||||
|
|
||||||
|
//Initialize state variables if didn't exist.
|
||||||
|
if( state.deviceSubscriptionMap == null ){
|
||||||
|
state.deviceSubscriptionMap = [:]
|
||||||
|
log.debug "deviceSubscriptionMap created."
|
||||||
|
}
|
||||||
|
if( state.locationSubscriptionMap == null ){
|
||||||
|
state.locationSubscriptionMap = [:]
|
||||||
|
log.debug "locationSubscriptionMap created."
|
||||||
|
}
|
||||||
|
if(state.verificationKeyMap == null){
|
||||||
|
state.verificationKeyMap = [:]
|
||||||
|
log.debug "verificationKeyMap created."
|
||||||
|
}
|
||||||
|
|
||||||
|
unsubscribe()
|
||||||
|
registerAllDeviceSubscriptions()
|
||||||
|
}
|
||||||
|
|
||||||
|
def initialize() {
|
||||||
|
log.debug "Initializing with settings: ${settings}"
|
||||||
|
state.deviceSubscriptionMap = [:]
|
||||||
|
log.debug "deviceSubscriptionMap created."
|
||||||
|
state.locationSubscriptionMap = [:]
|
||||||
|
log.debug "locationSubscriptionMap created."
|
||||||
|
state.verificationKeyMap = [:]
|
||||||
|
log.debug "verificationKeyMap created."
|
||||||
|
registerAllDeviceSubscriptions()
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** Subscription Functions ***/
|
||||||
|
|
||||||
|
//Subscribe events for all devices
|
||||||
|
def registerAllDeviceSubscriptions() {
|
||||||
|
registerChangeHandler(inputs)
|
||||||
|
}
|
||||||
|
|
||||||
|
//Subscribe to events from a list of devices
|
||||||
|
def registerChangeHandler(myList) {
|
||||||
|
myList.each { myDevice ->
|
||||||
|
def theAtts = myDevice.supportedAttributes
|
||||||
|
theAtts.each {att ->
|
||||||
|
subscribe(myDevice, att.name, deviceEventHandler)
|
||||||
|
log.info "Registering for ${myDevice.displayName}.${att.name}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Endpoints function: Subscribe to events from a specific device
|
||||||
|
def registerDeviceChange() {
|
||||||
|
def subscriptionEndpt = params.subscriptionURL
|
||||||
|
def deviceId = params.deviceId
|
||||||
|
def myDevice = findDevice(deviceId)
|
||||||
|
|
||||||
|
if( myDevice == null ){
|
||||||
|
httpError(404, "Cannot find device with device ID ${deviceId}.")
|
||||||
|
}
|
||||||
|
|
||||||
|
def theAtts = myDevice.supportedAttributes
|
||||||
|
try {
|
||||||
|
theAtts.each {att ->
|
||||||
|
subscribe(myDevice, att.name, deviceEventHandler)
|
||||||
|
}
|
||||||
|
log.info "Subscribing for ${myDevice.displayName}"
|
||||||
|
|
||||||
|
if(subscriptionEndpt != null){
|
||||||
|
if(state.deviceSubscriptionMap[deviceId] == null){
|
||||||
|
state.deviceSubscriptionMap.put(deviceId, [subscriptionEndpt])
|
||||||
|
log.info "Added subscription URL: ${subscriptionEndpt} for ${myDevice.displayName}"
|
||||||
|
} else if (!state.deviceSubscriptionMap[deviceId].contains(subscriptionEndpt)){
|
||||||
|
// state.deviceSubscriptionMap[deviceId] << subscriptionEndpt
|
||||||
|
// For now, we will only have one subscription endpoint per device
|
||||||
|
state.deviceSubscriptionMap.remove(deviceId)
|
||||||
|
state.deviceSubscriptionMap.put(deviceId, [subscriptionEndpt])
|
||||||
|
log.info "Added subscription URL: ${subscriptionEndpt} for ${myDevice.displayName}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if(params.key != null){
|
||||||
|
state.verificationKeyMap[subscriptionEndpt] = params.key
|
||||||
|
log.info "Added verification key: ${params.key} for ${subscriptionEndpt}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
httpError(500, "something went wrong: $e")
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info "Current subscription map is ${state.deviceSubscriptionMap}"
|
||||||
|
log.info "Current verification key map is ${state.verificationKeyMap}"
|
||||||
|
return ["succeed"]
|
||||||
|
}
|
||||||
|
|
||||||
|
//Endpoints function: Unsubscribe to events from a specific device
|
||||||
|
def unregisterDeviceChange() {
|
||||||
|
def subscriptionEndpt = params.subscriptionURL
|
||||||
|
def deviceId = params.deviceId
|
||||||
|
def myDevice = findDevice(deviceId)
|
||||||
|
|
||||||
|
if( myDevice == null ){
|
||||||
|
httpError(404, "Cannot find device with device ID ${deviceId}.")
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if(subscriptionEndpt != null && subscriptionEndpt != "undefined"){
|
||||||
|
if (state.deviceSubscriptionMap[deviceId]?.contains(subscriptionEndpt)){
|
||||||
|
if(state.deviceSubscriptionMap[deviceId].size() == 1){
|
||||||
|
state.deviceSubscriptionMap.remove(deviceId)
|
||||||
|
} else {
|
||||||
|
state.deviceSubscriptionMap[deviceId].remove(subscriptionEndpt)
|
||||||
|
}
|
||||||
|
state.verificationKeyMap.remove(subscriptionEndpt)
|
||||||
|
log.info "Removed subscription URL: ${subscriptionEndpt} for ${myDevice.displayName}"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
state.deviceSubscriptionMap.remove(deviceId)
|
||||||
|
log.info "Unsubscriping for ${myDevice.displayName}"
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
httpError(500, "something went wrong: $e")
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info "Current subscription map is ${state.deviceSubscriptionMap}"
|
||||||
|
log.info "Current verification key map is ${state.verificationKeyMap}"
|
||||||
|
}
|
||||||
|
|
||||||
|
//Endpoints function: Subscribe to device additiona/removal updated in a location
|
||||||
|
def registerDeviceGraph() {
|
||||||
|
def subscriptionEndpt = params.subscriptionURL
|
||||||
|
|
||||||
|
if (subscriptionEndpt != null && subscriptionEndpt != "undefined"){
|
||||||
|
subscribe(location, "DeviceCreated", locationEventHandler, [filterEvents: false])
|
||||||
|
subscribe(location, "DeviceUpdated", locationEventHandler, [filterEvents: false])
|
||||||
|
subscribe(location, "DeviceDeleted", locationEventHandler, [filterEvents: false])
|
||||||
|
|
||||||
|
if(state.locationSubscriptionMap[location.id] == null){
|
||||||
|
state.locationSubscriptionMap.put(location.id, [subscriptionEndpt])
|
||||||
|
log.info "Added subscription URL: ${subscriptionEndpt} for Location ${location.name}"
|
||||||
|
}else if (!state.locationSubscriptionMap[location.id].contains(subscriptionEndpt)){
|
||||||
|
state.locationSubscriptionMap[location.id] << subscriptionEndpt
|
||||||
|
log.info "Added subscription URL: ${subscriptionEndpt} for Location ${location.name}"
|
||||||
|
}
|
||||||
|
|
||||||
|
if(params.key != null){
|
||||||
|
state.verificationKeyMap[subscriptionEndpt] = params.key
|
||||||
|
log.info "Added verification key: ${params.key} for ${subscriptionEndpt}"
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info "Current location subscription map is ${state.locationSubscriptionMap}"
|
||||||
|
log.info "Current verification key map is ${state.verificationKeyMap}"
|
||||||
|
return ["succeed"]
|
||||||
|
} else {
|
||||||
|
httpError(400, "missing input parameter: subscriptionURL")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Endpoints function: Unsubscribe to events from a specific device
|
||||||
|
def unregisterDeviceGraph() {
|
||||||
|
def subscriptionEndpt = params.subscriptionURL
|
||||||
|
|
||||||
|
try {
|
||||||
|
if(subscriptionEndpt != null && subscriptionEndpt != "undefined"){
|
||||||
|
if (state.locationSubscriptionMap[location.id]?.contains(subscriptionEndpt)){
|
||||||
|
if(state.locationSubscriptionMap[location.id].size() == 1){
|
||||||
|
state.locationSubscriptionMap.remove(location.id)
|
||||||
|
} else {
|
||||||
|
state.locationSubscriptionMap[location.id].remove(subscriptionEndpt)
|
||||||
|
}
|
||||||
|
state.verificationKeyMap.remove(subscriptionEndpt)
|
||||||
|
log.info "Removed subscription URL: ${subscriptionEndpt} for Location ${location.name}"
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
httpError(400, "missing input parameter: subscriptionURL")
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
httpError(500, "something went wrong: $e")
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info "Current location subscription map is ${state.locationSubscriptionMap}"
|
||||||
|
log.info "Current verification key map is ${state.verificationKeyMap}"
|
||||||
|
}
|
||||||
|
|
||||||
|
//When events are triggered, send HTTP post to web socket servers
|
||||||
|
def deviceEventHandler(evt) {
|
||||||
|
def evtDevice = evt.device
|
||||||
|
def evtDeviceType = getDeviceType(evtDevice)
|
||||||
|
def deviceData = [];
|
||||||
|
|
||||||
|
if(evtDeviceType == "thermostat") {
|
||||||
|
deviceData = [name: evtDevice.displayName, id: evtDevice.id, status:evtDevice.status, deviceType:evtDeviceType, manufacturer:evtDevice.manufacturerName, model:evtDevice.modelName, attributes: deviceAttributeList(evtDevice, evtDeviceType), locationMode: getLocationModeInfo(), locationId: location.id ]
|
||||||
|
} else {
|
||||||
|
deviceData = [name: evtDevice.displayName, id: evtDevice.id, status:evtDevice.status, deviceType:evtDeviceType, manufacturer:evtDevice.manufacturerName, model:evtDevice.modelName, attributes: deviceAttributeList(evtDevice, evtDeviceType), locationId: location.id ]
|
||||||
|
}
|
||||||
|
|
||||||
|
if(evt.data != null){
|
||||||
|
def evtData = parseJson(evt.data)
|
||||||
|
log.info "Received event for ${evtDevice.displayName}, data: ${evtData}, description: ${evt.descriptionText}"
|
||||||
|
}
|
||||||
|
|
||||||
|
def params = [ body: deviceData ]
|
||||||
|
|
||||||
|
//send event to all subscriptions urls
|
||||||
|
log.debug "Current subscription urls for ${evtDevice.displayName} is ${state.deviceSubscriptionMap[evtDevice.id]}"
|
||||||
|
state.deviceSubscriptionMap[evtDevice.id].each {
|
||||||
|
params.uri = "${it}"
|
||||||
|
if(state.verificationKeyMap[it] != null ){
|
||||||
|
def key = state.verificationKeyMap[it]
|
||||||
|
params.headers = [Signature: ComputHMACValue(key, groovy.json.JsonOutput.toJson(params.body))]
|
||||||
|
}
|
||||||
|
log.trace "POST URI: ${params.uri}"
|
||||||
|
log.trace "Headers: ${params.headers}"
|
||||||
|
log.trace "Payload: ${params.body}"
|
||||||
|
try{
|
||||||
|
httpPostJson(params) { resp ->
|
||||||
|
log.trace "response status code: ${resp.status}"
|
||||||
|
log.trace "response data: ${resp.data}"
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
log.error "something went wrong: $e"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def locationEventHandler(evt) {
|
||||||
|
log.info "Received event for location ${location.name}/${location.id}, Event: ${evt.name}, description: ${evt.descriptionText}, apiServerUrl: ${apiServerUrl("")}"
|
||||||
|
switch(evt.name){
|
||||||
|
case "DeviceCreated":
|
||||||
|
case "DeviceDeleted":
|
||||||
|
def evtDevice = evt.device
|
||||||
|
def evtDeviceType = getDeviceType(evtDevice)
|
||||||
|
def params = [ body: [ eventType:evt.name, deviceId: evtDevice.id, locationId: location.id ] ]
|
||||||
|
|
||||||
|
if (evt.name == "DeviceDeleted" && state.deviceSubscriptionMap[deviceId] != null){
|
||||||
|
state.deviceSubscriptionMap.remove(evtDevice.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
state.locationSubscriptionMap[location.id].each {
|
||||||
|
params.uri = "${it}"
|
||||||
|
if(state.verificationKeyMap[it] != null ){
|
||||||
|
def key = state.verificationKeyMap[it]
|
||||||
|
params.headers = [Signature: ComputHMACValue(key, groovy.json.JsonOutput.toJson(params.body))]
|
||||||
|
}
|
||||||
|
log.trace "POST URI: ${params.uri}"
|
||||||
|
log.trace "Headers: ${params.headers}"
|
||||||
|
log.trace "Payload: ${params.body}"
|
||||||
|
try{
|
||||||
|
httpPostJson(params) { resp ->
|
||||||
|
log.trace "response status code: ${resp.status}"
|
||||||
|
log.trace "response data: ${resp.data}"
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
log.error "something went wrong: $e"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "DeviceUpdated":
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ComputHMACValue(key, data){
|
||||||
|
try {
|
||||||
|
log.debug "data hased: ${data}"
|
||||||
|
SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA1")
|
||||||
|
Mac mac = Mac.getInstance("HmacSHA1")
|
||||||
|
mac.init(secretKeySpec)
|
||||||
|
byte[] digest = mac.doFinal(data.getBytes("UTF-8"))
|
||||||
|
return byteArrayToString(digest)
|
||||||
|
} catch (InvalidKeyException e) {
|
||||||
|
log.error "Invalid key exception while converting to HMac SHA1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private def byteArrayToString(byte[] data) {
|
||||||
|
BigInteger bigInteger = new BigInteger(1, data)
|
||||||
|
String hash = bigInteger.toString(16)
|
||||||
|
return hash
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** Device Query/Update Functions ***/
|
||||||
|
|
||||||
|
//Endpoints function: return all device data in json format
|
||||||
|
def getDevices() {
|
||||||
|
def deviceData = []
|
||||||
|
inputs?.each {
|
||||||
|
def deviceType = getDeviceType(it)
|
||||||
|
if(deviceType == "thermostat") {
|
||||||
|
deviceData << [name: it.displayName, id: it.id, status:it.status, deviceType:deviceType, manufacturer:it.manufacturerName, model:it.modelName, attributes: deviceAttributeList(it, deviceType), locationMode: getLocationModeInfo()]
|
||||||
|
} else {
|
||||||
|
deviceData << [name: it.displayName, id: it.id, status:it.status, deviceType:deviceType, manufacturer:it.manufacturerName, model:it.modelName, attributes: deviceAttributeList(it, deviceType)]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug "getDevices, return: ${deviceData}"
|
||||||
|
return deviceData
|
||||||
|
}
|
||||||
|
|
||||||
|
//Endpoints function: get device data
|
||||||
|
def getDevice() {
|
||||||
|
def it = findDevice(params.id)
|
||||||
|
def deviceType = getDeviceType(it)
|
||||||
|
def device
|
||||||
|
if(deviceType == "thermostat") {
|
||||||
|
device = [name: it.displayName, id: it.id, status:it.status, deviceType:deviceType, manufacturer:it.manufacturerName, model:it.modelName, attributes: deviceAttributeList(it,deviceType), locationMode: getLocationModeInfo()]
|
||||||
|
} else {
|
||||||
|
device = [name: it.displayName, id: it.id, status:it.status, deviceType:deviceType, manufacturer:it.manufacturerName, model:it.modelName, attributes: deviceAttributeList(it, deviceType)]
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug "getDevice, return: ${device}"
|
||||||
|
return device
|
||||||
|
}
|
||||||
|
|
||||||
|
//Endpoints function: update device data
|
||||||
|
void updateDevice() {
|
||||||
|
def device = findDevice(params.id)
|
||||||
|
request.JSON.each {
|
||||||
|
def command = it.key
|
||||||
|
def value = it.value
|
||||||
|
if (command){
|
||||||
|
def commandList = mapDeviceCommands(command, value)
|
||||||
|
command = commandList[0]
|
||||||
|
value = commandList[1]
|
||||||
|
|
||||||
|
if (command == "setAwayMode") {
|
||||||
|
log.info "Setting away mode to ${value}"
|
||||||
|
if (location.modes?.find {it.name == value}) {
|
||||||
|
location.setMode(value)
|
||||||
|
}
|
||||||
|
}else if (command == "thermostatSetpoint"){
|
||||||
|
switch(device.currentThermostatMode){
|
||||||
|
case "cool":
|
||||||
|
log.info "Update: ${device.displayName}, [${command}, ${value}]"
|
||||||
|
device.setCoolingSetpoint(value)
|
||||||
|
break
|
||||||
|
case "heat":
|
||||||
|
case "emergency heat":
|
||||||
|
log.info "Update: ${device.displayName}, [${command}, ${value}]"
|
||||||
|
device.setHeatingSetpoint(value)
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
httpError(501, "this mode: ${device.currentThermostatMode} does not allow changing thermostat setpoint.")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}else if (!device) {
|
||||||
|
log.error "updateDevice, Device not found"
|
||||||
|
httpError(404, "Device not found")
|
||||||
|
} else if (!device.hasCommand(command)) {
|
||||||
|
log.error "updateDevice, Device does not have the command"
|
||||||
|
httpError(404, "Device does not have such command")
|
||||||
|
} else {
|
||||||
|
if (command == "setColor") {
|
||||||
|
log.info "Update: ${device.displayName}, [${command}, ${value}]"
|
||||||
|
device."$command"(hex: value)
|
||||||
|
} else if(value.isNumber()) {
|
||||||
|
def intValue = value as Integer
|
||||||
|
log.info "Update: ${device.displayName}, [${command}, ${intValue}(int)]"
|
||||||
|
device."$command"(intValue)
|
||||||
|
} else if (value){
|
||||||
|
log.info "Update: ${device.displayName}, [${command}, ${value}]"
|
||||||
|
device."$command"(value)
|
||||||
|
} else {
|
||||||
|
log.info "Update: ${device.displayName}, [${command}]"
|
||||||
|
device."$command"()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** Private Functions ***/
|
||||||
|
|
||||||
|
//Return current location mode info
|
||||||
|
private getLocationModeInfo() {
|
||||||
|
return [mode: location.mode, supported: location.modes.name]
|
||||||
|
}
|
||||||
|
|
||||||
|
//Map each device to a type given it's capabilities
|
||||||
|
private getDeviceType(device) {
|
||||||
|
def deviceType
|
||||||
|
def capabilities = device.capabilities
|
||||||
|
log.debug "capabilities: [${device}, ${capabilities}]"
|
||||||
|
log.debug "supported commands: [${device}, ${device.supportedCommands}]"
|
||||||
|
|
||||||
|
//Loop through the device capability list to determine the device type.
|
||||||
|
capabilities.each {capability ->
|
||||||
|
switch(capability.name.toLowerCase())
|
||||||
|
{
|
||||||
|
case "switch":
|
||||||
|
deviceType = "switch"
|
||||||
|
|
||||||
|
//If the device also contains "Switch Level" capability, identify it as a "light" device.
|
||||||
|
if (capabilities.any{it.name.toLowerCase() == "switch level"}){
|
||||||
|
|
||||||
|
//If the device also contains "Power Meter" capability, identify it as a "dimmerSwitch" device.
|
||||||
|
if (capabilities.any{it.name.toLowerCase() == "power meter"}){
|
||||||
|
deviceType = "dimmerSwitch"
|
||||||
|
return deviceType
|
||||||
|
} else {
|
||||||
|
deviceType = "light"
|
||||||
|
return deviceType
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case "garageDoorControl":
|
||||||
|
deviceType = "garageDoor"
|
||||||
|
return deviceType
|
||||||
|
case "lock":
|
||||||
|
deviceType = "lock"
|
||||||
|
return deviceType
|
||||||
|
case "video camera":
|
||||||
|
deviceType = "camera"
|
||||||
|
return deviceType
|
||||||
|
case "thermostat":
|
||||||
|
deviceType = "thermostat"
|
||||||
|
return deviceType
|
||||||
|
case "acceleration sensor":
|
||||||
|
case "contact sensor":
|
||||||
|
case "motion sensor":
|
||||||
|
case "presence sensor":
|
||||||
|
case "water sensor":
|
||||||
|
deviceType = "genericSensor"
|
||||||
|
return deviceType
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return deviceType
|
||||||
|
}
|
||||||
|
|
||||||
|
//Return a specific device give the device ID.
|
||||||
|
private findDevice(deviceId) {
|
||||||
|
return inputs?.find { it.id == deviceId }
|
||||||
|
}
|
||||||
|
|
||||||
|
//Return a list of device attributes
|
||||||
|
private deviceAttributeList(device, deviceType) {
|
||||||
|
def attributeList = [:]
|
||||||
|
def allAttributes = device.supportedAttributes
|
||||||
|
allAttributes.each { attribute ->
|
||||||
|
try {
|
||||||
|
def currentState = device.currentState(attribute.name)
|
||||||
|
if(currentState != null ){
|
||||||
|
switch(attribute.name){
|
||||||
|
case 'temperature':
|
||||||
|
attributeList.putAll([ (attribute.name): currentState.value, 'temperatureScale':location.temperatureScale ])
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
attributeList.putAll([(attribute.name): currentState.value ])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( deviceType == "genericSensor" ){
|
||||||
|
def key = attribute.name + "_lastUpdated"
|
||||||
|
attributeList.putAll([ (key): currentState.isoDate ])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
attributeList.putAll([ (attribute.name): null ]);
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
attributeList.putAll([ (attribute.name): null ]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return attributeList
|
||||||
|
}
|
||||||
|
|
||||||
|
//Map device command and value.
|
||||||
|
//input command and value are from UWP,
|
||||||
|
//returns resultCommand and resultValue that corresponds with function and value in SmartApps
|
||||||
|
private mapDeviceCommands(command, value) {
|
||||||
|
log.debug "mapDeviceCommands: [${command}, ${value}]"
|
||||||
|
def resultCommand = command
|
||||||
|
def resultValue = value
|
||||||
|
switch (command) {
|
||||||
|
case "switch":
|
||||||
|
if (value == 1 || value == "1" || value == "on") {
|
||||||
|
resultCommand = "on"
|
||||||
|
resultValue = ""
|
||||||
|
} else if (value == 0 || value == "0" || value == "off") {
|
||||||
|
resultCommand = "off"
|
||||||
|
resultValue = ""
|
||||||
|
}
|
||||||
|
break
|
||||||
|
// light attributes
|
||||||
|
case "level":
|
||||||
|
resultCommand = "setLevel"
|
||||||
|
resultValue = value
|
||||||
|
break
|
||||||
|
case "hue":
|
||||||
|
resultCommand = "setHue"
|
||||||
|
resultValue = value
|
||||||
|
break
|
||||||
|
case "saturation":
|
||||||
|
resultCommand = "setSaturation"
|
||||||
|
resultValue = value
|
||||||
|
break
|
||||||
|
case "colorTemperature":
|
||||||
|
resultCommand = "setColorTemperature"
|
||||||
|
resultValue = value
|
||||||
|
break
|
||||||
|
case "color":
|
||||||
|
resultCommand = "setColor"
|
||||||
|
resultValue = value
|
||||||
|
// thermostat attributes
|
||||||
|
case "hvacMode":
|
||||||
|
resultCommand = "setThermostatMode"
|
||||||
|
resultValue = value
|
||||||
|
break
|
||||||
|
case "fanMode":
|
||||||
|
resultCommand = "setThermostatFanMode"
|
||||||
|
resultValue = value
|
||||||
|
break
|
||||||
|
case "awayMode":
|
||||||
|
resultCommand = "setAwayMode"
|
||||||
|
resultValue = value
|
||||||
|
break
|
||||||
|
case "coolingSetpoint":
|
||||||
|
resultCommand = "setCoolingSetpoint"
|
||||||
|
resultValue = value
|
||||||
|
break
|
||||||
|
case "heatingSetpoint":
|
||||||
|
resultCommand = "setHeatingSetpoint"
|
||||||
|
resultValue = value
|
||||||
|
break
|
||||||
|
case "thermostatSetpoint":
|
||||||
|
resultCommand = "thermostatSetpoint"
|
||||||
|
resultValue = value
|
||||||
|
break
|
||||||
|
// lock attributes
|
||||||
|
case "locked":
|
||||||
|
if (value == 1 || value == "1" || value == "lock") {
|
||||||
|
resultCommand = "lock"
|
||||||
|
resultValue = ""
|
||||||
|
}
|
||||||
|
else if (value == 0 || value == "0" || value == "unlock") {
|
||||||
|
resultCommand = "unlock"
|
||||||
|
resultValue = ""
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return [resultCommand,resultValue]
|
||||||
|
}
|
||||||
@@ -511,6 +511,10 @@ def pollResponse(response, data) {
|
|||||||
if (ResponseValues) {
|
if (ResponseValues) {
|
||||||
def map = [:]
|
def map = [:]
|
||||||
ResponseValues.hubs.each {
|
ResponseValues.hubs.each {
|
||||||
|
// Device-Watch relies on the Logitech Harmony Cloud to get the Device state.
|
||||||
|
def isAlive = it.value.status
|
||||||
|
def d = getChildDevice("harmony-${it.key}")
|
||||||
|
d?.sendEvent(name: "DeviceWatch-DeviceStatus", value: isAlive!=504? "online":"offline", displayed: false, isStateChange: true)
|
||||||
if (it.value.message == "OK") {
|
if (it.value.message == "OK") {
|
||||||
map["${it.key}"] = "${it.value.response.data.currentAvActivity},${it.value.response.data.activityStatus}"
|
map["${it.key}"] = "${it.value.response.data.currentAvActivity},${it.value.response.data.activityStatus}"
|
||||||
def hub = getChildDevice("harmony-${it.key}")
|
def hub = getChildDevice("harmony-${it.key}")
|
||||||
|
|||||||
Reference in New Issue
Block a user