NickWaterton / Roomba980-Python

Python program and library to control iRobot Roomba 980 Vacuum Cleaner
MIT License
361 stars 103 forks source link

Unable to retrieve password for i6 #115

Open hardweb-it opened 1 year ago

hardweb-it commented 1 year ago

Hello, I'm trying to retrieve password of my Roomba i6 (sku:i615840, and sw:lewis+22.52.5+2023-02-16-7e788e611c3+Firmware-Build+2880) but with no luck.

I tried in more ways with Ubuntu 20 and Python 3.8, and with Win 10 Powershell python 3.9. No one works and get always the same error

Trying with "local mode" using: ./password.py -R ROOMBA_IP_ADDRESS I always get this:

2023-04-06 12:53:12 INFO [Roomba.Password] Roomba (Roomba) IP address is: 192.168.1.152
2023-04-06 12:53:15 ERROR [Roomba.Password] Unable to Connect to roomba at ip 192.168.1.152, make sure nothing else is connected (app?), as only one connection at a time is allowed
2023-04-06 12:53:15 ERROR [Roomba.Password] Unable to get password from roomba
2023-04-06 12:53:15 ERROR [Roomba.Password] Error getting password for robot Roomba at ip192.168.1.152, received 0 bytes. Follow the instructions and try again.

And also tried with Cloud mode with: ./password.py "username" "password"

2023-04-06 12:48:03 INFO [Roomba.Password] Getting Roomba information from iRobot aws cloud...
2023-04-06 12:48:04 DEBUG [urllib3.connectionpool] Starting new HTTPS connection (1): disc-prod.iot.irobotapi.com:443
2023-04-06 12:48:04 DEBUG [urllib3.connectionpool] https://disc-prod.iot.irobotapi.com:443 "GET /v1/discover/endpoints?country_code=US HTTP/1.1" 200 1789
2023-04-06 12:48:04 DEBUG [urllib3.connectionpool] Starting new HTTPS connection (1): accounts.us1.gigya.com:443
2023-04-06 12:48:05 DEBUG [urllib3.connectionpool] https://accounts.us1.gigya.com:443 "POST /accounts.login HTTP/1.1" 200 217
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 119, in get_password
    iRobot.login()
  File "/root/Roomba980-Python/roomba/getcloudpassword.py", line 107, in login
    uid = response['UID']
KeyError: 'UID'

Any suggestion? Thank you in advance

hardweb-it commented 1 year ago

After a bit of debug session I found the issue with Cloud mode by reading the json responses:

If cloud account password contain some special chars, such as $ (dollar), those are trimmed from the string, so the login fail. By forcing the password string inside "getcloudpassword.py", I manage to get API working, and then retreive the password which format is like this

:1:1234567890:AbCdEFgHiJKLM2NO6pqR

However, I tried to put that string on Home Assistant to connect with Roomba, but it return "Unable to connect". So I built myself the ./config.ini and by running ./roomba.py that's the log:

