From 4f67bf4b49147f05c68ba9d735d9e450de5eb5fc Mon Sep 17 00:00:00 2001 From: Andrew Ash Date: Sun, 19 Apr 2020 00:13:27 -0700 Subject: [PATCH] Improve error messages when user_id is unavailable --- custom_components/badnest/api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_components/badnest/api.py b/custom_components/badnest/api.py index 6695414..b2eb235 100644 --- a/custom_components/badnest/api.py +++ b/custom_components/badnest/api.py @@ -127,6 +127,7 @@ class NestAPI(): return self._get_cameras() def _get_devices(self): + assert self._user_id, "No user_id found; check configuration" try: r = self._session.post( f"{API_URL}/api/0.1/user/{self._user_id}/app_launch", @@ -178,6 +179,7 @@ class NestAPI(): return "Unknown" def update(self): + assert self._user_id, "No user_id found; check configuration" try: # To get friendly names r = self._session.post(