Nanoleaf Essentials over Homekit Controller

Thanks for the fast response, I have tried with both a bulb and a strip both with the same error. I have 2 HomePod minis and 2 Apple TVs (with thread) and one Apple TV without thread. When trying to pair, one of my thread enabled hubs was the active hub. I am able to pair again to HomeKit after removing it from home app. Just not to HA. Don’t mind waiting just thought it’d be cool to add it now :slight_smile: thanks again.

I’m able to only get two of the six light strips to pair at a time. Homekit Controller does see them when they’re ready to pair, but upon adding the pairing code, I get the error that pairing has failed. I’ll try to post a full log output tonight.

Ok, here’s a recap on the alghoritm How to Connect Nanoleaf Essentials Led Strip to Home Assistant:

Before you start, make sure you have Homepod Mini or AppleTV 4K which Supports Thread technology AND your Homepod Mini/AppleTV are connected to Home Assistant (they show up as Apple TV, even if it’s Homepod Mini)

  1. Make sure your Nanoleaf Essentials Led Strip is Connected to HomeKit (Apple Home app). If not, connect it first.
  2. Verify that your Nanoleaf Essentials Led Strip is Connected to HomeKit (Apple Home) via Thread.
    You can check this via Nanoleaf App (Open App → Three dots in the right bottom corner → Thread Network. You should see your Nanoleaf Essentials Led Strip there)
  3. Remove Nanoleaf Essentials Led Strip from Homekit.
    Open HomeKit (Apple Home) app, locate Nanoleaf Essentials Led Strip you want to add to Home Assistant, click on it and go to setttings. Scroll to very bottom and click “Remove Device”
  4. Your Nanoleaf Essentials Led Strip should be auto-discovered.
  5. Now add your Nanoleaf Essentials Led Strip with HomeKit code
    Should be on the back of the device, in the box or hopefully saved in your HomePass app)

Thank you @smartmatic for the indication! Worked for me instantly.

Troubleshooting:

  • If the instruction did not work, reset your led strip, add to homekit and start the process again. Should work. And verify your Thread device is added to Home Assistant.
  • You might need to restart you Home Assistant. I’ve had some devices loosing connection, but was resolved after restart.
3 Likes

I got one light strip connected to home assistant ( I have a vizio tv that has the homekit controller and have ZERO homepod minis or apple tv 4ks) Anyways when I go to do my second one this is what I see

Config flow could not be loaded: Unknown error

This is after a factory reset (about 20 of them to be exact and a very annoyed wife I was messing with the beds headboard lights instead of watching tv with her lol)…any help?

@madisonjar I don’t think the TV is playing a role unless it has a Thread Border Router built in. Can you please restart HA, reproduce, and get some logs for us to look at? Unknown error is, unsurprisingly, not helpful :slight_smile: You can get the logs from Settings → System → Logs → Load Full Logs (at the bottom). Thanks!

Hey @lambdafunction !

I’m running into this error now, and tearing my hair out trying to figure out what’s happening. For what its worth, I have paired these with HomeKit with a Thread enabled AppleTV on the same VLAN as HomeAssistant. I then unpaired (but not reset) these devices.

