-
Notifications
You must be signed in to change notification settings - Fork 0
/
Temperature Tile
50 lines (39 loc) · 1.01 KB
/
Temperature Tile
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
/*
Virtual Device with `energy` value to pass details to Actiontiles object.
*/
metadata {
definition(name: "Temperature Tile", namespace: "s.tavener", author: "Stavener" ) {
capability "Temperature Measurement"
capability "Sensor"
capability "Actuator"
command "settemperature"
command "gettemperature"
attribute "temperature", "number"
}
tiles {
valueTile("temperature", "device.temperature", width: 3, height: 1) {
state "default", label:'${currentValue} number}'
}
}
}
def initialize() {
state.value = 0.0
state.unit = "C"
log.debug("init")
}
def installed() {
log.debug "Installed"
initialize()
}
def updated() {
log.debug "Updated"
initialize()
}
def settemperature(new_value) {
log.debug "settemperature called temperature=$new_value"
sendEvent(name:"temperature", value: new_value, unit:"C")
}
private gettemperature() {
value = device.currentState("temperature")
return value
}