From 3813b796236c6e1fb36f390047bca15726fd170d Mon Sep 17 00:00:00 2001 From: linuswck Date: Thu, 13 Jun 2024 16:25:52 +0800 Subject: [PATCH] driver: Fix IP Settings not being able to update --- pykirdy/driver/kirdy_async.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pykirdy/driver/kirdy_async.py b/pykirdy/driver/kirdy_async.py index 6260685..fa0d859 100644 --- a/pykirdy/driver/kirdy_async.py +++ b/pykirdy/driver/kirdy_async.py @@ -117,10 +117,10 @@ class Device: { "device_cmd": "SetIPSettings", "ip_settings": { - "addr": addr, + "addr": [int(x) for x in addr], "port": port, "prefix_len": prefix_len, - "gateway": gateway, + "gateway": [int(x) for x in gateway], } } ) @@ -659,6 +659,8 @@ class Kirdy: raw_response = await asyncio.wait_for(self._reader.read(buffer_size), self.timeout) response = raw_response.decode('utf-8', errors='ignore').split("\n") + print() + print(response) for item in reversed(response): try: return json.loads(item) @@ -732,9 +734,11 @@ class Kirdy: self._writer.write(bytes(json.dumps(cmd_dict), "UTF-8")) await self._writer.drain() response = await self._read_response() + print(f'retry attempts: {retry} msg_type: {msg_type}') if response["msg_type"] == msg_type: return response retry += 1 + await asyncio.sleep(0.1) except asyncio.exceptions.CancelledError: return None