Checking the logs, this is the error I have:

Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
return fut.result()
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/homeassistant/components/homekit_controller/config_flow.py", line 479, in async_step_pair
self.finish_pairing = await discovery.async_start_pairing(self.hkid)
File "/usr/lib/python3.10/site-packages/aiohomekit/controller/coap/discovery.py", line 57, in async_start_pairing
salt, srpB = await self.connection.do_pair_setup(
File "/usr/lib/python3.10/site-packages/aiohomekit/controller/coap/connection.py", line 283, in do_pair_setup
response = await asyncio.wait_for(
File "/usr/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError```

Hey @AnvilPaladin, it is likely to be an IPv6 issue w/ HA based on other reports we’ve seen. How do you run HA? HA OS, docker, …?

Let’s check a few commands, too:

  • ip -6 a
  • ip -6 r
  • ping6 Nanoleaf-A19-XXXX.local (it may be ping -6 instead of ping6 and the XXXX is the 4 alphanumeric ID of one of your Essentials bulbs)

You should have at least one IPv6 address (fe80:: link-local if not other ULA or public addresses) and a route to the Thread network’s prefix via the Thread Border Router’s link-local address.

Hey @lambdafunction !

Thanks for getting back so fast! I am able to get IPV6 addresses and quite a few at that running those commands.

As for how I’m running this, I am running this via Docker on an Unraid NAS server. Those commands were run via the command line in the docker container to confirm that it can see IPV6 addresses. It is configured to use the “host” network option as well.

Unfortunately, I tried to ping the Nanoleaf bulb (both one unpaired from HomeKit but not reset and one still paired to HomeKit) and neither were able to be resolved:

ping6: Nanoleaf-A19-XXXX.local: Name does not resolve

(XXXX is my 4 digit ID but changed for privacy’s sake)

Look for posts by @rahil in the big thread. Also Unraid, similar looking problem. This was the accepted solution: HomeKit Accessory Protocol (HAP) over CoAP/UDP (was: Nanoleaf Essentials bulb via Thread/CoAP) - #263 by rahil

1 Like

Hmmmm. I’ll keep searching that thread, but adding those values to sysctl.conf on my host machine and the docker container didn’t fix the issue for me. Do I need to switch the container to use br0 as the network instead of host?

edit: br0 didn’t fix the issue, seems I’m stuck :confused:

edit 2: figured out I was setting up the ping wrong, I am able to ping my bulbs/strips that are unpaired now that I have the correct ID being used :sweat_smile:

1 Like

@AnvilPaladin are you still unable to pair? Jc2k mentioned in the big thread that those sysctls could take ~30 minutes to kick in. Something to do with the RA interval maybe.

Hey @lambdafunction !

Sadly, no. I did throw my aiohomekit logger into debug mode and tried again and got these messages:

2022-12-07 14:18:11.553 DEBUG (MainThread) [aiohomekit.controller.ble.controller] Discovery for hkid XX:XX:XX:XX:XX:XX not found, waiting for advertisement with timeout: 30.0
2022-12-07 14:18:11.697 DEBUG (MainThread) [aiohomekit.controller.coap.connection] Pair setup 1/2 uri=coap://[fda8:XX:XX:XX:XX:XX:XX:XX]:5683/1
2022-12-07 14:18:11.697 DEBUG (MainThread) [aiohomekit.protocol] #1 ios -> accessory: send SRP start request
2022-12-07 14:18:11.697 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
6 (State): (1 bytes/<class 'bytearray'>) 0x01
0 (Method): (1 bytes/<class 'bytearray'>) 0x00
]
2022-12-07 14:18:27.698 WARNING (MainThread) [aiohomekit.controller.coap.connection] Pair setup 1/2 failed!
2022-12-07 14:18:27.701 ERROR (MainThread) [homeassistant.components.homekit_controller.config_flow] Pairing attempt failed with an unhandled exception
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
return fut.result()
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/homeassistant/components/homekit_controller/config_flow.py", line 479, in async_step_pair
self.finish_pairing = await discovery.async_start_pairing(self.hkid)
File "/usr/lib/python3.10/site-packages/aiohomekit/controller/coap/discovery.py", line 57, in async_start_pairing
salt, srpB = await self.connection.do_pair_setup(
File "/usr/lib/python3.10/site-packages/aiohomekit/controller/coap/connection.py", line 283, in do_pair_setup
response = await asyncio.wait_for(
File "/usr/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError

One thing I thought of just now is my Unraid server doesn’t have BLE hardware installed, could that be causing this problem? Or does it all happen over IP

@AnvilPaladin CoAP is over UDP. The Apple Home pair/unpair dance is to switch accessories from BLE to Thread (CoAP/UDP).

Are you running HA via Docker? Another user had to enable ipv6 for the Docker daemon.

@lambdafunction sadly no, things still seem broken. I can see the devices when I unpair, but can’t go any further in the setup process.

@AnvilPaladin in HA can you please go to Settings → System → Network and check if the Network Adapter has IPv6 addresses listed?

EDIT: it looks like there is a second place to find IP address info. It is hiding in the triple dot menu in Configure network interfaces:
image

Hey @lambdafunction !

Finally some good news! There are quite a few listed there. So it seems HA is definitely recognizing and using IPv6 for at least some integrations.

@AnvilPaladin hmm, let’s make sure HA can ping6 the IPv6 address of the bulb as seen in the “Pair setup 1/2” debug line. If that doesn’t work, take a look in the output of ip -6 r. There should be a fda8:XXXX:XXXX::/64 via fe80::XXXX:XXXX:XXXX:XXXX line.

EDIT: oh, you said you could do that earlier. I’m a little stumped if you can ping from HA but it can’t talk CoAP. We might have to do a tcpdump.

Hey @lambdafunction !

I’m happy to do whatever I can to help diagnose this! I was able to ping the IPv6 address but not the multicast (.local) address oddly enough. Still wasn’t able to set it up though :confused:

EDIT: did some more troubleshooting.

  • I was able to ping their .local address just fine using Windows 11
    • Also was able to ping their IPv6 address just fine
  • I was not able to ping their .local or IPv6 addresses via Unraid’s command line OR Docker’s
    • I was able to ping Cloudflare’s IPv6 DNS address & other local devices just fine
  • I was able to sniff some packets in promiscuous mode on my Windows machine, and I can see my Unraid machine doing some mDNS requests for the Nanoleafs, but pinging those addresses via Unraid won’t show up in Wireshark. Filtering by address of the bulbs only returns the pings from my Windows machine, and 0 from the NAS

@AnvilPaladin hmm can you please turn up debug on the HA zeroconf component? Maybe also homeassistant.components.homekit_controller. You can PM me the logs, if you prefer. Let’s see what HA thinks about mDNS.

1 Like

Sent those logs on over!