Skip to content

RoborockApiClient cannot find newly created account – Error from Home Assistant Integration #485

Closed

Description

@deconstructionalism

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

import asyncio

from roborock.web_api import RoborockApiClient

async def main():
    web_api = RoborockApiClient(username="<acount_email>")
    await web_api.request_code()
    code = input("What is the code?")
    user_data = await web_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.

Activity

  1. Lash-L commented on Sep 19, 2025

    @Lash-L
    Collaborator

    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.

  2. deconstructionalism commented on Sep 19, 2025

    @deconstructionalism
    Author

    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.

  3. deconstructionalism commented on Sep 21, 2025

    @deconstructionalism
    Author

    @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

    {
    	"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/getUrlByEmail

    {
    	"code": 200,
    	"msg": "success",
    	"data": {
    		"url": "https://usiot.roborock.com",
    		"country": "US",
    		"countrycode": "1"
    	}
    }
    

    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:

    self._default_url = "https://euiot.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:

    import asyncio
    
    from roborock.web_api import RoborockApiClient
    
    async def main():
        web_api = RoborockApiClient(username=<new account email>, baseURL="https://usiot.roborock.com")
        await web_api.request_code_v4()
        code = input("What is the code?")
        user_data = await web_api.code_login_v4(code, "US", 1)
    
    asyncio.run(main())

    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,
        },
    }
  4. Lash-L commented on Sep 21, 2025

    @Lash-L
    Collaborator

    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

  5. deconstructionalism commented on Sep 21, 2025

    @deconstructionalism
    Author

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions