diff --git a/custom_components/wemportal/wemportalapi.py b/custom_components/wemportal/wemportalapi.py index a6851fa..dc42228 100644 --- a/custom_components/wemportal/wemportalapi.py +++ b/custom_components/wemportal/wemportalapi.py @@ -243,6 +243,7 @@ def make_api_call( response = self.session.get(url, headers=headers) else: headers["Content-Type"] = "application/json" + data = {k: v.encode('utf-8') if isinstance(v, str) else v for k, v in data.items()} _LOGGER.debug(f"Sending POST request to {url} with headers: {headers} and data: {data}") response = self.session.post( url, headers=headers, data=json.dumps(data) @@ -338,6 +339,8 @@ def change_value( ): """POST request to API to change a specific value""" _LOGGER.debug("Changing value for %s", parameter_id) + # Encode into UTF-8 + parameter_id = parameter_id.encode('utf-8') data = { "DeviceID": device_id, "Modules": [