From 709b9c0a4203b85c299bcd4db535806dcdcbdbcb Mon Sep 17 00:00:00 2001 From: Andrew Ash Date: Sat, 18 Apr 2020 23:12:25 -0700 Subject: [PATCH] Fix typo in _get_devices() name Fixes #108 This fixes the immediate problem that this method doesn't exist, but reveals a larger problem that calling `._get_devices()` in the error handler of `_get_devices()` can cause an infinite loop. On my instance now with this change, hass won't start up anymore and logs show this message: ``` 2020-04-18 23:04:36 WARNING (MainThread) [homeassistant.setup] Setup of badnest is taking over 10 seconds. ``` Reworking error handling to try N times and then permanently fail would be better than this infinite loop, but that's a separate PR. --- custom_components/badnest/api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/badnest/api.py b/custom_components/badnest/api.py index 6695414..9cf4973 100644 --- a/custom_components/badnest/api.py +++ b/custom_components/badnest/api.py @@ -160,11 +160,11 @@ class NestAPI(): except requests.exceptions.RequestException as e: _LOGGER.error(e) _LOGGER.error('Failed to get devices, trying again') - return self.get_devices() + return self._get_devices() except KeyError: _LOGGER.debug('Failed to get devices, trying to log in again') self.login() - return self.get_devices() + return self._get_devices() def _map_nest_protect_state(self, value):