Open Orhideous opened 6 months ago
Another data point for this: I am affected with a Roomba 960. I cannot pair it in Home Assistant, where I get errors like
ERROR (roombapy) [roombapy.remote_client] Can't connect to 10.17.40.21
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/roombapy/remote_client.py", line 93, in connect
self._open_mqtt_connection()
File "/usr/local/lib/python3.12/site-packages/roombapy/remote_client.py", line 121, in _open_mqtt_connection
self.mqtt_client.reconnect()
File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 1044, in reconnect
sock = self._create_socket_connection()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/paho/mqtt/client.py", line 3685, in _create_socket_connection
return socket.create_connection(addr, timeout=self._connect_timeout, source_address=source)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/socket.py", line 852, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.12/socket.py", line 837, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
ERROR (roombapy) [roombapy.remote_client] Unable to connect to 10.17.40.21
WARNING (roombapy) [roombapy.roomba] Unexpectedly disconnected from Roomba 10.17.40.21, code The connection was lost
WARNING (roombapy) [roombapy.roomba] Periodic connection lost due to Unable to connect to Roomba at 10.17.40.21
which are similar/the same as in the linked issues.
When connecting directly via roombapy discover 10.17.40.21
or roombapy connect 10.17.40.21 -p XXXX
I get in ~50% of the cases a TimeoutError: _ssl.c:975: The handshake operation timed out
.
Increasing the timeout in getpassword.py
via changing server_socket.settimeout(3)
to server_socket.settimeout(30)
allows me to connect each time in roombapy without problems. I can ping the Roomba usually with <10ms, but seldom I see spikes to 2000–3000ms. Maybe the Roomba's Wifi goes to sleep?
I used roombapy 1.8.1 installed via pip for the latter testing. As I'm running Home Assistant via Docker I cannot really test other values there.
My comment above seems to be handled in #310 and #311 for getpassword.py
. Similar work might be required for the remote client used e.g. in Home Assistant.
There are cases where missed packets and timeouts cause robot discovery to fail. We need to improve logging and write some integration tests for the most common problems.
See: https://github.com/home-assistant/core/issues/111634 See: https://github.com/home-assistant/core/issues/111599