From c5692d5317703eefc49b53134376b654c4a5eb5c Mon Sep 17 00:00:00 2001 From: Tuen Lee Date: Thu, 24 Aug 2023 18:01:07 +0200 Subject: [PATCH] fix POST response --- custom_components/alfen_wallbox/alfen.py | 6 +++--- custom_components/alfen_wallbox/select.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/alfen_wallbox/alfen.py b/custom_components/alfen_wallbox/alfen.py index 354ee12..4e368da 100644 --- a/custom_components/alfen_wallbox/alfen.py +++ b/custom_components/alfen_wallbox/alfen.py @@ -140,8 +140,8 @@ def _post(self, cmd, payload=None, allowed_login=True): self.login() return self._post(cmd, payload, False) response.raise_for_status() - if len(response.text) > 0: - return response.json() + if response: + return response def _get(self, url, allowed_login=True): response = self._session.get(url, timeout=5) @@ -169,7 +169,7 @@ def logout(self): def _update_value(self, api_param, value): response = self._post(cmd=PROP, payload={api_param: { - ID: api_param, VALUE: value}}) + ID: api_param, VALUE: str(value)}}) _LOGGER.debug(f"Set {api_param} value {value} response {response}") def _get_value(self, api_param): diff --git a/custom_components/alfen_wallbox/select.py b/custom_components/alfen_wallbox/select.py index d917ae6..3c4efa6 100644 --- a/custom_components/alfen_wallbox/select.py +++ b/custom_components/alfen_wallbox/select.py @@ -301,6 +301,7 @@ class AlfenSelect(AlfenEntity, SelectEntity): """Define Alfen select.""" values_dict: dict[int, str] + entity_description: AlfenSelectDescription def __init__( self, device: AlfenDevice, description: AlfenSelectDescription