Skip to content

Add IP address support for commission_on_network#469

Merged
marcelveldt merged 3 commits intomainfrom
add-ip-addr-support-for-commission-on-network
Dec 21, 2023
Merged

Add IP address support for commission_on_network#469
marcelveldt merged 3 commits intomainfrom
add-ip-addr-support-for-commission-on-network

Conversation

@agners
Copy link
Copy Markdown
Collaborator

@agners agners commented Dec 18, 2023

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

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
@agners agners added new-feature New feature or request bugfix Pull request that fixes a (known) issue/bug labels Dec 18, 2023
@satmandu
Copy link
Copy Markdown

Really looking forward to seeing if this solves my commissioning issues with my Onvis S4 devices!

@marcelveldt marcelveldt merged commit 839c034 into main Dec 21, 2023
@marcelveldt marcelveldt deleted the add-ip-addr-support-for-commission-on-network branch December 21, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes a (known) issue/bug new-feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Something went wrong" when commissioning through Android app

4 participants