synesthesiam/homeassistant-satellite

Server disconnect loop

Closed this issue · 5 comments

Hey there, thanks for your hard work. This is the last piece of the puzzle for me automated house.

I'm getting the following looping, it connects to HA but then immediately disconnects...any ideas?

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

Hey, sorted it. My server is SSL so had to point the satellite at the hostname, not the IP.

Same issue here without SSL. I have tried IP and hostname and the https proxy server name with --protocol https. Always the same error

Have you tried also specifying the port with --port? I believe it defaults to 8123; for one of my tests with a device on a different VLAN I changed the host to the FQDN, made --protocol to https and then had to also do --port 443 to get it to connect.

@vhsdream No, but I tried printing the url in the script

ws://homeassistant:8123/api/websocket

which seems to look fine.

Port 443 is https. I can connect fine to Home Assistant using http. I think that the my HA installation has an issue. It is also displays a weird hostname since the last update. Like a7f8s7f9a9sf9a98-hap or something. Unfortunately I don't have experience with websockets.

Got it working. Turns out my Homeassistant wasn't available via http. I was wrong about that.