You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RoborockApiClient cannot find newly created account – Error from Home Assistant Integration #485
Yesterday, I created a new Roborock account (new household account) via the app and have transferred our QV 35S to it. I am doing this to consolidate various smart device apps onto a single household email account for ease of portability, instead of having them linked to my personal email on a previous account (personal email account). The personal email account was set up months ago and allows me to connect it to Home Assistant, which uses python-roborock to connect to Roborock devices .
The personal email account allows the logic below to work, effectively sending a code to the account email. The new household account gives an error (below). Both accounts allow login using the app as well as the commercial Roborock site, but the new household account fails to authenticate via this package.
Code
importasynciofromroborock.web_apiimportRoborockApiClientasyncdefmain():
web_api=RoborockApiClient(username="<acount_email>")
awaitweb_api.request_code()
code=input("What is the code?")
user_data=awaitweb_api.code_login(code)
asyncio.run(main())
Error using new household account
Traceback (most recent call last):
File "/Users/simulacrean/test.py", line 12, in <module>
asyncio.run(main())
File "/Users/simulacrean/.pyenv/versions/3.10.9/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/Users/simulacrean/.pyenv/versions/3.10.9/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/Users/simulacrean/test.py", line 8, in main
await web_api.request_code()
File "/Users/simulacrean/.pyenv/versions/3.10.9/lib/python3.10/site-packages/roborock/web_api.py", line 105, in request_code
raise RoborockAccountDoesNotExist("Account does not exist - check your login and try again.")
roborock.exceptions.RoborockAccountDoesNotExist: Account does not exist - check your login and try again.
So I see in your logs you tried to pass login as well (I edited your post to hide your password, but you might want to change it)
I will send you something to try tomorrow. There is technically a v3 of the login flow that requires a pass and a 2fa code, it could be that new accounts require the new flow.
oh yikes, I didnt even check that it logged the PW. it was an old PW that I'd already changed, but thank you! Good catch.
That error output must have been from a previous attempts to get the auth to work. I updated the error outut to reflect the code I sent in the previous comment.
@Lash-L The PR #486 does not solve my issue as I have documented in the PR's comments, however I was able to get to the bottom of it.
Summary
Newer US based Roborock accounts return the wrong EU base URL from the https://euiot.roborock.com/api/v1/getUrlByEmail API endpoint used by default by RoborockApiClient leading to a failure of the auth at the login the /api/v4/auth/email/login/code step. This can be fixed by explicitly setting base_url to https://usiot.roborock.com when instantiating RoborockApiClient.
Details
Basically, any new US-based Robrock account I create via the app within the last few days gets the following response from GET https://euiot.roborock.com/api/v1/getUrlByEmail
This returns the (wrong) EU subdomain for the API base URL, even though I've created now 3 different new accounts (@gmail.com, @proton.me, @yahoo.com), all using the USA based option in the app toggle.
Using Proxyman on my iPhone while logging into the Roborock app with any of these new accounts, I can see that the phone app uses the US subdomain, and manages to login successfully.
The older gmail account that was working with the integration gives the following correct response for GET https://euiot.roborock.com/api/v1/getUrlByEmail
Funny enough, GET https://usiot.roborock.com/api/v1/getUrlByEmail returns the correct url and country and country code for all of my accounts. You may want to consider adjusting this line to use https://usiot.roborock.com:
However, I do not know if it provides accurate url, country and country code info for other regions, just that it is more accurate than the EU subdomain for newer US based accounts.
Assigning The US Subdomain
If I set the base url to https://usiot.roborock.com and then run this code, I am able to login successfully:
importasynciofromroborock.web_apiimportRoborockApiClientasyncdefmain():
web_api=RoborockApiClient(username=<newaccountemail>, baseURL="https://usiot.roborock.com")
awaitweb_api.request_code_v4()
code=input("What is the code?")
user_data=awaitweb_api.code_login_v4(code, "US", 1)
asyncio.run(main())
Thanks for the sleuthing! If you wanted to continue testing, making an account in the eu would be helpful to test with. I.e does that new eu one give the right info if you call the us api
I can try that out later though if you don't get a chance
So I'm now getting the "too many code requests" error for any account I try to get a code for, using the package. I think they may have clocked either my IP, MAC address or some combination as potentially a security threat as I still cannot make more requests today and it's been 24 hours. I'll keep waiting or contact their team to see if they can unlock my priveledges. Once I do, I will try making and authenticating accounts from other regions as per your reccomendation.
In the meanwhile, I thought it would be useful to provide a way to get the country code and country for an account within your package, especially so it can eventually be used to try both normal and v4 login via the HA core integration, all using data from your package (the v4 code retrieval would require getting the country code and country). I created a PR to add these features. Let me know what you think!
Activity
Lash-L commentedon Sep 19, 2025
So I see in your logs you tried to pass login as well (I edited your post to hide your password, but you might want to change it)
I will send you something to try tomorrow. There is technically a v3 of the login flow that requires a pass and a 2fa code, it could be that new accounts require the new flow.
deconstructionalism commentedon Sep 19, 2025
oh yikes, I didnt even check that it logged the PW. it was an old PW that I'd already changed, but thank you! Good catch.
That error output must have been from a previous attempts to get the auth to work. I updated the error outut to reflect the code I sent in the previous comment.
deconstructionalism commentedon Sep 21, 2025
Summary
Newer US based Roborock accounts return the wrong EU base URL from the
https://euiot.roborock.com/api/v1/getUrlByEmailAPI endpoint used by default byRoborockApiClientleading to a failure of the auth at the login the/api/v4/auth/email/login/codestep. This can be fixed by explicitly settingbase_urltohttps://usiot.roborock.comwhen instantiatingRoborockApiClient.Details
Basically, any new US-based Robrock account I create via the app within the last few days gets the following response from
GET https://euiot.roborock.com/api/v1/getUrlByEmail{ "code": 200, "msg": "success", "data": { "url": "https://euiot.roborock.com", "country": null, "countrycode": null } }This returns the (wrong) EU subdomain for the API base URL, even though I've created now 3 different new accounts (@gmail.com, @proton.me, @yahoo.com), all using the USA based option in the app toggle.
Using Proxyman on my iPhone while logging into the Roborock app with any of these new accounts, I can see that the phone app uses the US subdomain, and manages to login successfully.
The older gmail account that was working with the integration gives the following correct response for
GET https://euiot.roborock.com/api/v1/getUrlByEmailFunny enough,
GET https://usiot.roborock.com/api/v1/getUrlByEmailreturns the correct url and country and country code for all of my accounts. You may want to consider adjusting this line to usehttps://usiot.roborock.com:python-roborock/roborock/web_api.py
Line 55 in 420e4ae
However, I do not know if it provides accurate url, country and country code info for other regions, just that it is more accurate than the EU subdomain for newer US based accounts.
Assigning The US Subdomain
If I set the base url to
https://usiot.roborock.comand then run this code, I am able to login successfully:returns:
{ "code": 200, "msg": "success", "data": { "uid": ..., "rruid": ..., "token": ..., "region": "us", "countrycode": "1", "country": "US", "nickname": ..., "avatarUrl": "https://files.roborock.com/iot/default_avatar.png", "tuya": None, "rriot": { "u": "...", "s": "...", "h": "...", "k": "...", "r": { "r": "US", "a": "https://api-us.roborock.com", "m": "ssl://mqtt-us-3.roborock.com:8883", "l": "https://wood-us.roborock.com", }, }, "tuyaDeviceState": 0, }, }Lash-L commentedon Sep 21, 2025
Thanks for the sleuthing! If you wanted to continue testing, making an account in the eu would be helpful to test with. I.e does that new eu one give the right info if you call the us api
I can try that out later though if you don't get a chance
deconstructionalism commentedon Sep 21, 2025
So I'm now getting the "too many code requests" error for any account I try to get a code for, using the package. I think they may have clocked either my IP, MAC address or some combination as potentially a security threat as I still cannot make more requests today and it's been 24 hours. I'll keep waiting or contact their team to see if they can unlock my priveledges. Once I do, I will try making and authenticating accounts from other regions as per your reccomendation.
In the meanwhile, I thought it would be useful to provide a way to get the country code and country for an account within your package, especially so it can eventually be used to try both normal and v4 login via the HA core integration, all using data from your package (the v4 code retrieval would require getting the country code and country). I created a PR to add these features. Let me know what you think!