@@ -15,19 +15,27 @@ metadata {
15
15
// TODO: define status and reply messages here
16
16
}
17
17
18
- tiles {
18
+ tiles(scale : 2 ) {
19
+ multiAttributeTile(name :" rich-control" ){
20
+ tileAttribute (" device.switch" , key : " PRIMARY_CONTROL" ) {
21
+ attributeState " default" , label : " Hue Bridge" , action : " " , icon : " st.Lighting.light99-hue" , backgroundColor : " #F3C200"
22
+ }
23
+ tileAttribute (" serialNumber" , key : " SECONDARY_CONTROL" ) {
24
+ attributeState " default" , label :' SN: ${currentValue}'
25
+ }
26
+ }
19
27
standardTile(" icon" , " icon" , width : 1 , height : 1 , canChangeIcon : false , inactiveLabel : true , canChangeBackground : false ) {
20
28
state " default" , label : " Hue Bridge" , action : " " , icon : " st.Lighting.light99-hue" , backgroundColor : " #FFFFFF"
21
29
}
22
30
valueTile(" serialNumber" , " device.serialNumber" , decoration : " flat" , height : 1 , width : 2 , inactiveLabel : false ) {
23
31
state " default" , label :' SN: ${currentValue}'
24
32
}
25
- valueTile(" networkAddress" , " device.networkAddress" , decoration : " flat" , height : 1 , width : 2 , inactiveLabel : false ) {
33
+ valueTile(" networkAddress" , " device.networkAddress" , decoration : " flat" , height : 2 , width : 4 , inactiveLabel : false ) {
26
34
state " default" , label :' ${currentValue}' , height : 1 , width : 2 , inactiveLabel : false
27
35
}
28
36
29
37
main ([" icon" ])
30
- details([" networkAddress " , " serialNumber " ])
38
+ details([" rich-control " , " networkAddress " ])
31
39
}
32
40
}
33
41
@@ -36,40 +44,37 @@ def parse(description) {
36
44
log. debug " Parsing '${ description} '"
37
45
def results = []
38
46
def result = parent. parse(this , description)
39
-
40
47
if (result instanceof physicalgraph.device.HubAction ){
41
48
log. trace " HUE BRIDGE HubAction received -- DOES THIS EVER HAPPEN?"
42
49
results << result
43
50
} else if (description == " updated" ) {
44
51
// do nothing
45
52
log. trace " HUE BRIDGE was updated"
46
53
} else {
47
- log. trace " HUE BRIDGE, OTHER"
48
54
def map = description
49
55
if (description instanceof String ) {
50
56
map = stringToMap(description)
51
57
}
52
58
if (map?. name && map?. value) {
53
59
log. trace " HUE BRIDGE, GENERATING EVENT: $map . name : $map . value "
54
- results << createEvent(name : " ${ map?.name} " , value : " ${ map?.value} " )
55
- }
56
- else {
57
- log. trace " HUE BRIDGE, OTHER"
60
+ results << createEvent(name : " ${ map.name} " , value : " ${ map.value} " )
61
+ } else {
62
+ log. trace " Parsing description"
58
63
def msg = parseLanMessage(description)
59
64
if (msg. body) {
60
65
def contentType = msg. headers[" Content-Type" ]
61
66
if (contentType?. contains(" json" )) {
62
67
def bulbs = new groovy.json.JsonSlurper (). parseText(msg. body)
63
68
if (bulbs. state) {
64
- log. warn " NOT PROCESSED : $msg . body "
65
- }
66
- else {
67
- log . debug " HUE BRIDGE, GENERATING BULB LIST EVENT: $b ulbs "
68
- sendEvent( name : " bulbList " , value : device. hub. id, isStateChange : true , data : bulbs, displayed : false )
69
+ log. info " Bridge response : $msg . body "
70
+ } else {
71
+ // Sending Bulbs List to parent"
72
+ if (parent . state . inBulbDiscovery)
73
+ log . info parent . bulbListHandler( device. hub. id, msg . body )
69
74
}
70
75
}
71
76
else if (contentType?. contains(" xml" )) {
72
- log. debug " HUE BRIDGE, SWALLOWING BRIDGE DESCRIPTION RESPONSE -- BRIDGE ALREADY PRESENT"
77
+ log. debug " HUE BRIDGE ALREADY PRESENT"
73
78
}
74
79
}
75
80
}
0 commit comments