Roomba980-Python
Roomba980-Python copied to clipboard
ValueError: check_hostname requires server_hostname with Roomba password.py
After the device was found, I am asked to press the home button. Once I press enter on the console, I get this error:
Traceback (most recent call last):
File "./password.py", line 294, in <module>
main()
File "./password.py", line 291, in main
get_passwd.get_password()
File "./password.py", line 160, in get_password
data = self.get_password_from_roomba(addr)
File "./password.py", line 196, in get_password_from_roomba
wrappedSocket = context.wrap_socket(sock)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py", line 997, in _create
raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname
Same here!
What Roomba do you have? For new Roomba’s you have to use a different process, as described in the instructions.
The method you are trying only works on older Roomba’s.
Ok, I have looked into this. There are two possible fixes, maybe one of you can test this out.
in file password.py
- change
PROTOCOL_TLS_ CLIENT
on line 194 toPROTOCOL_TLS_SERVER
- change
context.wrap_socket(sock)
on line 196 toconnect.wrap_socket(sock, server_hostname=addr)
If you could try 1) or 2) above (but not both), and let me know which (if any) works, I will update the code. I can’t test it myself, as I only have new Roombas.
I try and :
no change :
Traceback (most recent call last): File "/mnt/c/WINDOWS/system32/Roomba980-Python/roomba/password.py", line 294, in <module> main() File "/mnt/c/WINDOWS/system32/Roomba980-Python/roomba/password.py", line 291, in main get_passwd.get_password() File "/mnt/c/WINDOWS/system32/Roomba980-Python/roomba/password.py", line 160, in get_password data = self.get_password_from_roomba(addr) File "/mnt/c/WINDOWS/system32/Roomba980-Python/roomba/password.py", line 196, in get_password_from_roomba wrappedSocket = context.wrap_socket(sock) File "/usr/lib/python3.10/ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "/usr/lib/python3.10/ssl.py", line 1028, in _create raise ValueError("check_hostname requires server_hostname") ValueError: check_hostname requires server_hostname
1 change not 2 :
2023-12-22 19:55:54 ERROR [Roomba.Password] Connection Error (for 192.168.1.81): Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:811)
1 and 2 :
2023-12-22 19:57:29 INFO [Roomba.Password] Roomba (Jet M6) IP address is: 192.168.1.81
Traceback (most recent call last):
File "/mnt/c/WINDOWS/system32/Roomba980-Python/roomba/password.py", line 294, in <module>
main()
File "/mnt/c/WINDOWS/system32/Roomba980-Python/roomba/password.py", line 291, in main
get_passwd.get_password()
File "/mnt/c/WINDOWS/system32/Roomba980-Python/roomba/password.py", line 160, in get_password
data = self.get_password_from_roomba(addr)
File "/mnt/c/WINDOWS/system32/Roomba980-Python/roomba/password.py", line 196, in get_password_from_roomba
wrappedSocket = connect.wrap_socket(sock, server_hostname=addr)
NameError: name 'connect' is not defined. Did you mean: 'context'?
1 not change and 2 :
2023-12-22 20:00:03 ERROR [Roomba.Password] Connection Error (for 192.168.1.81): [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)
2023-12-22 20:00:03 ERROR [Roomba.Password] Unable to get password from roomba
2023-12-22 20:00:03 ERROR [Roomba.Password] Error getting password for robot Jet M6 at ip192.168.1.81, received 0 bytes. Follow the instructions and try again.
Ok, I have looked into this. There are two possible fixes, maybe one of you can test this out.
in file
password.py
1. change `PROTOCOL_TLS_ CLIENT` on line 194 to `PROTOCOL_TLS_SERVER` 2. change `context.wrap_socket(sock)` on line 196 to `connect.wrap_socket(sock, server_hostname=addr)`
If you could try 1) or 2) above (but not both), and let me know which (if any) works, I will update the code. I can’t test it myself, as I only have new Roombas.
- works for me, but "connect" has to be "context", so:
context.wrap_socket(sock, server_hostname=addr)
note i still had an issue of the script exploding because I have two roombas and one was downstairs on its charger, so I couldn't press the home button :)
You have to the button and after press enter so you have time.
I came across the same problem. although i got it through the cloud option :) nonetheless I checked these options. and both seemed to work.
I'm getting the same issue and none of the above solutions are working for me.
Ok, I have looked into this. There are two possible fixes, maybe one of you can test this out.
in file
password.py
- change
PROTOCOL_TLS_ CLIENT
on line 194 toPROTOCOL_TLS_SERVER
- change
context.wrap_socket(sock)
on line 196 toconnect.wrap_socket(sock, server_hostname=addr)
If you could try 1) or 2) above (but not both), and let me know which (if any) works, I will update the code. I can’t test it myself, as I only have new Roombas.
For 1, I get the Cannot create a client socket with a PROTOCOL_TLS_SERVER context (_ssl.c:809)
issue.
For 2, I get Connection Error (for <ip addr>): [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)
when I change connect
to context
in the solution. With connect
as the solution suggests I get a NameError
as mentioned by @Idaho947.
I've got the S9+, and as a sanity check I also attempted all the same steps both with the vacuum linked and unlinked to my Google account.
I'd be happy to perform further troubleshooting steps as necessary
@32nmud
The process you are attempting does not work on modern Roombas like the S9+.
For modern Roombas, you have to use the cloud connection method to get the password, as described in the documentation.
Wondering if for non-cloud Roomba connections, it makes sense to bypass hostname and certificate validity checks altogether? Heres what I use since these are all local roombas and I trust them ;-).
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
Wondering if for non-cloud Roomba connections, it makes sense to bypass hostname and certificate validity checks altogether? Heres what I use since these are all local roombas and I trust them ;-).
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) context.check_hostname = False context.verify_mode = ssl.CERT_NONE
This is exactly what worked for me -- I have an iRobot SKU s955020
Wondering if for non-cloud Roomba connections, it makes sense to bypass hostname and certificate validity checks altogether? Heres what I use since these are all local roombas and I trust them ;-).
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) context.check_hostname = False context.verify_mode = ssl.CERT_NONE
Trying this method with a Roomba 960, I get the following error now:
2024-07-27 14:21:39 ERROR [Roomba.Password] Connection Error (for 192.168.XX.XX): [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:1007)
2024-07-27 14:21:39 ERROR [Roomba.Password] Unable to get password from roomba
2024-07-27 14:21:39 ERROR [Roomba.Password] Error getting password for robot Roomba at ip192.168.XX.XX, received 0 bytes.