-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzigbeeTools.zigbeeToolsSendTestStrings.groovy
48 lines (34 loc) · 1.44 KB
/
zigbeeTools.zigbeeToolsSendTestStrings.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
45
46
47
48
import groovy.transform.Field
metadata {
definition (name: "zigbeeTools Send Test Strings", namespace: "zigbeeTools", author: "James Mahon") {
capability "Actuator"
capability "Switch"
command "sendString", [[name:"Command*", type:"STRING"] ]
}
}
void sendString(command, sequenceNum) {
log.debug "Function sendString sending string:\n${command} with sequenceNum ${sequenceNum as Integer}"
List<String> cmds = []
cmds += command
log.debug cmds
sendHubCommand(new hubitat.device.HubMultiAction(cmds, hubitat.device.Protocol.ZIGBEE))
}
// This parser handles the Zigbee events.
void parse(String description) {
Map descMap = zigbee.parseDescriptionAsMap(description)
log.debug "Received message: ${description} producing map ${descMap}"
}
void on(Map inputs = [:]){
Map params = [cd: null , duration: null , level: null ] << inputs
List<String> cmds = []
cmds += "he cmd 0x${device.deviceNetworkId} 0x${device.endpointId} 0x0006 1 {}"
log.debug zigbee.on(0)
log.debug cmds
sendHubCommand(new hubitat.device.HubMultiAction(cmds, hubitat.device.Protocol.ZIGBEE))
}
void off(Map inputs = [:]){
Map params = [cd: null , duration: null , level: null ] << inputs
List<String> cmds = []
cmds += "he cmd 0x${device.deviceNetworkId} 0x${device.endpointId} 0x0006 0 {}"
sendHubCommand(new hubitat.device.HubMultiAction(cmds, hubitat.device.Protocol.ZIGBEE))
}