[2023-04-06 16:38:53,649][ INFO](Roomba              ) *******************
[2023-04-06 16:38:53,650][ INFO](Roomba              ) * Program Started *
[2023-04-06 16:38:53,650][ INFO](Roomba              ) *******************
[2023-04-06 16:38:53,651][ INFO](Roomba              ) Roomba.py Version: 2.0i
[2023-04-06 16:38:53,651][ INFO](Roomba              ) Python Version: 3.8.10 (default, Mar 13 2023, 10:26:41) [GCC 9.4.0]
[2023-04-06 16:38:53,653][ INFO](Roomba              ) Paho MQTT Version: 1.6.1
[2023-04-06 16:38:53,653][ INFO](Roomba              ) CV Version: 4.7.0
[2023-04-06 16:38:53,654][ INFO](Roomba              ) PIL Version: 9.5.0
[2023-04-06 16:38:53,654][ INFO](Roomba              ) <CNTRL C> to Exit
[2023-04-06 16:38:53,655][ INFO](Roomba              ) Roomba MQTT data Interface
[2023-04-06 16:38:53,656][ INFO](Roomba.Password     ) Using Password version 2.1
[2023-04-06 16:38:53,657][ INFO](Roomba.Password     ) reading/writing info from config file ./config.ini
[2023-04-06 16:38:53,658][ INFO](Roomba.Password     ) 1 Roombas Found
[2023-04-06 16:38:53,658][ INFO](Roomba              ) Creating Roomba object 192.168.1.152, Roomba
[2023-04-06 16:38:53,659][ INFO](Roomba.Password     ) Using Password version 2.1
[2023-04-06 16:38:53,661][ INFO](Roomba.Roomba       ) Posting DECODED data
[2023-04-06 16:38:53,663][ INFO](Roomba.Roomba       ) MAP: Maps Enabled
[2023-04-06 16:38:53,663][ INFO](Roomba.Roomba       ) Connecting...
[2023-04-06 16:38:53,664][ INFO](Roomba.Roomba       ) Setting TLS
[2023-04-06 16:38:53,665][WARNI](Roomba.Roomba       ) error loading font: %s, loading default font
[2023-04-06 16:38:53,670][ INFO](Roomba.Roomba       ) Setting TLS - OK
[2023-04-06 16:38:53,693][ INFO](Roomba.Roomba       ) MAP: Not drawing Room Outline
[2023-04-06 16:38:53,708][ INFO](Roomba.Roomba       ) MAP: opening existing map_notext.png
[2023-04-06 16:38:53,709][WARNI](Roomba.Roomba       ) MAP: unable to load map_notext.png: [Errno 2] No such file or directory: './Roombamap_notext.png': set to None
[2023-04-06 16:38:53,710][ INFO](Roomba.Roomba       ) MAP: home_pos: (100,395)
[2023-04-06 16:38:53,710][ INFO](Roomba.Roomba       ) MAP: Initialisation complete
[2023-04-06 16:38:53,712][ INFO](Roomba.Roomba       ) MAP: loading floorplan: res/first_floor.jpg
[2023-04-06 16:38:53,841][ INFO](Roomba.Roomba       ) loaded floorplan: res/first_floor.jpg
[2023-04-06 16:38:55,858][ERROR](Roomba.Roomba       ) Unable to Connect to roomba Roomba, make sure nothing else is connected (app?), as only one connection at a time is allowed
[2023-04-06 16:38:56,861][ERROR](Roomba.Roomba       ) Attempting retry Connection# 0
[2023-04-06 16:38:56,862][ INFO](Roomba.Roomba       ) Attempting to Reconnect...
[2023-04-06 16:38:58,945][ERROR](Roomba.Roomba       ) Unable to Connect to roomba Roomba, make sure nothing else is connected (app?), as only one connection at a time is allowed
[2023-04-06 16:38:59,948][ERROR](Roomba.Roomba       ) Attempting retry Connection# 1
[2023-04-06 16:38:59,948][ INFO](Roomba.Roomba       ) Attempting to Reconnect...
[2023-04-06 16:39:02,146][ERROR](Roomba.Roomba       ) Unable to Connect to roomba Roomba, make sure nothing else is connected (app?), as only one connection at a time is allowed
[2023-04-06 16:39:03,148][ERROR](Roomba.Roomba       ) Attempting retry Connection# 2
[2023-04-06 16:39:03,149][ INFO](Roomba.Roomba       ) Attempting to Reconnect...
[2023-04-06 16:39:05,371][ERROR](Roomba.Roomba       ) Unable to Connect to roomba Roomba, make sure nothing else is connected (app?), as only one connection at a time is allowed
[2023-04-06 16:40:05,374][ERROR](Roomba.Roomba       ) Attempting retry Connection# 3
[2023-04-06 16:40:05,374][ INFO](Roomba.Roomba       ) Attempting to Reconnect...
[2023-04-06 16:40:07,797][ERROR](Roomba.Roomba       ) Unable to Connect to roomba Roomba, make sure nothing else is connected (app?), as only one connection at a time is allowed

I also tried by pressing 2 sec. the Home button (light become blue and rotating), with no luck. Which could be the thing that prevents Roomba to connect with?

Thanks for any suggestion.

NickWaterton commented 1 year ago

There is generally two reasons why you can't connect:

1) Unable to Connect to roomba Roomba, make sure nothing else is connected (app?), as only one connection at a time is allowed 2) Encryption has changed

If it's 1), you have to force close the app on your phone. One HA has connected, you can open the app again, and it will use the cloud connection, instead of the local connection.

If it's 2), it's more of a problem, because the program has to be adapted to the new encryption, and that's hard to do as I don't have an i6 to test it on.

hardweb-it commented 1 year ago

Finally I was able to manage the issue.

That's how (in this exact order):

  1. Open the official "iRobot APP" and reset the device (you can keep your floor map! iRobot will backup it for you).
  2. Reset iRobot account's password (by removing "$" char or any other chars which do the issue, and substitute them with any other symbol...for example using "!" << tested and working)
  3. Reconnect Roomba device after reset, to the WiFi Network, such as the first installation.
  4. Run the ./password.py "username" "password" command
  5. Now the script is able to retrieve the new decoded password from cloud.
  6. Open iRobot APP, tap on MENU, go to "Account" and then tap on "Close session" button at the bottom.
  7. Repeat the step n.6 for all other local devices which have iRobot app connected to the cloud.
  8. Now open HA -> Settings -> Device -> Roomba and click on the "configure" button.
  9. Type (or copy & paste) the password grabbed at the fifth step.
  10. Now the HA Roomba configuration should work fine!
  11. Open iRobot APP on your devices and then login again.

Before doing all that things, I tried to only change my account password, logout from APP, and get the new one decoded, but anyway the HA connection doesn't worked as excpected.

I think that: Password containing "$" char (and I don't know if this is the only one), will produce a bad decoded password, so it can't working properly. AND moreover my device were stuck/locked for many reasons and only after perform the reset I get the device unlocked and responding correctly to the network.

However, after perform the full process, it goes fine! Hope this can help other people!

Thanks for your time.

NickWaterton commented 1 year ago

Glad you figured it out. The whole "only one thing can be connected at a time" thing is a PITA.

Persistence pays off!