From abc2b67acddcd9578319087d4eda8843c07132f3 Mon Sep 17 00:00:00 2001 From: Simon Berger Date: Mon, 18 Sep 2023 20:17:00 +0000 Subject: [PATCH] treat empty response as null --- custom_components/vzug/api/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/custom_components/vzug/api/__init__.py b/custom_components/vzug/api/__init__.py index ef4e2ca..f05ef1f 100644 --- a/custom_components/vzug/api/__init__.py +++ b/custom_components/vzug/api/__init__.py @@ -302,8 +302,11 @@ async def once() -> Any: try: data = resp.json() except ValueError: - _LOGGER.debug("invalid json payload: %s", resp.text) - raise + if resp.content: + _LOGGER.debug("invalid json payload: %s", resp.content) + raise + # we got an empty response, we just treat this as 'None' + data = None _LOGGER.debug("data: %s", data) if expected_type is list and data is None: