-
Notifications
You must be signed in to change notification settings - Fork 175
/
Color Temp Virtual Dimmer.groovy
79 lines (69 loc) · 2.2 KB
/
Color Temp Virtual Dimmer.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
75
76
77
78
79
/**
* Copyright 2015 SmartThings
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
* Color Temp Virtual Dimmer - to be used with Color Temp via Virtual Dimmer SmartApp to make color temp adjustments in common SmartApps
*
* Author: Scott Gibson
*
* Date: 2015-03-12
*/
metadata {
definition (name: "Color Temp Virtual Dimmer", namespace: "sticks18", author: "Scott Gibson") {
capability "Actuator"
capability "Switch Level"
capability "Switch"
command "updateTemp"
attribute "kelvin", "number"
}
// simulator metadata
simulator {
}
// UI tile definitions
tiles {
valueTile("kelvin", "device.kelvin") {
state("device.kelvin", label:'${currentValue}k',
backgroundColors:[
[value: 2900, color: "#FFA757"],
[value: 3300, color: "#FFB371"],
[value: 3700, color: "#FFC392"],
[value: 4100, color: "#FFCEA6"],
[value: 4500, color: "#FFD7B7"],
[value: 4900, color: "#FFE0C7"],
[value: 5300, color: "#FFE8D5"],
[value: 6600, color: "#FFEFE1"]
]
)
}
valueTile("level", "device.level", inactiveLabel: false, decoration: "flat") {
state "level", label: 'Level ${currentValue}%'
}
controlTile("levelSliderControl", "device.level", "slider", height: 1, width: 2, inactiveLabel: false) {
state "level", action:"switch level.setLevel"
}
main "kelvin"
details "levelSliderControl", "level", "kelvin"
}
}
def parse(String description) {
}
def setLevel(value) {
log.debug "Setting level to ${value}"
sendEvent(name: "level", value: value)
parent.setLevel(this, value)
}
def on() {
}
def off() {
}
def updateTemp(value) {
sendEvent(name: "kelvin", value: value)
}