DVCSMP-1516 Hue (Connect) throws 15k groovy.lang.MissingPropertyException per day

-Only parse messages with JSON if they are from Hue bridge
This commit is contained in:
Lars Finander
2016-02-29 13:41:58 -08:00
parent 6a905e4380
commit f04a9e3f7a

View File

@@ -455,7 +455,7 @@ def locationHandler(evt) {
log.error "/description.xml returned a bridge that didn't exist"
}
}
} else if(headerString?.contains("json")) {
} else if(headerString?.contains("json") && isValidSource(parsedEvent.mac)) {
log.trace "description.xml response (application/json)"
def body = new groovy.json.JsonSlurper().parseText(parsedEvent.body)
if (body.success != null) {
@@ -494,6 +494,11 @@ def doDeviceSync(){
discoverBridges()
}
def isValidSource(macAddress) {
def vbridges = getVerifiedHueBridges()
return (vbridges?.find {"${it.value.mac}" == macAddress}) != null
}
/////////////////////////////////////
//CHILD DEVICE METHODS
/////////////////////////////////////