From 5c2e06c98d80493a39f69f8a95d11715c5eef939 Mon Sep 17 00:00:00 2001 From: Lars Finander Date: Tue, 6 Sep 2016 10:43:03 -0600 Subject: [PATCH] DVCSMP-2004 Philips Hue: Nullpointer in bridge --- devicetypes/smartthings/hue-bridge.src/hue-bridge.groovy | 8 ++++---- smartapps/smartthings/hue-connect.src/hue-connect.groovy | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/devicetypes/smartthings/hue-bridge.src/hue-bridge.groovy b/devicetypes/smartthings/hue-bridge.src/hue-bridge.groovy index 0986ae8..18e9a25 100644 --- a/devicetypes/smartthings/hue-bridge.src/hue-bridge.groovy +++ b/devicetypes/smartthings/hue-bridge.src/hue-bridge.groovy @@ -62,7 +62,7 @@ def parse(description) { log.trace "HUE BRIDGE, GENERATING EVENT: $map.name: $map.value" results << createEvent(name: "${map.name}", value: "${map.value}") } else { - log.trace "Parsing description" + log.trace "Parsing description" def msg = parseLanMessage(description) if (msg.body) { def contentType = msg.headers["Content-Type"] @@ -72,13 +72,13 @@ def parse(description) { log.info "Bridge response: $msg.body" } else { // Sending Bulbs List to parent" - if (parent.state.inBulbDiscovery) - log.info parent.bulbListHandler(device.hub.id, msg.body) + if (parent.isInBulbDiscovery()) + log.info parent.bulbListHandler(device.hub.id, msg.body) } } else if (contentType?.contains("xml")) { log.debug "HUE BRIDGE ALREADY PRESENT" - parent.hubVerification(device.hub.id, msg.body) + parent.hubVerification(device.hub.id, msg.body) } } } diff --git a/smartapps/smartthings/hue-connect.src/hue-connect.groovy b/smartapps/smartthings/hue-connect.src/hue-connect.groovy index 7a6e8a3..fdfb509 100644 --- a/smartapps/smartthings/hue-connect.src/hue-connect.groovy +++ b/smartapps/smartthings/hue-connect.src/hue-connect.groovy @@ -757,6 +757,10 @@ def isValidSource(macAddress) { return (vbridges?.find {"${it.value.mac}" == macAddress}) != null } +def isInBulbDiscovery() { + return state.inBulbDiscovery +} + ///////////////////////////////////// //CHILD DEVICE METHODS /////////////////////////////////////