-
Notifications
You must be signed in to change notification settings - Fork 1
/
jvm.GenericComponentMeteringCentralSceneSwitch.groovy
55 lines (47 loc) · 1.45 KB
/
jvm.GenericComponentMeteringCentralSceneSwitch.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
49
50
51
52
53
54
55
metadata {
definition(name: "Generic Component Metering Central Scene Switch", namespace: "jvm", author: "jvm", component: true) {
capability "Switch"
capability "Refresh"
capability "Actuator"
capability "EnergyMeter"
capability "PowerMeter"
capability "VoltageMeasurement"
capability "CurrentMeter"
attribute "energyConsumed", "number" // Custom Attribute for meter devices supporting energy consumption. Comment out if not wanted.
attribute "push", "number"
attribute "held", "number"
attribute "released", "number"
attribute "doubleTapped", "number"
attribute "multiTapButton", "number"
}
preferences {
input name: "txtEnable", type: "bool", title: "Enable descriptionText logging", defaultValue: true
}
}
void updated() {
log.info "Updated..."
log.warn "description logging is: ${txtEnable == true}"
}
void installed() {
log.info "Installed..."
device.updateSetting("txtEnable",[type:"bool",value:true])
refresh()
}
void parse(String description) { log.warn "parse(String description) not implemented" }
void parse(List description) {
description.each {
if (device.hasAttribute(it.name)) {
if (txtEnable) log.info it.descriptionText
sendEvent(it)
}
}
}
void on() {
parent?.componentOn(this.device)
}
void off() {
parent?.componentOff(this.device)
}
void refresh() {
parent?.componentRefresh(this.device)
}