forked from Nakmans/smartthings-zigbee-device-handlers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVesternet VES-ZB-WAL-011 2 Zone Wall Controller Child Button.groovy
44 lines (38 loc) · 1.37 KB
/
Vesternet VES-ZB-WAL-011 2 Zone Wall Controller Child Button.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Vesternet VES-ZB-WAL-011 2 Zone Wall Controller Child Button
*
*/
import groovy.json.JsonOutput
metadata {
definition (name: "Vesternet VES-ZB-WAL-011 2 Zone Wall Controller Child Button", namespace: "Vesternet", author: "Vesternet", ocfDeviceType: "x.com.st.d.remotecontroller") {
capability "Button"
capability "Sensor"
}
}
def installed() {
logDebug("installed called")
sendEvent(getEvent(name: "numberOfButtons", value: "1", displayed: false))
sendEvent(getEvent(name: "supportedButtonValues", value: supportedButtonValues.encodeAsJSON(), displayed: false))
sendEvent(getEvent(name: "button", value: "pushed", isStateChange: true, displayed: false))
}
def updated() {
logDebug("updated called")
}
def sendButtonEvent(buttonNumber, value) {
logDebug("sendButtonEvent called buttonNumber: ${buttonNumber} value: ${value}")
sendEvent(getEvent(name: "button", value: value, descriptionText: "Button Number ${buttonNumber} was ${value}", data: [buttonNumber: buttonNumber], isStateChange: true))
}
def getSupportedButtonValues() {
logDebug("getSupportedButtonValues called")
def values = ["pushed", "held", "double"] //no released value supported by smartthings
return values
}
def getEvent(event) {
logDebug("getEvent called data: ${event}")
return createEvent(event)
}
def logDebug(msg) {
if (parent.logging) {
log.debug("${msg}")
}
}