Add IP address support for commission_on_network#469
Merged
marcelveldt merged 3 commits intomainfrom Dec 21, 2023
Merged
Conversation
When using the Android Matter commissioning flow from the Home Assistant App (via CommissioningRequest), we get the passcode only, no QR code or manual pairing code (see CommissioningRequestMetadata documentation). This means there is no discriminator. In other words, the server will try to find a commissionable device, and use the pincode against the first one found. It seems that sometimes another device is announced to be commissionable at the same time, which obvisouly has another passcode, hence the commission fails quite quickly. The App shows "Something went wrong". This seems to be particularly common when using Thread: The Thread border router forwards and caches DNS-SD/mDNS service information about commissionable Thread devices with its SRP server service. The cache is up to 2h long. So when a communication breakdown happens after a particular device went into commission mode, this commissionable service entry lingers in the network for quite some time. Now if the OTBR sends this entry before the new/valid entry, the Matter Server tries to commission a device which is no longer responding. The CommissioningRequestMetadata have a way to get the device's IP address. This change extends commission_on_network WS endpoint to also take an IP address. The SDK CommissionIP service is used to commission the device. Note: CommissionIP is marked deprecated currently. This is mainly to prevent implementation which would ask users for IP addresses, which is not the intended way to implement commissioning. However, for this particular usecase the API seems very sensible and works as intended. Fixes: #463
MartinHjelmare
approved these changes
Dec 19, 2023
|
Really looking forward to seeing if this solves my commissioning issues with my Onvis S4 devices! |
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.
When using the Android Matter commissioning flow from the Home Assistant App (via CommissioningRequest), we get the passcode only, no QR code or manual pairing code (see CommissioningRequestMetadata documentation). This means there is no discriminator. In other words, the server will try to find a commissionable device, and use the pincode against the first one found.
It seems that sometimes another device is announced to be commissionable at the same time, which obvisouly has another passcode, hence the commission fails quite quickly. The App shows "Something went wrong".
This seems to be particularly common when using Thread: The Thread border router forwards and caches DNS-SD/mDNS service information about commissionable Thread devices with its SRP server service. The cache is up to 2h long. So when a communication breakdown happens after a particular device went into commission mode, this commissionable service entry lingers in the network for quite some time.
Now if the OTBR sends this entry before the new/valid entry, the Matter Server tries to commission a device which is no longer responding.
The CommissioningRequestMetadata have a way to get the device's IP address. This change extends commission_on_network WS endpoint to also take an IP address. The SDK CommissionIP service is used to commission the device.
Note: CommissionIP is marked deprecated currently. This is mainly to prevent implementation which would ask users for IP addresses, which is not the intended way to implement commissioning. However, for this particular usecase the API seems very sensible and works as intended.
Fixes: #463