home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
70.46k stars 29.39k forks source link

Roomba 960 not able to connect #69594

Closed dmyoung9 closed 1 year ago

dmyoung9 commented 2 years ago

The problem

I've had my Roomba 960 set up for about 18 months now, and it has been unable to connect for a while now.

I'm not sure what version actually broke it (or it could have even been an update to the Roomba itself 😬), but I noticed an error when updating to 2022.4.0 this morning. I've attached it down below.

I also attempted to simply reload the integration, and I see two errors... I've attached them down below as well.

My Roomba is definitely on the network (can ping from terminal), so I'm not sure why it wouldn't be able to connect 🤔

What version of Home Assistant Core has the issue?

2022.4.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Roomba

Link to integration documentation on our website

https://www.home-assistant.io/integrations/roomba

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2022-04-07 07:24:25 ERROR (Thread-16) [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 1556, in loop_read
    rc = self._packet_read()
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 2439, in _packet_read
    rc = self._packet_handle()
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3033, in _packet_handle
    return self._handle_publish()
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3327, in _handle_publish
    self._handle_on_message(message)
  File "/usr/local/lib/python3.9/site-packages/paho/mqtt/client.py", line 3570, in _handle_on_message
    on_message(self, self._userdata, message)
  File "/usr/local/lib/python3.9/site-packages/roombapy/roomba.py", line 188, in on_message
    log_string, json_data = self.decode_payload(msg.topic, msg.payload)
  File "/usr/local/lib/python3.9/site-packages/roombapy/roomba.py", line 296, in decode_payload
    return formatted_data, dict(json_data)
TypeError: 'NoneType' object is not iterable
2022-04-07 07:24:40 ERROR (SyncWorker_10) [roombapy.remote_client] Can't connect to 192.168.1.192, error: _ssl.c:1112: The handshake operation timed out
2022-04-07 07:24:40 ERROR (SyncWorker_0) [roombapy.remote_client] Can't connect to 192.168.1.192, error: [Errno 111] Connection refused
2022-04-07 07:24:40 ERROR (SyncWorker_0) [roombapy.remote_client] Can't connect to 192.168.1.192, error: [Errno 111] Connection refused
2022-04-07 07:24:40 ERROR (SyncWorker_0) [roombapy.remote_client] Can't connect to 192.168.1.192, error: [Errno 111] Connection refused
2022-04-07 07:24:40 ERROR (SyncWorker_0) [roombapy.remote_client] Unable to connect to 192.168.1.192
2022-04-07 07:25:00 ERROR (SyncWorker_1) [roombapy.remote_client] Can't connect to 192.168.1.192, error: [Errno 111] Connection refused
2022-04-07 07:25:00 ERROR (SyncWorker_1) [roombapy.remote_client] Can't connect to 192.168.1.192, error: [Errno 111] Connection refused
2022-04-07 07:25:01 ERROR (SyncWorker_1) [roombapy.remote_client] Can't connect to 192.168.1.192, error: [Errno 111] Connection refused
2022-04-07 07:25:01 ERROR (SyncWorker_1) [roombapy.remote_client] Unable to connect to 192.168.1.192

Additional information

No response

probot-home-assistant[bot] commented 2 years ago

Hey there @pschmitt, @cyr-ius, @shenxn, mind taking a look at this issue as it has been labeled with an integration (roomba) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


roomba documentation roomba source (message by IssueLinks)

dmyoung9 commented 2 years ago

On second look, it doesn't seem this is an issue with the firmware on the Roomba, as it hasn't been updated since 4/29/2021 (2.4.16-126).

stehliner commented 2 years ago

I had the same issue after updating to 2022.4. Fixed it by going into the iRobot Android app and restarting the iRobot via the settings menu.

dmyoung9 commented 2 years ago

Interesting... I'll give that a try this evening.

FabHomeAssistant commented 2 years ago

Same for me.

dmyoung9 commented 2 years ago

It does seem like rebooting the robot from the app helped (integration set up successfully), but connection must be getting dropped somewhere along the way, because it also seems like I have to reload the integration before starting the vacuum, or it won't run.

mhadjimichael commented 2 years ago

Similar issue here... It has been working for over a year. It wouldn't connect and I figured I'd re-add to fix.

Removing the integration made it very challenging to re-add.

Was able to re-add by: 1) Used the iRobot account credentials with https://github.com/koalazak/dorita980#how-to-get-your-usernameblid-and-password to get the password 2) Reboot robot through iRobot app 3) Add integration -> roomba -> choose the robot 4) Failed to get password -- entered the password that was found in step 1. 5) Works again.

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

