From 87b6715a00fe772a4a9012b72550dae2e39136b5 Mon Sep 17 00:00:00 2001 From: adam Date: Fri, 2 Oct 2015 09:07:06 -0500 Subject: [PATCH] Handle incorrect mac address reporting --- smartapps/smartthings/hue-connect.src/hue-connect.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/smartapps/smartthings/hue-connect.src/hue-connect.groovy b/smartapps/smartthings/hue-connect.src/hue-connect.groovy index d68a753..f318ab7 100644 --- a/smartapps/smartthings/hue-connect.src/hue-connect.groovy +++ b/smartapps/smartthings/hue-connect.src/hue-connect.groovy @@ -722,6 +722,11 @@ private getBridgeIP() { if (host == null || host == "") { def serialNumber = selectedHue def bridge = getHueBridges().find { it?.value?.serialNumber?.equalsIgnoreCase(serialNumber) }?.value + if (!bridge) { + //failed because mac address sent from hub is wrong and doesn't match the hue's real mac address and serial number + //in this case we will look up the bridge by comparing the incorrect mac addresses + bridge = getHueBridges().find { it?.value?.mac?.equalsIgnoreCase(serialNumber) }?.value + } if (bridge?.ip && bridge?.port) { if (bridge?.ip.contains(".")) host = "${bridge?.ip}:${bridge?.port}"