Roomba is unavailable except while cleaning

I have a roomba that I’ve been using for half a year now. It used to be that I needed to restart home assistant in order for the roomba to connect properly, but I just scheduled a home assistant restart for 10m before I wanted my roomba to start cleaning. With the past few months of updates, I am still not able to connect to the roomba after a home assistant restart.

Usually, the Roomba is marked as “Unavailable” in homeassistant and all commands fail. However, if I manually start a cleaning by pressing the physical CLEAN button on the roomba, it will become available in HomeAssistant and I can see status, send it commands, etc.

I don’t use the app, and it does work while cleaning.

I turned on debug logging for the roomba but I don’t see any connection commands in my log, just failures.

2021-05-16 18:02:15 ERROR (roombapy) [roombapy.remote_client] Can't connect to 192.168.1.143, error: [Errno 111] Connection refused
2021-05-16 18:02:21 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Roomba' for roomba integration not ready yet; Retrying in background
2021-05-16 18:02:22 ERROR (roombapy) [roombapy.remote_client] Can't connect to 192.168.1.143, error: [Errno 111] Connection refused
2021-05-16 18:02:22 ERROR (roombapy) [roombapy.remote_client] Can't connect to 192.168.1.143, error: [Errno 111] Connection refused
2021-05-16 18:02:22 ERROR (roombapy) [roombapy.remote_client] Can't connect to 192.168.1.143, error: [Errno 111] Connection refused
2021-05-16 18:02:22 ERROR (roombapy) [roombapy.remote_client] Unable to connect to 192.168.1.143
2021-05-16 18:02:22 WARNING (roombapy) [roombapy.roomba] Unexpectedly disconnected from Roomba 192.168.1.143, code Unable to connect to Roomba at 192.168.1.143
2021-05-16 18:10:10 ERROR (roombapy) [roombapy.remote_client] Can't connect to 192.168.1.143, error: [Errno 111] Connection refused
2021-05-16 18:20:36 ERROR (roombapy) [roombapy.remote_client] Can't connect to 192.168.1.143, error: [Errno 111] Connection refused
2021-05-16 18:37:25 ERROR (roombapy) [roombapy.remote_client] Can't connect to 192.168.1.143, error: [Errno 111] Connection refused
2021-05-16 18:37:31 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Roomba' for roomba integration not ready yet; Retrying in background
2021-05-16 18:43:54 ERROR (roombapy) [roombapy.remote_client] Can't connect to 192.168.1.143, error: [Errno 111] Connection refused
2021-05-16 18:55:55 ERROR (roombapy) [roombapy.remote_client] Can't connect to 192.168.1.143, error: [Errno 111] Connection refused
2021-05-16 18:58:43 ERROR (MainThread) [homeassistant.components.script.start_roomba] Start roomba: Repeat at step 1: Error executing script. Service not found for device at pos 1: Unable to find service vacuum.start
2021-05-16 18:58:43 ERROR (MainThread) [homeassistant.components.script.start_roomba] Start roomba: Error executing script. Service not found for repeat at pos 1: Unable to find service vacuum.start
2021-05-16 18:58:43 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 404, in _async_run
return await self.script.async_run(variables, context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1212, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 348, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 366, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/trace.py", line 249, in async_wrapper
await func(*args)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 692, in _async_repeat_step
await async_run_sequence(iteration, extra_msg)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 674, in async_run_sequence
await self._async_run_script(script)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 820, in _async_run_script
await self._async_run_long_action(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 530, in _async_run_long_action
long_task.result()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1212, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 348, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 366, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 577, in _async_device_step
await platform.async_call_action_from_config(
File "/usr/src/homeassistant/homeassistant/components/vacuum/device_action.py", line 72, in async_call_action_from_config
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1428, in async_call
raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Unable to find service vacuum.start

More roomba debug logs. It seems like roombapy initially connects to the roomba and gets its status, but then gets a Connection Refused and changes the state to unavailable:
https://paste.ubuntu.com/p/pzWkQzTmBV/

@hyperbole Any chance you’ve managed to solve this? I’m getting the exact same behavior. On initial setup everything looks fine, then no updates at all, and whenever I press reconfigure (doesn’t matter if I’m using continuous or not) the state updates again, but never after that…

Difference between you and me is for me it doesn’t say “unavailable”, it just doesn’t update anything…

Logger: roombapy.roomba
Source: /usr/local/lib/python3.9/site-packages/roombapy/roomba.py:166
First occurred: 4:16:49 PM (1 occurrences)
Last logged: 4:16:49 PM

Unexpectedly disconnected from Roomba 192.168.1.161, code Unable to connect to Roomba at 192.168.1.161

Sorry, I gave up on using the roomba integration and am using the terrible scheduling builtin to the roomba. I really ought to give it another try :frowning:

i also need to reload the intergration from time to time, Roomba doesn’t respond/ looses connection.
so I tried the following by keeping the connection up by ping.

  - platform: ping
    host: xxx.168.1.xxx
    name: "roomba boven"
    count: 2
    scan_interval: 120  

Thanks for this. I shall try also. Same issue - randomly unavailable and requires reload/reboot to work.

Ping doesn’t seem to work for me. I have the following in my config:

binary_sensor:
   - platform: ping
     host: 192.168.0.161
     count: 3
     scan_interval: 30

Which then shows as ‘connected’. However I lose the ability to control my roomba within an hour or two.
I can see the following in the logs:

2021-12-09 13:40:56 DEBUG (Thread-4) [homeassistant.components.roomba.irobot_base] Got new state from the vacuum: {'state': OrderedDict([('reported', OrderedDict([('cleanMissionStatus', OrderedDict([('cycle', 'none'), ('phase', 'hmUsrDock'), ('expireM', 0), ('rechrgM', 0), ('error', 0), ('notReady', 0), ('mssnM', 0), ('mssnStrtTm', 0), ('expireTm', 0), ('rechrgTm', 0), ('sqft', 0), ('initiator', 'localApp'), ('nMssn', 780)]))]))])}
2021-12-09 13:40:57 ERROR (Thread-4) [root] Uncaught thread exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.9/threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3591, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1756, in loop_forever
    rc = self._loop(timeout)
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1164, in _loop
    rc = self.loop_read()
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 1558, in loop_read
    return self._loop_rc_handle(rc)
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 2350, in _loop_rc_handle
    self._do_on_disconnect(rc, properties)
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3475, in _do_on_disconnect
    on_disconnect(self, self._userdata, rc)
  File "/usr/local/lib/python3.9/site-packages/roombapy/remote_client.py", line 121, in _internal_on_disconnect
    connection_error = MQTT_ERROR_MESSAGES[rc]
KeyError: 7

Seems python or mqtt related, but beyond my knowledge! Any ideas?

Matt

I have the same (or very similar) problem
integration only rarely works, most of the time the device is disconnected
it is not a wifi coverage problem, the app on the phone connects to the robot regularly

Unable to connect to 192.168.1.142
9:36:10 AM – (ERROR) /usr/local/lib/python3.9/site-packages/roombapy/remote_client.py - message first occurred at February 2, 2022, 9:07:19 AM and shows up 989 times

Can't connect to 192.168.1.142, error: [Errno 113] Host is unreachable
9:36:10 AM – (ERROR) /usr/local/lib/python3.9/site-packages/roombapy/remote_client.py - message first occurred at February 2, 2022, 9:07:13 AM and shows up 2967 times

maybe I should put the static IP at the router level?
maybe the app and the integration are competing for the ability to connect?

do any of you use other integrations, even unofficial?
I saw this reported: https://github.com/koalazak/dorita980
which seems interesting to me also because it seems to me that it can shoot locally