-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmatterTools.AqaraP2MatterTest.groovy
45 lines (35 loc) · 1.41 KB
/
matterTools.AqaraP2MatterTest.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
#include matterTools.matterHelperUtilities
metadata {
definition (name: "Aqara P2 Matter Test", namespace: "matterTools", author: "My Name") {
capability "Configuration"
capability "Refresh"
}
command "unsubscribeAll"
command "SubscribeEvents"
preferences {
// None for now
}
}
void unsubscribeAll(){
String cmd = matter.unsubscribe()
log.debug "Sending command to Unsubscribe for all events: " + cmd
sendHubCommand(new hubitat.device.HubAction(cmd, hubitat.device.Protocol.MATTER))
}
void parse(String description){
Map descMap = matter.parseDescriptionAsMap(description)
log.debug descMap
}
void SubscribeEvents(){
String cmd = 'he subscribe 0x0000 0x0700 [{"ep":"0xFFFF","cluster":"0xFFFFFFFF","evt":"0xFFFFFFFF"}]'
log.info "Subscribing to events using command: ${cmd}"
sendHubCommand(new hubitat.device.HubAction(cmd, hubitat.device.Protocol.MATTER))
}
void refresh() {
log.info "${device.displayName} refreshing all device data"
refreshMatter(ep:0xFFFF, clusterInt: 0xFFFFFFFF, attrInt: 0xFFFFFFFF)
}
void configure(){
String cmd = 'he subscribe 0x0001 0x0700 [{"ep":"0xFFFF","cluster":"0xFFFFFFFF","attr":"0xFFFFFFFF"}]'
log.info "Sending command to Subscribe for all events with a 1 second minimum time, refresh at 30 Minute maximum: " + cmd
sendHubCommand(new hubitat.device.HubAction(cmd, hubitat.device.Protocol.MATTER))
}