From e5655f1705b0c1f8b5b36185b6e9102f58ca9228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hjelseth=20H=C3=B8yer?= Date: Mon, 21 Sep 2020 07:14:49 +0200 Subject: [PATCH] Log failed to get token (#6) --- custom_components/adax/climate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom_components/adax/climate.py b/custom_components/adax/climate.py index e6dfbe6..1266bbc 100644 --- a/custom_components/adax/climate.py +++ b/custom_components/adax/climate.py @@ -228,6 +228,9 @@ async def _request(self, url, json_data=None, retry=3): "password": self._password, }, ) + if response.status != 200: + _LOGGER.error("Adax: Failed to login to retrieve token: %s %s", response.status, response.reason) + return None token_data = json.loads(await response.text()) self._access_token = token_data.get("access_token") headers = {"Authorization": f"Bearer {self._access_token}"}