From 630bcdd7908fd849c0f66baee26c119bdee96796 Mon Sep 17 00:00:00 2001 From: Erik Kastelec Date: Mon, 8 May 2023 13:25:30 +0200 Subject: [PATCH] Fixed bug in request exception handling #66 --- custom_components/wemportal/manifest.json | 2 +- custom_components/wemportal/wemportalapi.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/wemportal/manifest.json b/custom_components/wemportal/manifest.json index 0b99f43..9bdcb37 100644 --- a/custom_components/wemportal/manifest.json +++ b/custom_components/wemportal/manifest.json @@ -4,7 +4,7 @@ "documentation": "https://github.com/erikkastelec/hass-WEM-Portal", "issue_tracker": "https://github.com/erikkastelec/hass-WEM-Portal/issues", "dependencies": [], - "version": "1.5.6", + "version": "1.5.7", "codeowners": [ "@erikkastelec" ], diff --git a/custom_components/wemportal/wemportalapi.py b/custom_components/wemportal/wemportalapi.py index 550abed..82521f0 100644 --- a/custom_components/wemportal/wemportalapi.py +++ b/custom_components/wemportal/wemportalapi.py @@ -310,7 +310,7 @@ def get_parameters(self): "https://www.wemportal.com/app/EventType/Read", data=data ) except WemPortalError as exc: - if isinstance(exc, reqs.exceptions.HTTPError) and exc.response.status_code == 400: + if isinstance(exc.__cause__, reqs.exceptions.HTTPError) and exc.__cause__.response.status_code == 400: _LOGGER.error("Could not fetch parameters for device %s for index %s and type %s", device_id, values["Index"], values["Type"]) delete_candidates.append((values["Index"], values["Type"])) continue