Skip to content

Error after initial pull of data in async_websocket #4

@gitothy

Description

@gitothy

Thanks for the work here, has been invaluable in helping my understanding and with other projects.

Got a small issue to report. Am seeing an error after each fetch from the ws. It looks like the script connects, pulls it's first lot of data OK, then looses connection connection, waits for a timeout then reconnects and pulls again, then disconnects, in a loop.

Connecting to a UDMP on the latest beta firmware 1.11.0-14 and python 3.9.4 with hopefully all required dependencies installed and up to date. Have tried connecting from both a Windows and Linux host, both seeing the same issue. Server has a valid SSL certificate and using the script with the IP or FQDN doesn't change things. Command used:

./unifi_client.py unifi.mydomain.com username password -po 443 -D

Error after the first pull of data is returned on Win 10:

"isSuperAdmin": true,
  "deviceToken": "eyJhbGciOiJIUz<manually removed!>"
}
unknown exception:
Traceback (most recent call last):
  File "E:\Dropbox\My Documents\Home Network\Unifi\Unifi-websocket-interface\unifi_client_3.py", line 125, in async_websocket
    async with session.get(
  File "C:\Program Files\Python39\lib\site-packages\aiohttp\client.py", line 1117, in __aenter__
    self._resp = await self._coro
  File "C:\Program Files\Python39\lib\site-packages\aiohttp\client.py", line 544, in _request
    await resp.start(conn)
  File "C:\Program Files\Python39\lib\site-packages\aiohttp\client_reqrep.py", line 905, in start
    self._continue = None
  File "C:\Program Files\Python39\lib\site-packages\aiohttp\helpers.py", line 656, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
Exited

The error on Ubuntu is the same but gives slightly different info:

"isSuperAdmin": true,
  "deviceToken": "eyJhbGciOiJIUz<removed>"
}
unknown exception: 
Traceback (most recent call last):
  File "/home/f120hanson/Documents/Unifi-websocket-interface/unifi_client_3.py", line 126, in async_websocket
    self.initial_info_url,json=self.params, ssl=self.ssl_verify, timeout=self.timeout) as response:
  File "/home/f120hanson/.local/lib/python3.6/site-packages/aiohttp/client.py", line 1117, in __aenter__
    self._resp = await self._coro
  File "/home/f120hanson/.local/lib/python3.6/site-packages/aiohttp/client.py", line 544, in _request
    await resp.start(conn)
  File "/home/f120hanson/.local/lib/python3.6/site-packages/aiohttp/client_reqrep.py", line 905, in start
    self._continue = None
  File "/home/f120hanson/.local/lib/python3.6/site-packages/aiohttp/helpers.py", line 656, in __exit__
    raise asyncio.TimeoutError from None
concurrent.futures._base.TimeoutError
Exited

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