Learn unknown device MQTT credentials on first connect#22
Closed
piotrkochan wants to merge 1 commit intoPython-roborock:mainfrom
Closed
Learn unknown device MQTT credentials on first connect#22piotrkochan wants to merge 1 commit intoPython-roborock:mainfrom
piotrkochan wants to merge 1 commit intoPython-roborock:mainfrom
Conversation
|
Thanks for the PR, it did unblock my vacuum as well! I use a Roborock S7 (roborock.vacuum.a15) and it was stuck on connecting to the Wi-Fi and your patch helped it connect to MQTT. However, my phone would not connect to the MQTT server with the same error after installing the patched application on Android. I ended up adding the following code to just allow all MQTT credentials (I won't create a PR as this is hacky) @@ -232,6 +233,12 @@ class MqttTlsProxy:
if learned_device is not None:
return True, "device_mqtt_learned", info
+ learned_device = self.runtime_credentials.learn_device_mqtt_credentials(
+ username=username,
+ password=password,
+ )
+ return True, "device_mqtt_learned", info
+
return False, "invalid_mqtt_credentials", info
@classmethod |
Contributor
|
Hey @piotrkochan thank you for the PR. I ended up taking a different approach. Thank you so much for working through your issue and sharing a solution though! |
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.
My Saros 10R ignores bootstrap credentials from nc_prepare (don't know why...) and connects to MQTT using its own device credentials. The server rejects the connection because device_mqtt_usr is empty, and there's no way to identify it- record_mqtt_topic only runs after authentication succeeds.
This PR adds a fallback. When authentication returns unknown_device_mqtt_username, if exactly one device has an empty mqtt_usr and a non-empty did, it assigns the credentials from the CONNECT packet. It does nothing if there are 0 or 2 or more candidates.
I'm not sure this is the right approach, but it did unblock my setup.
Relates to #19.