home-assistant-libs / python-matter-server

Python server to interact with Matter
Apache License 2.0
401 stars 64 forks source link

Pairing Nanoleaf Essentials bulb failed #292

Closed weinshel closed 1 year ago

weinshel commented 1 year ago

I attempted to pair a Nanoleaf Essentials A19 bulb. The bulb is currently paired with HomeKit, I copied the setup code from the Apple Home app, then attempted to pair with the Home Assistant iOS app.

Note that I have IPv6 disabled (temporary troubleshooting step for https://github.com/home-assistant-libs/python-matter-server/issues/284)

Matter server logs:

023-05-15 10:05:56 core-matter-server PersistentStorage[125] INFO Committing...
2023-05-15 10:05:56 core-matter-server chip.DL[125] ERROR Long dispatch time: 199 ms, for event type 2
2023-05-15 10:05:56 core-matter-server matter_server.server.vendor_info[125] INFO Loading vendor info from storage.
2023-05-15 10:05:56 core-matter-server matter_server.server.vendor_info[125] INFO Loaded 64 vendors from storage.
2023-05-15 10:05:56 core-matter-server matter_server.server.vendor_info[125] INFO Fetching the latest vendor info from DCL.
2023-05-15 10:05:56 core-matter-server matter_server.server.vendor_info[125] INFO Fetched 64 vendors from DCL.
2023-05-15 10:05:56 core-matter-server matter_server.server.vendor_info[125] INFO Saving vendor info to storage.
2023-05-15 10:19:35 core-matter-server matter_server.server.helpers.paa_certificates[125] INFO Fetching the latest PAA root certificates from DCL.
2023-05-15 10:19:35 core-matter-server matter_server.server.helpers.paa_certificates[125] INFO Fetched 0 PAA root certificates from DCL.
2023-05-15 10:19:35 core-matter-server matter_server.server.helpers.paa_certificates[125] INFO Fetching the latest PAA root certificates from Git.
2023-05-15 10:19:35 core-matter-server matter_server.server.helpers.paa_certificates[125] INFO Fetched 0 PAA root certificates from Git.
2023-05-15 10:19:35 core-matter-server chip.CTL[125] INFO Setting attestation nonce to random value
2023-05-15 10:19:35 core-matter-server chip.CTL[125] INFO Setting CSR nonce to random value
2023-05-15 10:19:35 core-matter-server chip.CTL[125] INFO Starting commissioning discovery over BLE
2023-05-15 10:19:35 core-matter-server chip.CTL[125] INFO Starting commissioning discovery over DNS-SD
2023-05-15 10:19:35 core-matter-server chip.BLE[125] INFO BLE removing known devices.
2023-05-15 10:19:35 core-matter-server chip.BLE[125] INFO BLE initiating scan.
2023-05-15 10:19:35 core-matter-server chip.DL[125] ERROR Long dispatch time: 173 ms, for event type 2
2023-05-15 10:19:45 core-matter-server chip.CTL[125] ERROR Commissioning discovery over BLE failed: ../src/platform/Linux/BLEManagerImpl.cpp:814: CHIP Error 0x00000032: Timeout
2023-05-15 10:19:45 core-matter-server chip.-[125] ERROR ../src/platform/Linux/BLEManagerImpl.cpp:814: CHIP Error 0x00000032: Timeout at ../src/controller/SetUpCodePairer.cpp:299
2023-05-15 10:20:05 core-matter-server chip.CTL[125] ERROR Discovery timed out
2023-05-15 10:20:06 core-matter-server chip.DIS[125] ERROR Timeout waiting for mDNS resolution.
djandrew2005 commented 1 year ago

My logs are here: home-assistant/addons#3050

I have problems with device pairing too. I use Nest Hub 2nd Gen and all devices (Eve Door) work perfectly with Google home but I can't add them to Apple home because they become unresponsive. Same with home assistant. I have ipv6 enabled. I get 10/10 on ipv6 test. I run HA OS on vm.

Device appeared unresponsive with add-on version 4.3.0 and prior

With 4.3.1 I can't even start the commission process because I get "failed to connect to matter server" errorimage

marcelveldt commented 1 year ago

@weinshel you'll have to enable IPv6 again, without it you will not be able to commisison devices.

@djandrew2005 please don't hijack a thread/issue. Create a new issue if you have another issue.

hidaris commented 1 year ago

@weinshel According to the log you provided, the reason for the failure here is related to Bluetooth.

marcelveldt commented 1 year ago

No this is clearly discovery failing due to IPv6 disabled. You can ignore the log about bluetooth (the sdk always tries bluetooth first, even if it does not make sense). This is the relevant log line: 'Timeout waiting for mDNS resolution.`

ArturoGuerra commented 1 year ago

This is probably the same issue I've encountered with the Nanoleaf lights, it seems they fail to advertise themselves when Apple uses their internal management fabric to put them in commissioning mode. The only way I found to consistently commission them is to manually send the pairing code to the matter server bypassing Apple's stuff entirely.

marcelveldt commented 1 year ago

Well, using the server itself for commissioning is a NO GO because; a) The server might not even have a bluetooth adapter or if it has not nearby the device that needs to be commissioned. b) using bluetooth of the server interferes with the HA bluetooth integration

So it must/should work from the apple (or android) app but keep in mind that;

We've heard reports of people that were able to enroll them so it should work but make sure that everything is in the happy flow, meaning disable any VLAN's you may have, disable multicast filtering on WiFi, disable IGMP snooping, disable multicast forwarding, everything that could potentially do something with multicast traffic. Also it helps to restart any ATV or homepod devices.

hidaris commented 1 year ago

If the issue persists after ensuring IPv6 is functioning properly, more detailed logs may be needed to confirm the problem.

hidaris commented 1 year ago

This is probably the same issue I've encountered with the Nanoleaf lights, it seems they fail to advertise themselves when Apple uses their internal management fabric to put them in commissioning mode. The only way I found to consistently commission them is to manually send the pairing code to the matter server bypassing Apple's stuff entirely.

Which version of iOS are you using? We did encounter some issues during debugging with Apple in a previous minor release.

weinshel commented 1 year ago

I was able to pair the Nanoleaf essentials bulbs after resolving the IPv6 issues, and also a few reboots and retries.

For one bulb I was able to pair on the second try copying the code from the Apple Home app. The other one worked after factory reset, pair to HomeKit, copy code from home app, pair to home assistant. Was using the iOS 16.5 release candidate.

ArturoGuerra commented 1 year ago

@weinshel there was an update for the nanoleaf bulb it might have fixed the pairing issue

marcelveldt commented 1 year ago

Closing here as the original issue has been reported as resolved.