diff --git a/wideq/client.py b/wideq/client.py index 913adf1..a357628 100644 --- a/wideq/client.py +++ b/wideq/client.py @@ -440,7 +440,7 @@ class Device(object): try: # malformed JSON may contains unwanted [bracket] LOGGER.debug('attempting to fix JSON format') - return json.loads( re.sub(r'^\{(.*?)\}$', r'\1', data)) + return json.loads(re.sub(r'^\{(.*?)\}$', r'\1', data)) except json.decoder.JSONDecodeError: raise core.JsonError(self.device.id, data) diff --git a/wideq/core.py b/wideq/core.py index 81abee3..c204b66 100644 --- a/wideq/core.py +++ b/wideq/core.py @@ -168,6 +168,7 @@ class MonitorError(APIError): self.device_id = device_id self.code = code + class JsonError(APIError): """JSON Decode error The received json value is malformed