TpLink Device Tracker Error (#15918)

* Fix 'Error setting up platform tplink' error when a scanner fails even if another scanner would succeed

* Try to fix tox errors

* Adjust code based on PR comments
pull/16082/head
Tim Bailey 2018-08-20 22:34:52 +10:00 committed by Pascal Vizeli
parent a708a81fa8
commit 975befd136
1 changed files with 14 additions and 5 deletions

View File

@ -69,11 +69,16 @@ class TplinkDeviceScanner(DeviceScanner):
password = config[CONF_PASSWORD]
username = config[CONF_USERNAME]
self.tplink_client = TpLinkClient(
password, host=host, username=username)
self.success_init = False
try:
self.tplink_client = TpLinkClient(
password, host=host, username=username)
self.last_results = {}
self.success_init = self._update_info()
self.last_results = {}
self.success_init = self._update_info()
except requests.exceptions.ConnectionError:
_LOGGER.debug("ConnectionError in TplinkDeviceScanner")
def scan_devices(self):
"""Scan for new devices and return a list with found device IDs."""
@ -115,7 +120,11 @@ class Tplink1DeviceScanner(DeviceScanner):
self.password = password
self.last_results = {}
self.success_init = self._update_info()
self.success_init = False
try:
self.success_init = self._update_info()
except requests.exceptions.ConnectionError:
_LOGGER.debug("ConnectionError in Tplink1DeviceScanner")
def scan_devices(self):
"""Scan for new devices and return a list with found device IDs."""