Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add Roomba when on different subnet #48180

Closed
lbschenkel opened this issue Mar 21, 2021 · 7 comments · Fixed by #48492
Closed

Cannot add Roomba when on different subnet #48180

lbschenkel opened this issue Mar 21, 2021 · 7 comments · Fixed by #48492

Comments

@lbschenkel
Copy link
Contributor

The problem

I purchased a new Roomba i7. I initially set it up on my regular network and I was able to add it to Home Assistant and everything worked after testing for a few days. Then I deleted the integration and moved the Roomba to a dedicated "IoT" network that I have, and I can no longer re-add the device via the configuration flow in the UI and the Home button: I always get "Failed to connect" (even though the robot announces that it worked).

I found out an alternative flow that worked, but this requires going against the instructions presented by the config flow.

What is version of Home Assistant Core has the issue?

core-2021.3.4

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

iRobot Roomba and Braava

Link to integration documentation on our website

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

Example YAML snippet

No response

Anything in the logs that might be useful for us?

I enabled DEBUG logging for roombapy and homeassistant.components.roomba. This is what gets logged:

DEBUG (SyncWorker_14) [roombapy.discovery] Socket server started, port 5678
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 0
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 1
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 2
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 3
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 4
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 5
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 6
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 7 
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 8 
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 9 
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 10
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 11
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 12
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 13
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 14
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 15
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 16
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 17
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 18
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 19
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 20
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 21
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 22                                    
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 23                                    
DEBUG (SyncWorker_14) [roombapy.discovery] Broadcast message sent: 24                                    
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
DEBUG (SyncWorker_14) [roombapy.discovery] Received response: b'irobotmcs', address: ('xx.xx.xx.6', 5678)
INFO (SyncWorker_14) [roombapy.discovery] Socket timeout

The above was during the discovery phase. Then it fails to auto-discover the robot (expected, since it is on a separate subnet) and asks for the host and BLID. The IP xx.xx.xx.6 is the IP of the Home Assistant machine in the "regular" subnet.

Once the IP and BLID were entered and I pressed "Home" for two seconds in the robot, it logs the following:

DEBUG (SyncWorker_5) [roombapy.getpassword] Connected to Roomba xx.xx.xx.179:8883
DEBUG (SyncWorker_5) [roombapy.getpassword] Message sent
DEBUG (MainThread) [roombapy.roomba] CONTINUOUS connection
DEBUG (MainThread) [roombapy.mqttclient] Setting TLS certificate
DEBUG (MainThread) [homeassistant.components.roomba] Initialize connection to vacuum
DEBUG (SyncWorker_0) [roombapy.roomba] Connecting to xx.xx.xx.179, attempt 1
ERROR (SyncWorker_0) [roombapy.roomba] Error: [Errno 111] Connection refused 
DEBUG (SyncWorker_0) [roombapy.roomba] Can't connect to xx.xx.xx.179, retrying
DEBUG (SyncWorker_0) [roombapy.roomba] Connecting to 10.198.4.179, attempt 2
ERROR (SyncWorker_0) [roombapy.roomba] Error: [Errno 111] Connection refused 
DEBUG (SyncWorker_0) [roombapy.roomba] Can't connect to xx.xx.xx.179, retrying
DEBUG (SyncWorker_0) [roombapy.roomba] Connecting to xx.xx.xx.179, attempt 3
ERROR (SyncWorker_0) [roombapy.roomba] Error: [Errno 111] Connection refused 
DEBUG (SyncWorker_0) [roombapy.roomba] Can't connect to xx.xx.xx.179, retrying
ERROR (SyncWorker_0) [roombapy.roomba] Unable to connect to xx.xx.xx.179
ERROR (MainThread) [homeassistant.components.roomba] Error to connect to vacuum

My home network

I have two different subnets. One is the "regular" one and the other is "IoT". Each one has its own Wi-Fi access point.

The "IoT" one is isolated and traffic cannot escape this network. But some devices are whitelisted to talk to the Internet (including the Roomba).

Home Assistant is on the "regular" network. Traffic from "regular" can flow to "IoT". The IP from Home Assistant is also whitelisted in the firewall so devices in "IoT" can talk to Home Assistant.

I have this set up for many years and I am positive that everything is set up fine, networking wise. I have Home Assistant talking to a number of other devices in this same IoT network. But to be sure, I have double checked the whole setup and I found no problems.

Troubleshooting / debugging

After I moved the Roomba to the IoT network, I have done the following:

  • I have run docker exec -it homeassistant python -c 'import roombapy.entry_points; roombapy.entry_points.password()' xx.xx.xx.179 in the Home Assistant machine. This does work. It can talk to the robot and get the credentials.
  • I have installed the rest980 add-on in the Home Assistant machine. This does work. It can control the robot.
  • I have installed roombapy in my desktop computer in the "regular" network. This does work. All command line programs such as roomba-connect, roomba-discovery, roomba-password work as expected.
  • I have tried manually adding the Roomba integration via Configuration / Integrations / Add integration / iRobot Roomba and Brava. I am entering the very same IP and BLID that worked when used in the above steps. I press the Home button in the robot for two seconds until I get the chime, and then I press Submit. This does not work: I get "Failed to connect". However, the robot announces via the loudspeaker that the set-up was successful.

Workaround

After some experimentation I found out an alternate flow that does work. If I don't press Home on the robot when adding the integration, then Home Assistant will ask for the robot password instead. Once I entered the password, then the integration sets up sucesfully and the device and the entities end up being created.

My conclusion

Given the above, it looks like the failure is happening on the "retrieve password" code path. My interpretation is that there are two problems with the component:

  1. The robot password should have been auto-discovered, since docker exec -it homeassistant python -c 'import roombapy.entry_points; roombapy.entry_points.password()' xx.xx.xx.179 does work and it retrieves the correct password.
  2. Failure to retrieve the password should have resulted in the alternate flow that asks the user to enter the password. This never kicks in when Home is pressed on the robot, but it does kick in when Home is not pressed in the robot.

The problems above result in not being able to add the robot if you follow the UI instructions to the letter, when the robot happens to be on a different subnet than Home Assistant. This is not ideal and results in user frustration.

@probot-home-assistant
Copy link

roomba documentation
roomba source
(message by IssueLinks)

@probot-home-assistant
Copy link

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

@joydashy
Copy link

Thanks for reporting this! I had the same issue and it was driving me nuts, I would not have found the workaround myself, which works great.

@bdraco
Copy link
Member

bdraco commented Mar 29, 2021

Once we get into trying to get the password, if it fails, we send the user back to try again in https://github.com/home-assistant/core/blob/dev/homeassistant/components/roomba/config_flow.py#L204

Can you post a video of the flow? Are there any tracebacks in the log?

@lbschenkel
Copy link
Contributor Author

@bdraco: No, no traces, I have enabled DEBUG logging and I included in this issue everything that shows up in the logs.

Regarding the video I'll check how I can make one.

@bdraco
Copy link
Member

bdraco commented Mar 30, 2021

If the just merged PR doesn't fix it for you, please reopen. I attempted to recreate your described network setup when fixing this and it works now but that's never a perfect 1:1

@lbschenkel
Copy link
Contributor Author

OK, thanks. I'll try again on a future version of Home Assistant that includes this change, and then reopen if it doesn't work.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants