Fix TpLink Device Tracker initialize error (#22349)

Catch RequestException instead of ConnectionError
In some cases TpLinkDeviceScanner throws various successors of
RequestException. They should be caught.
This commit is contained in:
Andrew 2019-03-25 20:25:49 +03:00 committed by Jason Hu
parent f1a0ad9e4a
commit a59487a438

View File

@ -77,8 +77,8 @@ class TplinkDeviceScanner(DeviceScanner):
self.last_results = {} self.last_results = {}
self.success_init = self._update_info() self.success_init = self._update_info()
except requests.exceptions.ConnectionError: except requests.exceptions.RequestException:
_LOGGER.debug("ConnectionError in TplinkDeviceScanner") _LOGGER.debug("RequestException in %s", __class__.__name__)
def scan_devices(self): def scan_devices(self):
"""Scan for new devices and return a list with found device IDs.""" """Scan for new devices and return a list with found device IDs."""
@ -123,8 +123,8 @@ class Tplink1DeviceScanner(DeviceScanner):
self.success_init = False self.success_init = False
try: try:
self.success_init = self._update_info() self.success_init = self._update_info()
except requests.exceptions.ConnectionError: except requests.exceptions.RequestException:
_LOGGER.debug("ConnectionError in Tplink1DeviceScanner") _LOGGER.debug("RequestException in %s", __class__.__name__)
def scan_devices(self): def scan_devices(self):
"""Scan for new devices and return a list with found device IDs.""" """Scan for new devices and return a list with found device IDs."""