Unifi-websocket-interface
Unifi-websocket-interface copied to clipboard
Error after initial pull of data in async_websocket
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
I’m using it on a RPi 3+ Python 3.5 aiohttp 3.5.4, and it works fine with a UDMP on 1.10 stable.
Fron the errors though, I suspect a problem with aiohttp, there are several annoying bugs in the latest version.
Try downloading an earlier version of aiohttp, and see if that helps.
Couldn't downgrade on Win10 due to dependancy errors but managed on Ubuntu. Am using Python 3.6.9 and I actioned this with the following:
python3 -m pip install aiohttp==3.5.4 --force-reinstall
Have re-tried and am getting exactly the same error message (excluding code number line changes).
What version of asyncio are you using? is it worth me trying to downgrade this also?