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 Integration for J5+ Combo #109772

Closed
christophermichaelshaw opened this issue Feb 6, 2024 · 25 comments · Fixed by pschmitt/roombapy#228 or #110762
Closed

Cannot add Roomba Integration for J5+ Combo #109772

christophermichaelshaw opened this issue Feb 6, 2024 · 25 comments · Fixed by pschmitt/roombapy#228 or #110762

Comments

@christophermichaelshaw
Copy link

The problem

I am unable to add the Roomba Integration for a brand new iRobot Roomba J5+ Combo. It is discovered automagically, but when I attempt to add the device, I receive an error:
image

I was able to successfully obtain my user and password using the koalazak/dorita980 SDK but am not prompted to enter any configuration details.

I did some digging into the forums but haven't seen any reports of issues specific to the J5+ model. I attempted several fixes, such as changing the ciphers in the usr/local/lib/python3.12/site-packages/roombapy/getpassword.py and usr/local/lib/python3.12/site-packages/roombapy/remote_client.py files, as well as attempting different lengths of pressing the top button, on and off the dock.

The relevant error in the log (see below) is related to aiohttp.server, indicating a possible issue due to the Python version upgrade in 2024.2 betas -- This GH thread may be related: eventlet/eventlet#795

`Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
First occurred: 17:00:34 (3 occurrences)
Last logged: 17:03:46

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin
return await func(self, request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 185, in post
return await super().post(request, flow_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
result = await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
result = await self._flow_mgr.async_configure(flow_id, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 358, in async_configure
result = await self._async_configure(flow_id, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 404, in _async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 501, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/roomba/config_flow.py", line 230, in async_step_link
roomba_pw = RoombaPassword(self.host)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/roombapy/getpassword.py", line 21, in init
self.server_socket = _get_socket()
^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/roombapy/getpassword.py", line 81, in _get_socket
ssl_socket = ssl.wrap_socket(
^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'`

What version of Home Assistant Core has the issue?

