forked from twack/Quirky-Connect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Quirky-Nimbus-Device.groovy
88 lines (77 loc) · 2.24 KB
/
Quirky-Nimbus-Device.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
80
81
82
83
84
85
86
87
88
/*
* Quirky Nimbus
*
* Author: [email protected]
* Date: 2014-02-22
*
*****************************************************************
* Setup Namespace, capabilities, attributes and commands
*****************************************************************
* Namespace: "wackford"
*
* Capabilities: "polling"
* "refresh"
*
* Custom Attributes: "dial"
* "info"
*
* Custom Commands: "none"
*
*****************************************************************
* Changes
*****************************************************************
*
* Change 1: 2014-03-10
* Documented Header
*
*****************************************************************
* Code
*****************************************************************
*/
// for the UI
metadata {
// Automatically generated. Make future change here.
definition (name: "Quirky Nimbus", namespace: "wackford", author: "[email protected]", oauth: true) {
capability "Refresh"
capability "Polling"
attribute "dial", "string"
attribute "info", "string"
command "dial"
}
tiles {
standardTile("dial", "device.dial", width: 2, height: 2){
state "dial", label: '${currentValue}', icon:"st.custom.quirky.quirky-device"
}
valueTile("info", "device.info", inactiveLabel: false, decoration: "flat") {
state "info", label:'Dial is displaying ${currentValue}', unit:""
}
standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat") {
state "default", action:"refresh.refresh", icon:"st.secondary.refresh"
}
}
main(["dial"])
details(["dial","info","refresh" ])
}
// parse events into attributes
def parse(description) {
if ( description == "updated" )
return
log.debug "parse() - $description"
def results = []
if (description?.name && description?.value)
{
results << sendEvent(name: "${description?.name}", value: "${description?.value}")
}
}
def uninstalled() {
log.debug "Executing 'uninstall' in child"
parent.uninstallChildDevice(this)
}
def poll() {
log.debug "Nimbus executing 'pollNimbus'"
parent.pollNimbus(this)
}
def refresh() {
log.debug "Nimbus executing 'refresh'"
parent.pollNimbus(this)
}