Announcement ESPHome running on Adafruit 52840 over Thread mesh networking using ZephyrRTOS

Really sorry for the long delay on this, it’s not dead, just stalled. Life has thrown me a few curve ball s the past few months and I am just recently getting back to state where I have free time and mental energy to devote to any extra programming a day. In about two weeks I should be cleared up to start cleaning up all the code, making it work against current master, and start a discussion on this.

The good news is the nodes I had setup have been working great all this time!

6 Likes

UPDATE:

Recently I was doing something for work, and was annoyed that some project I was watch had not had any activity in such a long time, and then I realized I was probably that guy for someone else. So I’m sorry about that.

Its been a busy year since the initial post, and several months since my last post. On the home assistant front I got my yellow kit, and migrated everything to that. Unfortunately that impacted running the thread network border router. That gave me the push to get back around to this so my devices could start working again. After many false starts I finally buckled down and rebased against the latest esphome, and made some fixes to update to newer zephyr apis.

The good news is that everything seems to be working, and there is a developer that is working on building a border router addon, that makes things significantly easier to install. The bad news comes in the word seems. The border router addon seems to not support the service resolution protocol needed to support mDNS discovery of things on the thread network. ESPHome really relies on being able to talk to homeassistant this way, so it needs to be resolved.

More good news is that on the zephyr front changes that were needed for this project (related to storage partitions) are now in the main line, and the boards all run off vanilla distributions. They maintain a docker container will all the required built tools already installed. It should make it easier to build from that container and put my project on top of it, making it closer to a one click install and develop experience that people are used to from esphome now.

My next steps are going to be:

  • Poke at the addon Dockerfile and see if I can convince it to support SRP (and relearn docker, it has been about 8 years since I did much with it)
  • start contacting people on discord to drum up interest in this to see about getting help developing and upstreaming this
  • See if the addon developer is on discord to see if they would be willing to change the Openthread addon to support what is needed.

If anyone is in contact with the esphome / homeassistant dev team or is in some other way interested in helping please shoot me a message.

I tagged this a bit ago to keep an eye on, so thanks for the update! The OTBR add-on is being worked on by Stefan at Nabu Casa as far as I know. Their focus is definitely Matter compatibility, he is falstaff321 on HA Discord. Would also think just raising an issue on the addon-repo too as a means of engaging them.

@tube0013 thanks for the info, I’ll hit them up there.

I should also note that until I can confirm that everything does indeed run correctly, all the updates have been made on the zephyr-rebased branch.

1 Like

To aid in working with the ESPHome team, development on this project has been moved to this repo / branch

Current state of things:

  • Things are updated and working (at least as of a week or so ago)
  • I have been in initial contact with some ESPHome devs. In the first little bit of the new year I am going to work with them to explain what I done, and talk about the next steps.
  • I am going to create a docker image that hopefully will make it easier for people to play around with.
  • The big thing I want to tacking is an overhaul to the scheduler / app loop to take advantage of zephyrs primitives. This should make things much more power efficient.
  • New Board: I got some new boards from Seeed studios I am going to make work, they are awesome little things that pack in a lot.
  • Preferences component. I want to get this working with the zephyr stack for storing values persistently
1 Like

Hello Nate.

I have two nrf52840 dongles. How can I proceed to use them with your work?

Hey, sorry I have not checked in on this thread in a few days. I don’t have time to type a full response now, but I did want to let you know I saw it and will get a full response soon. This will give me a kick in the pants to get it all documented and or streamlined too.

A quick question to make formulating the answer a bit easier, what device are you running HA on now? Do you already have a thread radio (like on a home assistant yellow device) or are you planning on using one of your devices for the radio?

Hi Nate. Thanks for your considered reply. No urgency here.

I run HA on three Pi4s and two Lenovo M93s in various locations. All of them run Debian. My installations are Supervised and supported. I have an OTBR add-on currently running properly on an M93 using one of my two dongles. I ran a second OTBR on a pi4 using my second dongle, and successfully tested the join function. I would like to use your code (or something easy to flash) to create a Thread end-device with my second dongle to test commissioning and HA’s reaction. Or, I could just buy a Thread enabled device (that I don’t need for any other purpose). I have dozens of ESPhome devices active in my home, so your code is very interesting to me. Also run Sonoff RF and Zigbee gateways using Tasmota.

How may I help?

I certainly hope this gets worked into the main ESPHome project at some point, because it’s exactly the sort of thing I’m wanting to see come about. With several of the ESP32 MCUs supporting Thread, having a way to build Matter devices using ESPHome would be incredibly useful.

To update you on the timeline, I hope to get something out tomorrow or the weekend. I am just finishing up support for flashing more boards without a debugger probe and just need to find time to finalize tests.

I am talking with the ESPHome people who seem receptive to the idea, but it is a lot of work on their and my part to get it integrated, even in a experimental capacity, and they have their existing planned work as well. It may help if more people showed their interest in this being integrated to move it up the priority list, but I don’t know the best forum to do that.

Thank you, Nate, for the update.
You are making a huge contribution to both ESPhome and HA.

This is really really impressive and I first want to say “I’m interested” and second, ask how the eink battery-powered display went – has power consumption over thread been sufficiently low to get a decent amount of runtime out of it?

I’m very experienced with higher-level software but very inexperienced here, but I’m happy to get a couple boards (do you still recommend the ones you had originally?) to learn and hack around and hopefully help contribute a bit.

Hi Nate. Anything new here?

Sorry for the delay, there have been many personal things that have cropped up.

Update is basically there was a regression introduced upstream. I am attempting to work around them now, without going to directly modify upstream. If I can’t get a resolution soon, I will just make a temporary patch file and add it to the install instructions. It really is a silly include issue, and its frustrating it is still hanging around.

I did finish flashing support for the adafruit feather without a debugger though, so that is nice. I’ll try to get this resolved asap, as I work tough an install script. If not done by the time I am done with that I’ll put the patch in.

1 Like

Thanks again, NateLust, for the update and your efforts.

I managed to resolve everything, and am working on an installation script now. Would you prefer a shell script, or a docker container?

Docker would be my preference! You mean a dockerfile right? Or would this be an image on docker hub

Congrats, NateLust. I prefer a shell script, but will be pleased with whatever you provide.