no1warr1or commented 2 years ago

Any updates on this? I've been experiencing this for quite some time as well. My logs are filled with "connection refused" even though it was working and nothing has changed

pvince commented 2 years ago

I also have a 960 and cannot get the integration to setup.

The scan finds both my 960's on my network, and the dorito980 script downloads the BLID // password, however when I enter the password in the UI I just get a generic 'failed to connect' message.

I have tried restarting the roomba via the app and that didn't help.

HomeAssistant Info:

Home Assistant 2022.8.3 
Supervisor 2022.08.3 
Operating System 8.4 
Frontend 20220802.0 - latest

Errors in the logs are super generic: 2022-08-12 10:56:22.073 ERROR (roombapy) [roombapy.remote_client] Can't connect to 192.168.1.29, error: [Errno 111] Connection refused

Roomba info:

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Bovive commented 1 year ago

This is still a problem for me. Cannot add the Rooma. Manually retrieved my password via dorita980. Says failed to connect. A few different errors in the logs:

Logger: roombapy.roomba
Source: /homeassistant/lib/python3.10/site-packages/roombapy/roomba.py:166
First occurred: 11:31:14 AM (2 occurrences)
Last logged: 11:33:11 AM

Unexpectedly disconnected from Roomba 192.168.0.114, code Unable to connect to Roomba at 192.168.0.114
Logger: roombapy.remote_client
Source: /homeassistant/lib/python3.10/site-packages/roombapy/remote_client.py:58
First occurred: 11:35:31 AM (3 occurrences)
Last logged: 11:35:31 AM

Can't connect to 192.168.0.114, error: [SSL: UNSAFE_LEGACY_RENEGOTIATION_DISABLED] unsafe legacy renegotiation disabled (_ssl.c:997)
Can't connect to 192.168.0.114, error: [Errno 111] Connection refused
ArnoGit commented 1 year ago

Update: I added some more details after I saw ferdyvi's comment below in the hope that helps.