core-2024.2.0b8

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://rc.home-assistant.io/integrations/roomba

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
First occurred: 17:00:34 (2 occurrences)
Last logged: 17:00:35

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 185, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 358, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 404, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 501, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/roomba/config_flow.py", line 230, in async_step_link
    roomba_pw = RoombaPassword(self.host)
                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roombapy/getpassword.py", line 21, in __init__
    self.server_socket = _get_socket()
                         ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/roombapy/getpassword.py", line 81, in _get_socket
    ssl_socket = ssl.wrap_socket(
                 ^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'

Additional information

Roomba J5+ Software: 23.37.5

@home-assistant
Copy link

home-assistant bot commented Feb 6, 2024

Hey there @pschmitt, @cyr-ius, @shenxn, @Xitee1, 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!

Code owner commands

Code owners of roomba can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign roomba Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


roomba documentation
roomba source
(message by IssueLinks)

@frenck frenck added this to the 2024.2.0 milestone Feb 6, 2024
@christophermichaelshaw
Copy link
Author

More context here from the Python documentation: https://docs.python.org/3.12/whatsnew/3.12.html#ssl

Remove the ssl.wrap_socket() function, deprecated in Python 3.7: instead, create a ssl.SSLContext object and call its ssl.SSLContext.wrap_socket method. Any package that still uses ssl.wrap_socket() is broken and insecure. The function neither sends a SNI TLS extension nor validates server hostname. Code is subject to CWE-295: Improper Certificate Validation. (Contributed by Victor Stinner in gh-94199.)

@SpaceCowboyLive
Copy link

Same error here for a very old Roomba i7 and i8 wherein the Roomba Integration is broken when it worked perfectly well before. Guess it's my fault for upgrading to the 2024.2.0 HA Core

What version of Home Assistant Core has the issue?

Core 2024.2.0
Supervisor 2024.01.1
Operating System 11.5
Frontend 20240207.0

What was the last working version of Home Assistant Core?

Core 2024.1.6

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://rc.home-assistant.io/integrations/roomba

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
First occurred: 22:04:41 (24 occurrences)
Last logged: 22:07:54

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 149, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin
return await func(self, request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 185, in post
return await super().post(request, flow_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
result = await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post
result = await self._flow_mgr.async_configure(flow_id, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 358, in async_configure
result = await self._async_configure(flow_id, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 404, in _async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 501, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/roomba/config_flow.py", line 230, in async_step_link
roomba_pw = RoombaPassword(self.host)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/roombapy/getpassword.py", line 21, in init
self.server_socket = _get_socket()
^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/roombapy/getpassword.py", line 81, in _get_socket
ssl_socket = ssl.wrap_socket(
^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'

@diveschumi
Copy link

diveschumi commented Feb 9, 2024

Same problem here with one of two Roomba 980. First no response, then this error at the try of re-adding.

@SiebRad
Copy link

SiebRad commented Feb 10, 2024

Same problem in my Hass. The problem looks like easy to fix. I wanted to make pull request but I cannot find the file getpassword.py on Hass github.

@Xitee1
Copy link
Contributor

Xitee1 commented Feb 10, 2024

Same problem in my Hass. The problem looks like easy to fix. I wanted to make pull request but I cannot find the file getpassword.py on Hass github.

Here it is: https://github.com/pschmitt/roombapy/blob/881b566f88f0b23cd5d184ccd88b4e46fad765e8/roombapy/getpassword.py#L81

@SiebRad
Copy link

SiebRad commented Feb 10, 2024

This is my best guess how to fix the issue. Correct function get_socket below.

def _get_socket():
    server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server_socket.settimeout(10)
    ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
    ssl_context.options |= ssl.OP_LEGACY_SERVER_CONNECT
    ssl_socket = ssl_context.wrap_socket(
        server_socket
    )
    return ssl_socket

I cannot create branch on repository so I cannot push it and create pull request.
I do not know how to test if this code is correct. The only idea I have is to hack this fix directly to my Hass instance in the docker.
Any idea how to proceed?

The issue seems to me clear. Home Assistant Core 2024.2 has Python 3.12 where ssl.wrap_socket method is no longer supported.

@Xitee1
Copy link
Contributor

Xitee1 commented Feb 10, 2024

I cannot create branch on repository so I cannot push it and create pull request.

You first have to fork the repository and clone the forked repository, then create the branch and push your changes. Github will automatically suggest to create a PR then.

I do not know how to test if this code is correct. The only idea I have is to hack this fix directly to my Hass instance in the docker.
Any idea how to proceed?

I guess it isn't really the "proper" way to do it but you should setup a HA dev environment and once set up you can go into the folder venv/lib/python3.xx/site-packages/roombapy and modify the getpassword.py file there to test it. If it works you can copy it over to the cloned roombapy project and commit the changes.

@shwarnock
Copy link

Same issue here. Looking forward to the fix so I can get my Roomba integrated again!

@jpar0511
Copy link

with the python method after installing roombapy i can at least get my blid and pw now.
But how to get it work with the integration - error there still exists...

@CelsoSantos
Copy link

Also eagerly awaiting a newer release with a fix.. Just starting building my "smart home lab" (really mostly testing for a future project) and I had issues with Matter devices and now Roomba too.. Though I'm running the container so I won't be getting this working until a newer release is available. Looking forward to it.

@Orhideous
Copy link
Contributor

@CelsoSantos Roombas are kinda cursed robots, even without knife attached, so proper support beyond of basic start/stop/go home/locate will require a lot of tinkering. The good news is that it can be done.

@CelsoSantos
Copy link

@CelsoSantos Roombas are kinda cursed robots, even without knife attached, so proper support beyond of basic start/stop/go home/locate will require a lot of tinkering. The good news is that it can be done.

Honestly, that's all I ask for. The roomba I have is pretty "old" and dumb (doesn't map rooms, only spot cleaning or cleaning everything it can find, even if that means missing spots or go to another room before finishing, if allowed) so On/Off is fine with me

@Kagey-cmd
Copy link

Same issue here. Immediate "unknown error occurred". I haven't found a place to enter my BLID and pw, though I was able to retrieve those using password.py

@Orhideous
Copy link
Contributor

@Kagey-cmd Just wait for 2024.2.3 :)

@LakeHouse47025
Copy link

I have 2 Roomba S9 and a Brava mop. All 3 previously worked in HA but I had to factory reset one of the S9 and I am unable to complete the configuration to get it back into HA. The other 2 still work as they previously did. Not sure if it is relevant but I did notice the software on the S9 base station that is working is 4.0.0 Aug 1, 23 and on the one I cannot configure its 4.8.6 Jan 30, 24.

@aarnaegg
Copy link

aarnaegg commented Feb 20, 2024

@Kagey-cmd Just wait for 2024.2.3 :)

@Orhideous Will this fix the same error on the J9’s?

@Orhideous
Copy link
Contributor

Will this fix the same error on the J9’s?

Nope. It's a different error — hopefully, known and since I'm affected too I'm working on it.

@Kagey-cmd
Copy link

@Kagey-cmd Just wait for 2024.2.3 :)

Suppose I should have mentioned my Roomba is an i3.

@CelsoSantos
Copy link

I confirm this is fixed in 2024.2.4

@Jobey88
Copy link

Jobey88 commented Mar 14, 2024

Hi, Sorry for the noob question. I had a I5plus connected and working with HA. I decided to exchange for the J5+. I have not been able to get it connected to HA. As soon as its "discovered" I click on configure and it goes to unknown error instantly. No matter how many times I try. (press the button etc) I did make sure the app on my mobile was not connected. I restored a backup from older version and tried upgrading. I am at a loss now. Does anyone have any advice? I have HA running on a VM. Had no issues prior to changing from the I5+ ro the J5+. Thank you.

@aarnaegg
Copy link

I've posted about this several times. The J series Roombas don't work at all with this plugin.

@Jobey88
Copy link

Jobey88 commented Mar 14, 2024

OMG, I just exchanged for this model. The title of this thread has J5+ in it. Assumed it worked after reading this thread said solved. Thank you for the quick response. What model do you recommend?

thx again

@aarnaegg
Copy link

aarnaegg commented Mar 14, 2024

I mean I'd still recommend the J series because they preform better than the older i series. I'm sure there will be an update to fix it at some point...

@Jobey88
Copy link

Jobey88 commented Mar 14, 2024

Ok, thank you. I just got it and can still exchange for the s9+. I was also considering the RoboRock. Not sure if best to wait till they fix the connection issue with the iRobot. Thank you again for the help/advice.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.