Vacuum component fails after latest update

My irobot keeps loosing connection to hassio after a some time, usually about 20 - 60 minutes.

The log keeps spamming this:

2020-12-06 13:05:29 ERROR (Thread-386) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3452, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1779, in loop_forever
    rc = self.loop(timeout, max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1197, in loop
    rc = self.loop_write(max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1598, in loop_write
    rc = self._packet_write()
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2374, in _packet_write
    self._do_on_disconnect(0)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3360, in _do_on_disconnect
    self.on_disconnect(self, self._userdata, rc)
TypeError: _internal_on_disconnect() missing 1 required positional argument: 'rc'
2020-12-06 13:05:41 ERROR (Thread-387) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3452, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1779, in loop_forever
    rc = self.loop(timeout, max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1197, in loop
    rc = self.loop_write(max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1598, in loop_write
    rc = self._packet_write()
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2374, in _packet_write
    self._do_on_disconnect(0)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3360, in _do_on_disconnect
    self.on_disconnect(self, self._userdata, rc)
TypeError: _internal_on_disconnect() missing 1 required positional argument: 'rc'
2020-12-06 13:05:53 ERROR (Thread-388) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3452, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1779, in loop_forever
    rc = self.loop(timeout, max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1197, in loop
    rc = self.loop_write(max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1598, in loop_write
    rc = self._packet_write()
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2374, in _packet_write
    self._do_on_disconnect(0)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3360, in _do_on_disconnect
    self.on_disconnect(self, self._userdata, rc)
TypeError: _internal_on_disconnect() missing 1 required positional argument: 'rc'
2020-12-06 13:06:03 ERROR (Thread-389) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3452, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1779, in loop_forever
    rc = self.loop(timeout, max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1181, in loop
    rc = self.loop_read(max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1574, in loop_read
    return self._loop_rc_handle(rc)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2227, in _loop_rc_handle
    self._do_on_disconnect(rc, properties)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3360, in _do_on_disconnect
    self.on_disconnect(self, self._userdata, rc)
TypeError: _internal_on_disconnect() missing 1 required positional argument: 'rc'
2020-12-06 13:06:06 ERROR (Thread-9) [roomba.roomba] Error: [Errno 111] Connection refused 
2020-12-06 13:06:06 ERROR (Thread-9) [roomba.roomba] Error: [Errno 111] Connection refused 
2020-12-06 13:06:06 ERROR (Thread-9) [roomba.roomba] Error: [Errno 111] Connection refused 
2020-12-06 13:06:06 ERROR (Thread-9) [roomba.roomba] Unable to connect to 192.168.1.73
2020-12-06 13:06:06 ERROR (Thread-9) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/site-packages/roomba/roomba.py", line 178, in periodic_connection
    if self._connect():
  File "/usr/local/lib/python3.8/site-packages/roomba/roomba.py", line 164, in _connect
    raise RoombaConnectionError("Unable to connect to Roomba at {}".format(self.address))
roomba.roomba.RoombaConnectionError: Unable to connect to Roomba at 192.168.1.73

I have set up a ping monitor to the vacuum IP, it is stable and doesn’t loose connection at all.

If i restart hassio I can start the vacuum through hassio but it looses connectivity again after some time.

If I go into the integration and check or uncheck the “continuous” mode the connection gets established again for a short period.

Could this be related to the latest python update in the core?

The exception is because of the error in roomba/mqttclient.py.
The _internal_on_disconnect has wrong definition.
It should be:

def _internal_on_disconnect(self, client, userdata, rc)

instead of:

def _internal_on_disconnect(self, client, userdata, flags, rc)

Thanks for your answer! But How do I access to the mqttclient.py on a standard rbpi3 installation?

I dont have any mqtt integration installed

I am using the Docker way to run the HA. In my case, the path is:

/usr/local/lib/python3.8/site-packages/roomba/mqttclient.py

Thanks, I’ll see if I can fix it myself then.

Do you know if this issue is reported? Seems like an error with the component

I do not know, I found your post accidentally while searching for the same.
Agree, this is definitely a problem with Roomba integration.

Okay, I’ll report tomorrow. Until then, Let’s just hope your fix won’t get overwritten by future hassio updates :slight_smile:

It definitely will be overwritten by a future update :slight_smile:
Please post the link to the ticket you are going to open, when you open. Thank you!

Here is the ticket my friend: https://github.com/home-assistant/core/issues/44060

1 Like

Im having the same issue. Thanks for posting the ticket.

1 Like

I updated hassio to 2020.12.7 and OS to 5.8 yesterday and it seems to be working better now. At least it finished a cleaning and it shows the battery going up, it never did that before. It always stuck on low battery percentage since it had lost connection during the 1.2h hour cleaning. I had OS 4.8 before that I think.

But now I also disabled “Continuous” in the integration and even in the graphs it seems to update much more often. No staircasegraphs anymore, only smooth diagonal lines when the percentage goes up

Never mind, today it still fails…

seems like this bug can be with us for a while, is there any way to make an automation that disables and reenables “continuous mode” in the roomba-integration?

how do I call that type of change?

I’ll try this out and will do a pull request on the lib and for the component a dependency upgrade pull request.

Nothing is fixed yet on the library

I can’t connect even to the roomba with: roomba-connect
or retrieve password with roomba-password <ip>

  File "/Users/liudger/Git/roombapy/venv/bin/roomba-password", line 8, in <module>
    sys.exit(password())
  File "/Users/liudger/Git/roombapy/venv/lib/python3.7/site-packages/roombapy/entry_points.py", line 31, in password
    found_password = roomba_password.get_password()
  File "/Users/liudger/Git/roombapy/venv/lib/python3.7/site-packages/roombapy/getpassword.py", line 28, in get_password
    self._connect()
  File "/Users/liudger/Git/roombapy/venv/lib/python3.7/site-packages/roombapy/getpassword.py", line 34, in _connect
    self.server_socket.connect((self.roomba_ip, self.roomba_port))
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1172, in connect
    self._real_connect(addr, False)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1159, in _real_connect
    super().connect(addr)
socket.timeout: timed out

any suggestions?

roomba-discovery works fine

Reset the roomba to factory default resolved my issue to connect to the roomba properly. Now I am gonna test the lib

Oh glad that someone is looking at it! Hope you find something out :slight_smile:

I think the issue is with some dependencies. When updating those it looks like it’s working fine.

Well I’m a complete noob when it comes to under the hood, but it sounds like the fix wont be to hard at least.

The mentioned ticket just got closed, saying that the roombapy 1.6.2 update should fix the issue. That should have gone into HA Core version 2020.12. I’m running 2021.1.0 and still having this same problem, I think that the HA github issue should get reopened.