Find Rest API URL of Apple thread border routers (Apple TV, Homepods)

Hi all,

how/where do I find the Rest API URL of an Apple TV? I would like to set one up as thread border router in Home Assistant via the thread integration. The config UI of thread integration displays automatically all my devices which qualify as border router, but the UI asks for the API URL.

Neither [devicename].local or the IP address work. What is the URL scheme? And where do I find the one of my devices?

Apparently I’m to stupid for finding it on google and this forum. Pls help! :slight_smile:

I found this reply from bing AI chat. I don’t have a Mac so i can’t try it:

To find the Rest API URL of an Apple TV to set it up as a Thread border router in Home Assistant via the Thread integration, you can follow these steps1:

  1. Open the Terminal app on your Mac.
  2. Type dns-sd -E and press Return.
  3. Look for your Apple TV in the list of devices that appears.
  4. Copy the URL that appears next to _thread._tcp. and paste it into the Thread integration configuration in Home Assistant.
1 Like

Thanks, but that’s not working.

I would assume, the command should be:

dns-sd -B _thread._tcp

Here is description from the man page:

 dns-sd -B type domain
    browse for instances of service type in domain.

    For valid types see http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml.  as
    described above. Omitting the domain or using "." means "pick a sensible default."

But it gives me an error as well, on macOS 13.4…

Hmm, just fetched ‘Discovery DNS-SD Browser’ from the App Store, and it shows me this. Could be helpfull:

1 Like

dns-sd -B _meshcop._udp

note down the instance name of TBR

run

dns-sd -L “instance name” _meshcop._udp

you should get “can be reached at somename.local.:someport”

1 Like

Thank you! That app is indeed helpful. I could spot thread devices there, which weren’t visible in another proprietary app from a device manufacturer.

However, I’m still not sure which URL to add in which format to Home Assistant to get a preferred network. I tried multiple variants now.

Thanks!

“dns-sd -B _meshcop._udp” gives me:

Browsing for _meshcop._udp
DATE: ---Sat 06 May 2023---
 8:44:46.727  ...STARTING...
Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
 8:44:46.728  Add        3   0 openthread.thread.home.arpa. _meshcop._udp.       MyHome268775874 (4)
 8:44:46.728  Add        3  11 local.               _meshcop._udp.       MyHome268775874
 8:44:46.728  Add        3  11 local.               _meshcop._udp.       MyHome268775874 (3)
 8:44:46.728  Add        3  11 local.               _meshcop._udp.       MyHome268775874 (2)
 8:44:46.728  Add        3  11 local.               _meshcop._udp.       MyHome268775874 (5)
 8:44:46.728  Add        2  11 local.               _meshcop._udp.       MyHome268775874 (4)

“dns-sd -L MyHome26877587 _meshcop._udp” then results in:

 8:51:00.315  Rmv        0   0 openthread.thread.home.arpa. _meshcop._udp.       MyHome268775874 (4)
 8:51:01.470  Add        2   0 openthread.thread.home.arpa. _meshcop._udp.       MyHome268775874

and not “can be reached at somename.local.:someport”

and “dns -sd -L openthread.thread.home.arpa. _meshcop._udp” does nothing. Not even an error.

I’m still confused

btw. … reason why I’m asking is to set up a preferred thread network. HASS seems to recognize my Apple TBR capable devices and lists them in “other networks”.

I assume this is done via the Homekit integration. Am I right?

However, I do also have TBR capable powerplugs (Eve Energy) that are integrated via Homekit in HASS, too and are listed in HASS devices UI with thread attributes. Why don’t they show up in the list above?

I can see them inside the discovery app UI (the 5 Eve Energy devices):

And I can control them via HASS and also get their energy consumption data into HASS.

Do I even need to set-up a preferred thread network in HASS? Is HASS using thread to connect with those devices or homekit protocol? I though this was built on thread since the most recent homekit updates.

Very confusing… :thinking:

Anyone able to help out a network-noob like me? :face_with_monocle:

2 Likes

I take it that we still don’t have a way to make the apple network our primary network?

2 Likes

