diff --git a/ewelink/ws.py b/ewelink/ws.py index 64bcd3d..66768b3 100644 --- a/ewelink/ws.py +++ b/ewelink/ws.py @@ -1,4 +1,4 @@ -import aiohttp, time, random, asyncio +import aiohttp, time, random, asyncio, json from typing import AnyStr, TypedDict @@ -84,7 +84,10 @@ async def update_device_status(self, deviceid: str, **kwargs: list[dict[str, Any async def poll_event(self): while True: - msg: dict[str, dict[str, bool | AnyStr] | AnyStr] = await self.ws.receive_json() + received = await self.ws.receive_str() + if received == 'pong': + continue + msg: dict[str, dict[str, bool | AnyStr] | AnyStr] = json.loads(received) if action := msg.get('action', None): match action: case "sysmsg":