Skip to content

Error reading logs #29

Description

@jmaja1

Thanks for a very nice api that works well for reading current values. But I haven't been able to read logs. I'm quite new to python, thus I have no idea how to use the api except the example codes with minor modifications. I tried the example log code with just IP number modified:

import asyncio
from vallox_websocket_api import Client

client = Client('192.168.1.213')
async def run():
    data = await client.fetch_raw_logs()

    from pprint import pprint
    pprint(data)
asyncio.get_event_loop().run_until_complete(run())

I got:

root@OpenWrt:/mnt/sda1/Vallox# python v_logs.py 
Traceback (most recent call last):
  File "/mnt/sda1/Vallox/v_logs.py", line 10, in <module>
    asyncio.get_event_loop().run_until_complete(run())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
  File "/mnt/sda1/Vallox/v_logs.py", line 6, in run
    data = await client.fetch_raw_logs()
  File "/mnt/sda1/usr/lib/python3.9/site-packages/vallox_websocket_api/client.py", line 276, in fetch_raw_logs
    result = await self._websocket_request_multiple(payload, read_packets=2)
  File "/mnt/sda1/usr/lib/python3.9/site-packages/vallox_websocket_api/client.py", line 153, in wrapped
    return await request_fn(*args, **kwargs)
  File "/mnt/sda1/usr/lib/python3.9/site-packages/vallox_websocket_api/client.py", line 248, in _websocket_request_multiple
    return await asyncio.gather(*[ws.recv() for _ in range(0, read_packets)])
  File "/mnt/sda1/usr/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 532, in recv
    raise RuntimeError(
RuntimeError: cannot call recv while another coroutine is already waiting for the next message

I have tried this on three different platforms (CygWin, Termux/Android and OpenWRT router) with the latest python3.9 and module versions and also a long time api user got the same result. Should the example code work as is?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions