synesthesiam / homeassistant-satellite

Streaming audio satellite for Home Assistant
MIT License
188 stars 23 forks source link

aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected #41

Open jclsn opened 1 year ago

jclsn commented 1 year ago

Getting the following error

ERROR:__main__:Unexpected error
Traceback (most recent call last):
  File "/home/jan/homeassistant-satellite/homeassistant_satellite/__main__.py", line 246, in main
    async for _timestamp, event_type, event_data in stream(
  File "/home/jan/homeassistant-satellite/homeassistant_satellite/remote.py", line 28, in stream
    async with session.ws_connect(url) as websocket:
  File "/home/jan/homeassistant-satellite/.venv/lib/python3.9/site-packages/aiohttp/client.py", line 1141, in __aenter__
    self._resp = await self._coro
  File "/home/jan/homeassistant-satellite/.venv/lib/python3.9/site-packages/aiohttp/client.py", line 779, in _ws_connect
    resp = await self.request(
  File "/home/jan/homeassistant-satellite/.venv/lib/python3.9/site-packages/aiohttp/client.py", line 560, in _request
    await resp.start(conn)
  File "/home/jan/homeassistant-satellite/.venv/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 899, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
  File "/home/jan/homeassistant-satellite/.venv/lib/python3.9/site-packages/aiohttp/streams.py", line 616, in read
    await self._waiter
aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected

The IP and token are definitely correct. Any ideas?

DotBowder commented 1 year ago

I found when I only provided script/run --host <IP> --token <TOKEN>, I got the same error message. For me, the issue was that I didn't read the full README file.

My server has https certificates in front of it, so (per the README) I needed to add --protocol https. Furthermore, because the https cert is validated against the hostname, the --host <IP> had to be updated to be a <HOSTNAME> instead of an IP address. After these two additions, I got passed this error message.

The final command for me was:

script/run --protocol https --host <HOSTNAME> --token <TOKEN>