-
Notifications
You must be signed in to change notification settings - Fork 1
/
jvm.GenericComponentMeteringCentralSceneDimmer.groovy
74 lines (60 loc) · 2 KB
/
jvm.GenericComponentMeteringCentralSceneDimmer.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
metadata {
definition(name: "Generic Component Metering Central Scene Dimmer", namespace: "jvm", author: "jvm", component: true) {
capability "Switch"
capability "Refresh"
capability "Actuator"
capability "SwitchLevel"
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 (it.name in ["switch", "level", "power", "energy", "voltage", "energyConsumed", "amperage", "push", "held", "released", "doubleTapped", "multiTapButton"]) {
if (txtEnable) log.info it.descriptionText
sendEvent(it)
}
}
}
void on() {
parent?.componentOn(this.device)
}
void off() {
parent?.componentOff(this.device)
}
void setLevel(level) {
parent?.componentSetLevel(this.device,level)
}
void setLevel(level, ramp) {
parent?.componentSetLevel(this.device,level,ramp)
}
void startLevelChange(direction) {
parent?.componentStartLevelChange(this.device,direction)
}
void stopLevelChange() {
parent?.componentStopLevelChange(this.device)
}
void refresh() {
parent?.componentRefresh(this.device)
}