How to: Setup an ESP32-H2 as Thread Router

I didn’t need to do anything special.
If you look at the documentation, the last paragraph describes this behavior. FTD devices will act as router and node, MTD only as node. FTD is the default.
The part of my config that you quoted might not even be needed for you, you can try without it first. See the second more basic config in my earlier post.

Cool, that sounds much easier than what I came up with :smile:

Hi,

i have only a homepod as thread border router. Is it possible that an H2 as end device would work via thread?

Yes I think it should work. The only tricky part will be how to get the network data from the Homepod. I am not very familiar with Thread/Matter and Homepod, I think if you have the Homepod setup in Home Assistant as your TBR, you can get the network data the same way I described above. Otherwise, it might be more tricky. I think you might have to follow these steps to make the Homepod device’s network your preferred network in Home Assistant first, at least to get the network credentials.

Yes, i can confirm that now. Made my first thread sensor. :slight_smile:

1 Like

I’m just starting on my thread journey and this thread was super helpful.
It would be nice to know the strength of the devices connection in the network, similar to LQI or RSSI for Zigbee / Wifi, but I guess you can’t have everything, unless someone knows a way ?

I also found this article that now makes the process of creating cheap thread routers even easier:-

I ended up buying these:-

They are esp32-h2 based devices with on board usb c so you can flash them directly via USB initially. One thing to note, these are 2MB flash only, so I had to do a little fiddling to get them to work and thought I’d share it here.

Out of the box, a basic esp home config as described here and else where will work, but you’ll run out of available memory if you include the ota, logger and api components. You can happily comment these out and they’ll still work just fine as thread routers, but if you want to get these component back, and maybe add some more head room then you will need a custom partition.

I’ve never done this before, so a bit of fiddling and chatgpt later and I have a working device.

Firsly this is the ephome yaml code:-

esphome:
  name: your_name_here
  friendly_name: Your Name

esp32:
  variant: ESP32H2
  flash_size: "2MB" 
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_ESPTOOLPY_FLASHFREQ_40M: "y"
  partitions: "files/esp32h2mini_partition.csv"


logger:

api:

ota:
- platform: esphome

network:
  enable_ipv6: true

openthread:
  device_type: FTD
  tlv: PUT YOURS IN HERE.

Note the reference to the partitions file. I made a sub folder under my esphome folder called ‘files’ and put it in there, you can put it in your esphome folder directly if you prefer.

This is a simple CSV file with the following contents, name it whatever you like, just make sure the file name and path matches in your yaml:-

# Name,   Type, SubType, Offset,  Size,
nvs,      data, nvs,     0x9000,  0x3000,
otadata,  data, ota,     0xC000,  0x2000,
app0,     app,  ota_0,   0x10000, 0x100000,
app1,     app,  ota_1,   0x110000, 0xF0000

I believe the header row isn’t required.

Now the esphome code will compile fine and give you some more headroom to add other sensors etc if you want to.

I’ve fully tested it, works great, ota works fine, sensors that I’ve added, all work fine.