This issue thread is a bit convoluted (Can't connect Roomba and Roomba no longer connects after update). I am reporting on the latter: I have today updated from 2023.1.4 to 2023.2.1 and lost the Roomba connection. As pointed out in the thread higher up, restarting the Roomba and retry of the integration brought everything back. Maybe there should be some update the docs to that extend (Known workaround to resolve if you have lost the connection after a HA update). Happy to give it a shot via PR if that is helpful, pls let me know. to make this more detailed what I have on my side:

  1. open the phone (Android in my case) app, select the device and then -> "Product Settings" -> "Reboot " -> "Reboot "
  2. Wait for it to come back (check in phone app when it has status "connected")
  3. Go to HA "Settings" -> "Devices & Services" -> select the "iRobot Roomba and Braava" integration
  4. Select "configure" on the integration tile and make sure "Continuous" is selected; delay in my case is set to 1
  5. Select the hamburger menu -> "System Options" and make sure "enable newly added entities" is enabled
  6. I then had a option to reload or reconfigure the integration (as it is working now I can't describe it in detail, sorry)
  7. After that, the 3 entities for the Roomba came back and it worked

Something else to note (not sure it matters): I still have a config for the Roomba in the configuration.yml which looks like the below. The Roomba is on a fixed IP in my network to avoid any confusion across updates, new installs etc.

#Roomba
roomba:
  - host: !secret roomba_ip
    blid: !secret roomba_user
    password: !secret roomba_password
    continuous: True    #needs to be true (default) as the vacuum otherwise won't start on commands 
ferdyvi commented 1 year ago

This issue thread is a bit convoluted (Can't connect Roomba and Roomba no longer connects after update). I am reporting on the latter: I have today updated from 2023.1.4 to 2023.2.1 and lost the Roomba connection. As pointed out in the thread higher up, restarting the Roomba and retry of the integration brought everything back. Maybe there should be some update the docs to that extend (Known workaround to resolve if you have lost the connection after a HA update). Happy to give it a shot via PR if that is helpful, pls let me know.

I have the same problem with the same roomba, and I'm not able to make it work again

ferdyvi commented 1 year ago

Update: I added some more details after I saw ferdyvi's comment below in the hope that helps.

This issue thread is a bit convoluted (Can't connect Roomba and Roomba no longer connects after update). I am reporting on the latter: I have today updated from 2023.1.4 to 2023.2.1 and lost the Roomba connection. As pointed out in the thread higher up, restarting the Roomba and retry of the integration brought everything back. Maybe there should be some update the docs to that extend (Known workaround to resolve if you have lost the connection after a HA update). Happy to give it a shot via PR if that is helpful, pls let me know. to make this more detailed what I have on my side:

1. open the phone (Android in my case) app, select the device and then
   -> "Product Settings" -> "Reboot " -> "Reboot "

2. Wait for it to come back (check in phone app when it has status "connected")

3. Go to HA "Settings" -> "Devices & Services" -> select the "iRobot Roomba and Braava" integration

4. Select "configure" on the integration tile and make sure "Continuous" is selected; delay in my case is set to 1

5. Select the hamburger menu -> "System Options" and make sure "enable newly added entities" is enabled

6. I then had a option to reload or reconfigure the integration (as it is working now I can't describe it in detail, sorry)

7. After that, the 3 entities for the Roomba came back and it worked

Something else to note (not sure it matters): I still have a config for the Roomba in the configuration.yml which looks like the below. The Roomba is on a fixed IP in my network to avoid any confusion across updates, new installs etc.

#Roomba
roomba:
  - host: !secret roomba_ip
    blid: !secret roomba_user
    password: !secret roomba_password
    continuous: True    #needs to be true (default) as the vacuum otherwise won't start on commands 

Thank you for your feedback. I've tried your step, but my robot, roomba 960, still refuses to connect to the integration. The error is still this one as reported before https://github.com/home-assistant/core/issues/69594#issuecomment-1374887921

ferdyvi commented 1 year ago

An other issue open here https://github.com/home-assistant/core/issues/82775

zelbanna commented 1 year ago

Had similar issue (running laterst version - as of today - of HA in a docker container)

Trying to add the Roomba 980 continously failed with lots of: 2023-02-09 17:44:48.165 ERROR (roombapy) [roombapy.remote_client] Can't connect to 10.0.121.104, error: [Errno 111] Connection refused

In the end I did the password retrieval from the cloud: https://github.com/koalazak/dorita980

Downloaded the files from https://github.com/NickWaterton/Roomba980-Python and connected directly to the Roomba using BLID, password and host ip without problem (so pointing at HA integration as the culprit)

After enabling debugging of the component roombapy in the logger I found that HA could actually connect but somehow tried multiple parallell connections / which obviously failed since the MQTT server in the 980 only could handle one. This screwed up the entire addition of the integration

I added some debug code to verify that the same roomba python object was reused and then a quick fix was to check in the code if we already has a connection and returned True from the connection function immediately (setting 'is_connected' to True/False in the internal_connect and disconnect functions passed to mqtt client):

/usr/local/lib/python3.10/site-packages/roombapy/remote_client.py

--- remote_client.py.old
+++ remote_client.py
@@ -15,8 +15,10 @@
     password = None
     log = None
     was_connected = False
+    is_connected = False
     on_connect = None
     on_disconnect = None
+    mqtt_client = None

     def __init__(self, address, blid, password, port=8883):
         """Create mqtt client."""
@@ -43,6 +45,9 @@
         self.on_disconnect = on_disconnect

     def connect(self):
+        if self.is_connected:
+            self.log.info("Already connected to %s", self.address)
+            return True
         attempt = 1
         while attempt <= MAX_CONNECTION_RETRIES:
             self.log.info(
@@ -111,6 +116,8 @@
             "Connected to Roomba %s, response code = %s", self.address, rc
         )
         connection_error = MQTT_ERROR_MESSAGES.get(rc)
+        if rc == 0:
+            self.is_connected = True
         # If response code(rc) is 0 then connection was succesfull.
         if rc != 0 and connection_error is None:
             self.log.warning(
@@ -125,6 +132,8 @@
         self.log.debug(
             "Disconnected from Roomba %s, response code = %s", self.address, rc
         )
+        if rc == 0:
+            self.is_connected = False
         connection_error = MQTT_ERROR_MESSAGES.get(rc)
         # If response code(rc) is 0 then connection was succesfull.
         if rc != 0 and connection_error is None:
ferdyvi commented 1 year ago

Had similar issue (running laterst version - as of today - of HA in a docker container)

Trying to add the Roomba 980 continously failed with lots of: 2023-02-09 17:44:48.165 ERROR (roombapy) [roombapy.remote_client] Can't connect to 10.0.121.104, error: [Errno 111] Connection refused

In the end I did the password retrieval from the cloud: https://github.com/koalazak/dorita980

Downloaded the files from https://github.com/NickWaterton/Roomba980-Python and connected directly to the Roomba using BLID, password and host ip without problem (so pointing at HA integration as the culprit)

After enabling debugging of the component roombapy in the logger I found that HA could actually connect but somehow tried multiple parallell connections / which obviously failed since the MQTT server in the 980 only could handle one. This screwed up the entire addition of the integration

I added some debug code to verify that the same roomba python object was reused and then a quick fix was to check in the code if we already has a connection and returned True from the connection function immediately (setting 'is_connected' to True/False in the internal_connect and disconnect functions passed to mqtt client):

/usr/local/lib/python3.10/site-packages/roombapy/remote_client.py

--- remote_client.py.old
+++ remote_client.py
@@ -15,8 +15,10 @@
     password = None
     log = None
     was_connected = False
+    is_connected = False
     on_connect = None
     on_disconnect = None
+    mqtt_client = None

     def __init__(self, address, blid, password, port=8883):
         """Create mqtt client."""
@@ -43,6 +45,9 @@
         self.on_disconnect = on_disconnect

     def connect(self):
+        if self.is_connected:
+            self.log.info("Already connected to %s", self.address)
+            return True
         attempt = 1
         while attempt <= MAX_CONNECTION_RETRIES:
             self.log.info(
@@ -111,6 +116,8 @@
             "Connected to Roomba %s, response code = %s", self.address, rc
         )
         connection_error = MQTT_ERROR_MESSAGES.get(rc)
+        if rc == 0:
+            self.is_connected = True
         # If response code(rc) is 0 then connection was succesfull.
         if rc != 0 and connection_error is None:
             self.log.warning(
@@ -125,6 +132,8 @@
         self.log.debug(
             "Disconnected from Roomba %s, response code = %s", self.address, rc
         )
+        if rc == 0:
+            self.is_connected = False
         connection_error = MQTT_ERROR_MESSAGES.get(rc)
         # If response code(rc) is 0 then connection was succesfull.
         if rc != 0 and connection_error is None:

Thank you so much!

typeofweb commented 1 year ago

I confirm this is still a problem but the above ^ diff fixes it.

@zelbanna have you thought of opening a PR to the core?

Edit: I don't have a 960 – I have j7+

no1warr1or commented 1 year ago

I just wanted to note that I've had no issues with my 960. I'm not sure which HA version fixed it, but at some point recently I deleted it and added it again, and its been working perfectly. The one step they need to update is where it tells you to hold the home button down to do the password retrieval, for whatever reason on the 960 it has to be docked and charging for this to work. My other roomba didn't need to be and its not mentioned anywhere when setting it up in HA

Bovive commented 1 year ago

Tried it again after recently updating. Held the button and it added it no problem this time.

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.