diff --git a/src/meshctrl/session.py b/src/meshctrl/session.py index 52d2a51..46b9568 100644 --- a/src/meshctrl/session.py +++ b/src/meshctrl/session.py @@ -479,6 +479,16 @@ class Session(object): raise exceptions.ServerError(res0["result"]) if details: nodes = json.loads(res0["data"]) + try: + raw_data = res0["data"] + if isinstance(raw_data, str): + nodes = json.loads(raw_data) + else: + nodes = raw_data + except Exception as e: + print(f"Failed to parse device data: {e}") + return + for node in nodes: if node["node"].get("meshid", None): node["node"]["mesh"] = mesh.Mesh(node["node"].get("meshid"), self) @@ -1969,4 +1979,4 @@ class _FileExplorerWrapper: return await self._files.__aenter__() async def __aexit__(self, exc_t, exc_v, exc_tb): - return await self._files.__aexit__(exc_t, exc_v, exc_tb) \ No newline at end of file + return await self._files.__aexit__(exc_t, exc_v, exc_tb)