Fix Roborock source for China region accounts (region routing + unique MQTT client id) - #2346
Open
Sebjojo233 wants to merge 1 commit into
Open
Fix Roborock source for China region accounts (region routing + unique MQTT client id)#2346Sebjojo233 wants to merge 1 commit into
Sebjojo233 wants to merge 1 commit into
Conversation
GetBaseURL queried only euiot.roborock.com, which returns country=null and a default EU url for accounts registered in another region, so CN accounts always failed login with 2012. Iterate the regional endpoints (us/eu/cn/ru) and use the first one that recognizes the account, same as python-roborock does. The CN MQTT broker also drops connections whose client id is already in use; the fixed id was shared by every go2rtc install, so connections died with 'unexpected EOF' right after CONNACK. Add a random suffix. Tested with a Roborock P20 Pro on a China region account. Fixes AlexxIT#2345, fixes AlexxIT#2207 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2345, fixes #2207
Two small fixes that together make the Roborock source work for China region accounts (verified end-to-end with a Roborock P20 Pro on a CN account — also added to the known working models list).
1. Region routing in
GetBaseURL(#2345)getUrlByEmailwas only queried oneuiot.roborock.com. For accounts registered in another region it repliescode: 200withcountry: nulland a default EU url, so login was attempted on the wrong server and always failed with2012: username or password error.Now the regional endpoints (
us/eu/cn/ru) are queried in order and the first one that recognizes the account (non-nullcountry/countrycode) wins — the same strategy python-roborock uses. If no region recognizes the account, the first region's default url is kept, which preserves the old behavior.Verified: with a CN account, login now reaches
cniot.roborock.comand the account is recognized (my particular account is then stopped by forced 2FA — that's #2046, out of scope here — but the routing is provably fixed since the CN server validates the password instead of the EU server rejecting an unknown account).2. Unique MQTT client id (#2207)
The MQTT client id was hardcoded to
com.roborock.smart:mbrriot, shared by every go2rtc install. The CN broker (mqtt-cn-*.roborock.com) accepts the connection (CONNACK success) and then immediately drops it, which surfaced asstreams: unexpected EOF. Reproduced in a minimal client: identical credentials work with a unique client id and are kicked with the fixed one. A random suffix is now appended per connection.After both fixes the P20 Pro streams fine (H.264 640×480 ~14 fps, pattern PIN works as documented).
🤖 Generated with Claude Code