diff --git a/aioshelly/coap.py b/aioshelly/coap.py index 484fdb94..9ac11bf6 100644 --- a/aioshelly/coap.py +++ b/aioshelly/coap.py @@ -38,7 +38,7 @@ def __init__(self, sender_addr: Tuple[str, int], payload: bytes) -> None: try: self.payload = json.loads(payload.rsplit(b"\xff", 1)[1].decode()) - except (json.decoder.JSONDecodeError, IndexError) as err: + except (json.decoder.JSONDecodeError, UnicodeDecodeError, IndexError) as err: raise InvalidMessage( f"Message type {self.code} is not a valid JSON format: {str(payload)}" ) from err