diff --git a/src/mcbluetooth_esp32/protocol.py b/src/mcbluetooth_esp32/protocol.py index 1e911d2..f51deb1 100644 --- a/src/mcbluetooth_esp32/protocol.py +++ b/src/mcbluetooth_esp32/protocol.py @@ -207,11 +207,14 @@ def parse_message(line: str) -> Command | Response | Event: ) if msg_type == MsgType.RESP: + raw_data = obj.get("data", {}) + if isinstance(raw_data, str): + raw_data = {"error": raw_data} return Response( type=MsgType.RESP, id=obj["id"], status=Status(obj["status"]), - data=obj.get("data", {}), + data=raw_data if isinstance(raw_data, dict) else {}, ) if msg_type == MsgType.EVENT: