Adding a thread device

Hi,
I tried multiprotocol a while back and it badly affected my Zigbee network performance (HA Yellow with 124 devices), so I turned it off and decided to control matter devices to Apple Home instead.

Just fitted a top-down, bottom up shade that uses Matter on Thread. Connected to Apple Home without problem.

Can I connect that device to HA via Home? The HA Add Device > Matter > Already In Use > Home option just times out - it did not warn that multiprotocol is not active, but I assume it’s only looking on the WiFi network.

Are there other ways for Home Assistant to control this Home device ? Is multiprotocol stable now?

When commissioning a device already commissioned to a thread border router, then you need a QR code or other code from that thread border router.
The one on the device will only work for first pairing on a factory reset device.

I tried that several times - Apple Home App > device settings > turn on pairing mode > copy code and then I select add device in HA but it does nothing. I’m still wondering if HA also needs thread or if it hands off the request to the Apple TV.

If you haven’t already looked at this, here are the instructions for adding a device already on Apple to HA.

Matter Server on HA should not require Thread on HA if you have an Apple Thread network, in fact it is preferred (for now) to only use Apple/Google Thread network.

Regarding Multiprotocol, the development on it has been put on hold, and may not be picked up again, so in your case, I would remove it.

2 Likes

If you try to add a device that is already paired, then it sound like you are trying to work with thread networks and then you need thread in HA.
If you want to just integrate the Apple thread border router as a hub device, then you might need to do it different.

This is just a guess on the referenced text and the wording of this.
I do not have any Apple products, so I can not say for sure though.

Hi @WallyR ,
the device is a thread blind that is currently connected to Apple Home. In HA’ Thread integration I can see Apple Home

No idea what the MyHome18… network is about though.

Steve

For what I can see, Home Assistant is still on the old Thread Network (that you are no longer using?).

If I understand things correctly, you must use the Companion app on an IOS device to import the credentials from the Thread network that Apple created. Then Home Assistant is on the same Thread Network, and can use the devices communicating over it.

Doing so will lose connection to devices on the old Thread network you created though, I assume you have removed those already.

My recommendation would be to first try and add the Blind to HA with the Blind only on the Apple Thread network. Once you have accomplished that, then you can “play” around with the HA OTBR Thread network and try to merge it with the Apple Thread network.

OK, it’s the weekend and time to try again.

So I checked HA and have just one Matter device - a Meross WiFi plug. So I removed the device, then removed the Thread and Matter integrations.

Then I re-added the Matter and Thread integrations.

Immediately the previous matter networks and device were there!
The Meross WiFi plug and the thread neworks:

I used the integration > delete option to remove both of these.

Anyway, back to the SmartBlind to see if this made any difference. The SmartWings Blind was already added to Apple Home, so I went into Home > Device Settings > Turn On Pairing Mode and following several attempts it reported Could Not Complete Operation OK.

I suspected this was because the blind was too remote from the Apple TV, so I dismounted the blind and moved it closer to the TV and the pairing code was immediately displayed. But every attempt to use that code in HA resulted in the same failed to add device message from HA.

The Matter Server log:

2024-05-25 10:04:19.348 (MainThread) INFO [matter_server.server.device_controller] Starting Matter commissioning with code using Node ID 19 (attempt 1/3).
2024-05-25 10:04:48.252 (Dummy-2) CHIP_ERROR [chip.native.EM] Failed to Send CHIP MessageCounter:125688233 on exchange 11064i with Node: <0000000000000000, 0> sendCount: 4 max retries: 4
2024-05-25 10:04:49.354 (Dummy-2) CHIP_ERROR [chip.native.CTL] Discovery timed out
2024-05-25 10:04:56.587 (Dummy-2) CHIP_ERROR [chip.native.SC] PASESession timed out while waiting for a response from the peer. Expected message type was 33
2024-05-25 10:04:56.588 (Dummy-2) CHIP_ERROR [chip.native.ZCL] Secure Pairing Failed
2024-05-25 10:04:56.589 (Dummy-2) WARNING [root] Failed to establish secure session to device: src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp:89: CHIP Error 0x00000003: Incorrect state
2024-05-25 10:04:56.589 (Dummy-2) WARNING [root] Failed to commission: src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp:89: CHIP Error 0x00000003: Incorrect state
2024-05-25 10:05:01.593 (MainThread) INFO [matter_server.server.device_controller] Starting Matter commissioning with code using Node ID 19 (attempt 2/3).
2024-05-25 10:05:30.440 (Dummy-2) CHIP_ERROR [chip.native.EM] Failed to Send CHIP MessageCounter:125688234 on exchange 11065i with Node: <0000000000000000, 0> sendCount: 4 max retries: 4
2024-05-25 10:05:31.601 (Dummy-2) CHIP_ERROR [chip.native.CTL] Discovery timed out
2024-05-25 10:05:38.789 (Dummy-2) CHIP_ERROR [chip.native.SC] PASESession timed out while waiting for a response from the peer. Expected message type was 33
2024-05-25 10:05:38.790 (Dummy-2) CHIP_ERROR [chip.native.ZCL] Secure Pairing Failed
2024-05-25 10:05:38.791 (Dummy-2) WARNING [root] Failed to establish secure session to device: src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp:89: CHIP Error 0x00000003: Incorrect state
2024-05-25 10:05:38.791 (Dummy-2) WARNING [root] Failed to commission: src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp:89: CHIP Error 0x00000003: Incorrect state
2024-05-25 10:05:43.794 (MainThread) INFO [matter_server.server.device_controller] Starting Matter commissioning with code using Node ID 19 (attempt 3/3).
2024-05-25 10:06:13.801 (Dummy-2) CHIP_ERROR [chip.native.CTL] Discovery timed out
2024-05-25 10:06:14.176 (Dummy-2) CHIP_ERROR [chip.native.EM] Failed to Send CHIP MessageCounter:125688235 on exchange 11066i with Node: <0000000000000000, 0> sendCount: 4 max retries: 4
2024-05-25 10:06:20.963 (Dummy-2) CHIP_ERROR [chip.native.SC] PASESession timed out while waiting for a response from the peer. Expected message type was 33
2024-05-25 10:06:20.964 (Dummy-2) CHIP_ERROR [chip.native.ZCL] Secure Pairing Failed
2024-05-25 10:06:20.965 (Dummy-2) WARNING [root] Failed to establish secure session to device: src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp:89: CHIP Error 0x00000003: Incorrect state
2024-05-25 10:06:20.965 (Dummy-2) WARNING [root] Failed to commission: src/controller/python/ChipDeviceController-ScriptDevicePairingDelegate.cpp:89: CHIP Error 0x00000003: Incorrect state
2024-05-25 10:06:20.967 (MainThread) ERROR [matter_server.server.client_handler] [547542435216] Error while handling: commission_with_code: Commission with code failed for node 19.

I need to buy a device to act as a Thread network extender and add that to Apple Home and I still need to clean up the HA Matter config to properly start over.

I think “commission_with_code” is for a new device that is not already on the network.
In HA, how did you do the “Add Device”?

I added the blinds to Apple Home by scanning the QR code on the label.

Steve

Did theses instructions for adding a Matter device to HA that was already on Apple to HA not work?

Yes, exactly that - devices > add matter device > already paired with Apple Home > get the pairing code from Apple and it gives the error log as shown earlier.

If there any sort of clean up needed in addition to deleting and reinstalling the Matter and Thread Integrations?

I went back and looked at the Matter Server code, and they did change the API call where “commission with code” should indeed handle the case of a device already on the network.

The other possible clue in the logs is “Discovery timed out”.
My understanding is that when commissioning a device on a second Matter fabric and that device is already commissioned an on another network/Matter-fabric, that only DNS-SD can be used to discover a device. A DNS-SD for _matterc._udp is sent out and the second Matter (HA) fabric controller listens for this when going through commissioning. For a Thread Network, the TBR proxies this for the actual device, so in your case the Apple TBR should be sending the DNS-SD out and Matter Server on HA should be seeing this. If you have the Apple TBR and HA on the same Layer2 network and IPv6 is enabled (set to automatic) on HA, then there is some problem I’m afraid I don’t have much of a clue as to why Discovery is failing.

You might be on to something there. The Apple TV and the HomeAssistant are on different VLANS (on Ubiquiti). I’ll check the settings tomorrow to see if some additional config is needed.

regards
Steve

Its best to put them on the same VLAN. There are a few HA community threads using some kind of mDNS reflector/proxy on their Home G/W router so that mDNS will cross VLANs, but whether this works on Ubiquiti and if it does, will it work for IPv6, yeah you’ll have to research out.

First time looking at Thread networking etc, but after some googling I used the dns-sd command to do some tests.

I have two Macs, one on the main vlan and one now on the IOT vlan.

To monitor for AirTunes (Remote Audio Output Protocol)
dns-sd -B _raop._tcp

IOT Vlan:

9:39:13.058  Add        2   0 openthread.thread.home.arpa. _raop._tcp.          A851AB121788@Living Room
 9:39:27.600  Rmv        1  11 local.               _raop._tcp.          949F3ED8EBEE@Living Room
 9:39:27.600  Rmv        1  11 local.               _raop._tcp.          C43875001E14@Move
 9:39:27.600  Rmv        1  11 local.               _raop._tcp.          6C7E67BBF25E@Steve’s MacBook Pro (5)
 9:39:27.600  Rmv        0  11 local.               _raop._tcp.          A851AB121788@Living Room
 9:39:46.328  Add        3  11 local.               _raop._tcp.          949F3ED8EBEE@Living Room
 9:39:46.328  Add        3  11 local.               _raop._tcp.          6C7E67BBF25E@Steve’s MacBook Pro (5)
 9:39:46.328  Add        2  11 local.               _raop._tcp.          C43875001E14@Move
 9:39:46.424  Add        2  11 local.               _raop._tcp.          A851AB121788@Living Room

and on the general VLAN

dns-sd -B _raop._tcp
Browsing for _raop._tcp
DATE: ---Sun 26 May 2024---
 9:39:08.509  ...STARTING...
Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
 9:39:08.511  Add        3   0 openthread.thread.home.arpa. _raop._tcp.          A851AB121788@Living Room
 9:39:08.511  Add        3  14 local.               _raop._tcp.          6C7E67BBF25E@Steve’s MacBook Pro (5)
 9:39:08.511  Add        3   1 local.               _raop._tcp.          6C7E67BBF25E@Steve’s MacBook Pro (5)
 9:39:08.511  Add        3  15 local.               _raop._tcp.          A477F304B821@SkarvaMac (2)
 9:39:08.511  Add        3  15 local.               _raop._tcp.          949F3ED8EBEE@Living Room
 9:39:08.511  Add        3  15 local.               _raop._tcp.          6C7E67BBF25E@Steve’s MacBook Pro (5)
 9:39:08.511  Add        3  15 local.               _raop._tcp.          A851AB121788@Living Room
 9:39:08.511  Add        2  15 local.               _raop._tcp.          C43875001E14@Move

Now trying the _matterc._udp protocol. Start the dns-sd command and then go to the device properties in Apple Home and Turn On Pairing Mode

IOT VLAN (HA is connected here)

dns-sd -B _matterc._tcp
Browsing for _matterc._tcp
DATE: ---Sun 26 May 2024---
 9:40:19.048  ...STARTING...

the messages are not getting through, whereas they are seen on the originating network.

General VLAN (Apple TV is connected here)

dns-sd -B _matterc._udp
Browsing for _matterc._udp
DATE: ---Sun 26 May 2024---
 9:40:20.508  ...STARTING...
Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
 9:40:33.390  Add        2  15 local.               _matterc._udp.       CB854B5D620296BF
 9:45:33.787  Rmv        0  15 local.               _matterc._udp.       CB854B5D620296BF

Its a bit of a guess, but probably the IPv4 DNS-SD is getting across but not the IPv6 DNS-SD (which is the matterc._udp)

I made a typo - on one side I had matter.tcp not udp.
After that the results are the same on both VLANS. And no change the logged messages in the matter server log.

Maybe next, from HA (on IoT VLAN) try pinging a device on the “General VLAN” using name.local to see if it gets across along with a response back.