Skip to content

Commit 8dd3b23

Browse files
committed
Hue update to match the new UI (Bridge)
1 parent e1a9f2f commit 8dd3b23

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

devicetypes/smartthings/hue-bridge.src/hue-bridge.groovy

+20-15
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,27 @@ metadata {
1515
// TODO: define status and reply messages here
1616
}
1717

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+
}
1927
standardTile("icon", "icon", width: 1, height: 1, canChangeIcon: false, inactiveLabel: true, canChangeBackground: false) {
2028
state "default", label: "Hue Bridge", action: "", icon: "st.Lighting.light99-hue", backgroundColor: "#FFFFFF"
2129
}
2230
valueTile("serialNumber", "device.serialNumber", decoration: "flat", height: 1, width: 2, inactiveLabel: false) {
2331
state "default", label:'SN: ${currentValue}'
2432
}
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) {
2634
state "default", label:'${currentValue}', height: 1, width: 2, inactiveLabel: false
2735
}
2836

2937
main (["icon"])
30-
details(["networkAddress","serialNumber"])
38+
details(["rich-control", "networkAddress"])
3139
}
3240
}
3341

@@ -36,40 +44,37 @@ def parse(description) {
3644
log.debug "Parsing '${description}'"
3745
def results = []
3846
def result = parent.parse(this, description)
39-
4047
if (result instanceof physicalgraph.device.HubAction){
4148
log.trace "HUE BRIDGE HubAction received -- DOES THIS EVER HAPPEN?"
4249
results << result
4350
} else if (description == "updated") {
4451
//do nothing
4552
log.trace "HUE BRIDGE was updated"
4653
} else {
47-
log.trace "HUE BRIDGE, OTHER"
4854
def map = description
4955
if (description instanceof String) {
5056
map = stringToMap(description)
5157
}
5258
if (map?.name && map?.value) {
5359
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"
5863
def msg = parseLanMessage(description)
5964
if (msg.body) {
6065
def contentType = msg.headers["Content-Type"]
6166
if (contentType?.contains("json")) {
6267
def bulbs = new groovy.json.JsonSlurper().parseText(msg.body)
6368
if (bulbs.state) {
64-
log.warn "NOT PROCESSED: $msg.body"
65-
}
66-
else {
67-
log.debug "HUE BRIDGE, GENERATING BULB LIST EVENT: $bulbs"
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)
6974
}
7075
}
7176
else if (contentType?.contains("xml")) {
72-
log.debug "HUE BRIDGE, SWALLOWING BRIDGE DESCRIPTION RESPONSE -- BRIDGE ALREADY PRESENT"
77+
log.debug "HUE BRIDGE ALREADY PRESENT"
7378
}
7479
}
7580
}

0 commit comments

Comments
 (0)