Connect thread devices to home assistant?

Hi all!

Wondering if anyone can point me in the right direction in setting up a thread network with Home Assistant (with the goal of configuring some matter-over-thread devices).

Basically I’ve configured a Thread Border Router through my AP, which shows up as an “other network” in the Thread module in Home Assistant. However, I’m unable to get credentials when I try to configure using the Home Assistant iOS companion app. And when I try to add a device through Home Assistant via Matter (specifically an Eve Energy) I get the “Thread Border Router Required.”

A little stuck, not sure if the AP just isn’t compatible with Home Assistant or if I have to dig around for some code to pass the credentials over. Not sure if the problem is thread device to Border Router or Border router to Home assistant.

Devices/config:

  • I have a Thread Border Router built into my AP (an AP5010).

-Trying to add an Eve Energy

-Running Home Assistant in a VM without Yellow or any built-in border router functionality since it’s on my AP

-Have the Matter (Beta) integration added

-Configuring the network, I’ve added a Network Key, PAN ID and a EXPAN ID (there’s also an option to configure a Thread Commissioner but not sure if that’s needed?)

Happy to share more info if helpful!

Did you set it as ‘preferred border router’ ?

1 Like

I tried - but when I use the app to try and pass credentials to Home Assistant it fails unfortunately

You can only pass credentials to Home Assistant if your phone (iOS or Android) has Thread credentials from somewhere (typically Google Border Routers or Apple Border Routers).

I am not familiar with that access point, but it might have an app which allows you to configure and import the credentials to your phone. If so, you can directly commission a Matter device then.

But if not, you need to find the Thread operational dataset somewhere in the web interface or console of your AP. It is a long hexadecimal string. If you have that you can import the Thread credentials to HA via the three dot menu on the top right and “Add dataset from TLV” operation. Once imported, you should be able to make the Thread network as preferred. And once the Thread network is preferred, you should be able to transfer the credentials to your phone and use it for Matter commissioning as described in the Thread integration docs.

1 Like

First off - thank you so much for your suggestions! I’ve been asking around a few different places and was getting basically nowhere (including from manufacturers) and I really appreciate your answer.

I had some amount of success adding the TLV dataset (I had to run this script How to configure preferred Thread network - #53 by Veldkornet) which allowed me to configure this as my preferred network (there’s also a button to “use for ios credentials” it looks like?)

However, when I go into the home assistant app, it asks me to pass credentials - and then fails. Strange! Any thoughts on what to try next?

Hm, how does it fail/what error message do you see?

We had the case previously that the Dataset TLV had some TLV’s which were unknown/not supported. That was on Android however. But maybe your dataset has some incompatible or missing TLV entries for iOS :thinking:

The compagnion app also has logs, it might have insights what went wrong.

Finally, you can also parse the TLV using this TLV parser. That gives you an idea what tags and values are part of your dataset.

Thanks so much! Here’s what I’ve looked at:

From the iOS companion app logs, I’m seeing:


2024-07-27 13:03:29.805 [Error] [main] [ThreadCredentialsManagementViewModel.swift:35] loadCredentials() > Failed to 'retrieveAllCredentials' from thread Apple Keychain with error: Error Domain=ThreadCredentialsStore Code=9 "No preferred network found" UserInfo={NSLocalizedDescription=No preferred network found}

When I export info from the thread diagnostics tab I get:

"custom_components": {},
  "integration_manifest": {
    "domain": "thread",
    "name": "Thread",
    "codeowners": [
      "home-assistant/core"
    ],
    "config_flow": true,
    "dependencies": [
      "zeroconf"
    ],
    "documentation": "https://www.home-assistant.io/integrations/thread",
    "integration_type": "service",
    "iot_class": "local_polling",
    "requirements": [
      "python-otbr-api==2.6.0",
      "pyroute2==0.7.5"
    ],
    "zeroconf": [
      "_meshcop._udp.local."
    ],
    "is_built_in": true
  },
  "setup_times": {
    "null": {
      "setup": 4.686799999831237e-05
    },
    "[[String here that I'm not sure if it should be private or not]]": {
      "config_entry_setup": 2.518000002282861e-06
    }
  },
  "data": {
    "networks": {
      "[[MY EX PAN ID]]": {
        "name": "Assistant",
        "routers": {
          "AH-0dc340.local.": {
            "server": "AH-0dc340.local.",
            "addresses": [
              "[[IP ADDRESS]]"
            ],
            "neighbours": {},
            "thread_version": "1.3.0",
            "model": "BorderRouter",
            "vendor": "OpenThread",
            "routes": {}
          }
        },
        "prefixes": [],
        "unexpected_routers": []
      }
    }
  }
}

And finally when I ran your script I got:

t:  0 (CHANNEL), l: 3, v: 0x00000f
t:  1 (PANID), l: 2, v: 0x[[My PAN ID]]
t:  2 (EXTPANID), l: 8, v: [[MY EX PAN ID]]
t:  3 (NETWORKNAME), l: 9, v: b'Assistant'
t:  4 (PSKC), l: 16, v: 0x[[MY PSKC -- I USED A SCRIPT TO DERIVE THIS FROM A FEW THINGS WHICH I CAN FIND IF HELPFUL]]
t:  5 (NETWORKKEY), l: 16, v: 0x[[My NETWORK KEY]]
t: 14 (ACTIVETIMESTAMP), l: 8, v: 0x0000000000030000

One thing not sure if it makes a difference or not but my devices has a “Thread Commissioner” GUI feature which I think I derived my PSKC from and then had to turn on to get the border router to show up in the first place.

And just to be clear I did the [[double brackets]] just at the start and end of where the network info was

Hey! So shot in the dark returning to this - I went a different direction and built an Open Thread Border Router on a pi with a nRF52840 and now all I need to do is just get rid of the misconfigured “preferred” network - any idea how to do that?

Closing this topic just to say finally got connected by setting up an Open Thread Border Router add-on with the nRF52840 dongle and grabbed the credentials and inputted them into the web gui for my original AP. Weirdly the Open Thread Border Router joined the existing network but when I turned the radio on my AP off it seemed to be using a different key, and I was able to finally pass credentials to my phone. Maybe I’ll try to switch the leader to my AP down the road but glad to get this going finally!

1 Like