Repository navigation
fix(mqtt): don't guess a DID that onboarding already paired - #166
Merged
Merged
Conversation
Follow-up to #165. The unique-model fallback could still map an unpaired DUID to a DID that runtime_credentials.json pairs with a different DUID (e.g. a replaced vacuum), so two DUIDs routed to one vacuum. Collect the learned pairs before the inventory loop and skip the fallback for DIDs they already claim. Also tolerate runtime_credentials.devices() raising, matching key_models_by_did(), and drop the --bridge-device-* hint from the drop warnings; that option no longer exists.
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.
Follow-up to #165 (issue #163).
Problem
#165 made the DID/DUID pairs learned during onboarding authoritative in the topic bridge's DUID->DID map. The older unique-model fallback still runs first, though, and it can map an unpaired DUID to a DID that
runtime_credentials.jsonalready pairs with a different DUID.Example: the inventory's only a168 isn't onboarded yet, and the only a168 DID with a known model belongs to another vacuum (for example, the one it replaced). On
mainthe map becomes:Commands for the unpaired vacuum are then sent to the other vacuum's topic instead of being dropped with the "no deterministic rr/d mapping" warning.
Fix
runtime_credentials.devices()as "no learned pairs", the same waykey_models_by_did()is handled just above it. Without this, an exception would drop the bridge's broker connection and send it through its reconnect loop.--bridge-device-*hint from the two drop warnings. That option no longer exists; the warning now says to onboard the vacuum.Testing
test_topic_bridge_model_fallback_does_not_reuse_did_learned_for_another_duid. It fails on currentmainand passes with this change.