I’m really disappointed there hasn’t been anyone to at least answer you, but no, I do not believe HomeKit will mesh with our HA thread network yet. There are ways to get the credential but you need a paid for developer account to technically access the apple API’s for it. You can get access to the downloadable profile to make details accessible but to get the actual DETAILS like the network key for it you need the entitlement from apple for the ability to actually get the pairing credentials. It’s a security thing partially but also a thing for apple to just get more money out of us (well, maybe) if I had the time to spare I would DEFINITELY do it, but I barely have the time these days to read through documentation AND get new things up and running. I do honestly wish there was more details added in HA Documentation that explain certain things LIKE THIS as well as plainly, not the vague stuff on it I read so they didn’t have to dig around for details related to it. For example it could just plainly give the status of joining home assistant thread border router with each smart home ecosystem. I understand it’s not always possible to make everything so thoroughly detailed but that would save so much time digging or asking the questions in this forum without any clear answers or a lack of anyone with a response. But I do know only google home gives a method so far that I know of for things like this. There may be ways but as of now it is a very very complicated thing to get. Apple won’t let non official HomeKit devices have the thread credentials as far as I know and can tell. So, hopefully things change in iOS 17. I really was surprised apple released thread 1.3 as soon as they did honestly but it made thread and matter finally workable with others smart home so lets hope the future has thread be more open on apples side as well as all smart home ecosystems. It would finally be so much easier and more options for all involved.

Also, HA may not be fully read to mesh with HomeKit but with the way things move with it, we will have something figured out to be possible. I am pretty sure with the amazing people here contributing and doing amazing things it will only be a matter of time. Home Assistant’s developers and contributors are making it so frickin awesome and have that goal in mind, and despite me not succeeding yet and finally just giving up a little until progress on it is farther along, I know someone will make it work. These developers doing work on everything all have it in the goal list, and will get it there. I have to remind myself this is a beta test version still, it doesn’t feel like it is and I forget that part so easily cause it works so well except my eve devices haha. It’s really good work and I appreciate that they do such good work I can’t even remember its in beta. :slight_smile:

1 Like

Also interested in getting news on this topic

Can you post a screenshot? Or alternatively let us know what the 'Integration" column says in HASS Devices/Entities table?

I have a feeling they’re only visible in HASS through an eve integration.

Those Eve devices are on the Thread Mesh network that is being operated by the Apple Border Routers. As of the nature of thread, those devices can then be reached on the local network via IP, which is how they are connected to Home Assistant into the standard Homekit integration. So:
Eve Device <-thread-> Apple Border Router <-WiFi/LAN-> Home Assistant

As for why the devices don’t show up in the Thread integration list? This list only shows border routers.

This topic can still be quite confusing, I get it :sweat_smile:

1 Like

Hi all, I’m seeing this in the Nanoleaf app on my iPhone running the latest dev beta of iOS 17. Can I do anything with the network key?

1 Like

Any updates on getting an Apple TV 4k (Latest) working as a “Preferred Network” in Home Assistant?

1 Like

This did indeed reveal the URL. But the integration fails to connect when I plug in the URL, with or without “http://” in front of it.

Yeah, I just got some Nanoleaf Essentials Matter bulbs and kind of feeling dumb trying to add them to Home Assistant. I have several Apple TV 4Ks, HomePods, HomePod minis, which I understand should all act as Thread Border Routers.

Indeed, they show up in the Thread integration:

But yeah having no luck trying to add them explicitly with “Add an OpenThread border routes”, tried using different variations of great-room-apple-tv.local:49154 for example.

I wasn’t sure if maybe they didn’t need to be explicitly added to the ‘preferred network’ (?), so I tried adding the bulb explicitly with the “Add Matter device” flow in the companion app, but that fails when trying to “connect” to the bulb.

At this point I’m wondering if this is a working configuration at all, and maybe the only immediate solution to get a Home Assistant Yellow?

Hi all!

I tried simply adding Thread devices to HA via HomePod mini using the Matter integration and it worked just fine! No need to add the HomePod mini as a TBR with Rest API. It just remains there under “Other Networks” but it works.

All I had to do is go to the Home Assistant APP on my phone, under devices, add matter device, scan the matter QR code on the device, you wait… and voila! I can see my devices only under the Matter integration only. They do NOT show up under the Thread integration.

Note: The devices I’m using are Nanoleaf Essentials Light Bulbs (Thread - Matter version).

1 Like

This is great, but I’m supercurious now about why this worked if the Apple device is a different Thread network