From 2d5da3e9589d5d0c71668da2a1ed51f9f9d2fc60 Mon Sep 17 00:00:00 2001 From: Jack Minardi Date: Tue, 25 Apr 2017 00:32:31 -0400 Subject: [PATCH] Catch `KeyError`; Add `response.text` to error message --- homeassistant/components/device_tracker/tplink.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/device_tracker/tplink.py b/homeassistant/components/device_tracker/tplink.py index 8d476136d23..b1ad68af3aa 100755 --- a/homeassistant/components/device_tracker/tplink.py +++ b/homeassistant/components/device_tracker/tplink.py @@ -195,8 +195,9 @@ class Tplink3DeviceScanner(TplinkDeviceScanner): self.sysauth = regex_result.group(1) _LOGGER.info(self.sysauth) return True - except ValueError: - _LOGGER.error("Couldn't fetch auth tokens!") + except (ValueError, KeyError) as e: + _LOGGER.error("Couldn't fetch auth tokens!" + "Response was: {}".format(response.text)) return False @Throttle(MIN_TIME_BETWEEN_SCANS)