ESPHome is pretty neat

ESP8266 and ESP32 modules are pretty neat. They are a nice combination of cheap, featurefull, and usable and, ever since a Hackaday post in 2014, somehow gained a hacker community that enables a lot of really fun things.

Also, apparently if you peel apart your WiFi-enabled IoT devices, you might find an ESP in it.

You can get a breadboard-able module for a reasonable number of dollars (You can get them for prices as low as a dollar on AliExpress, but I generally get the AdaFruit modules so I know what I’m getting).

I’ve long wanted to do some lightweight home automation tasks. I don’t trust any of the popular Alexa/Siri/Etc. voice-related platforms because the folks behind Alexa spent a bunch of time talking about how Alexa wasn’t an always-on microphone, except that they’ve got a team of people who are listening to all sorts of audio from people’s houses. And most of the products are intended for people with palatial McMansion estates. And I don’t entirely trust how well or not-well a lot of people have done their devices either.

The leading platform for open-source self-hosted home automation at this point is Home Assistant. It supports all sorts of plumbing on all sides of the problem, has a community, and already supports a bunch of devices.

I’ve had a RaspberryPi with a Rainbow HAT that contains a temperature/pressure sensor for a while now. The problem I encountered is that a RaspberryPi 3 is hot and so the temperature sensor was inaccurate. I had some ds1624 temperature sensors so I hooked one of those up on a board that connects to the pins on the RainbowHAT’s side but even then it was too close and it still throws off the temperature reading.

But the big problem is plumbing. I set up Home Assistant on the NUC I use as my primary home Linux server and there’s no super-simple easy way to get the data out of the RainbowHAT on my Pi and easily pipe it into Home Assistant. Because the primary disk is a SD card and they tend to get scrambled easily, I prefer to treat my Pi’s as disposable and re-imagable so I have them managed by burning a boostrap image with PiBakery and then provisioning them with Ansible. So I was thinking “Gee, I should spend some time and get the temperature sensor going somewhere” but never really got around to it.

At the same time, what I really want is something that I can put outside. And, again, you can put a Pi outside and power it with solar cells and stuff, but the Pi 3 uses between 459 mA to 1.13 A and the Pi 4 uses between 600 mA and 1.25 A, so that’s a lot of battery and solar capacity just to keep the lights on. Thus, I already had an ESP8266 sitting in my electronics bin for eventual use and lately it felt like time to try it out.

You know, while I’m trying not to leave the house because I might get a deadly plague.

ESPHome promised to integrate with Home Assistant easily, plus it comes with pretty good documentation that explains all of the devices it’s supposed to work with, so I figured it was worth trying out.

I’m really impressed with the developer experience for an open source hackery project. The only hitch was that I needed to know where my USB port’s device was on my Linux server. (Apparently it’s /dev/ttyACM0 on my Linux box instead of /dev/ttyUSB0, which is probably something to do with more recent versions of Linux) Otherwise, I could use the provided Docker container in lieu of actually installing anything. There’s a set of CLI menu prompts to get at least a reasonable starting point where you can burn a set of firmware via USB.

The only hitch is that, because I’ve got a breakout without built-in USB, I have to trigger the reset button manually. Which I mostly knew about. But it has the handy feature of then tailing the serial port so you can watch the logging messages flow afterwards.

So, pretty much, the time from “I want to play with ESPHome” to “Oh, look, there’s ESPHome visible on Home Assistant with a sensor already wired in” was less than an hour.

Picture of my ESP8266 running ESPhome

That’s impressive. The way I see it, ESPHome’s audience is always going to have to be a certain level of technical. They could have decided that, since it’s for smart tinkering sorts of people, they could force you to Use The Source, Luke, but instead they put some pretty consistent effort into the docs.

And then, once you’ve burned the firmware the first time, you can do over-the-air updates. Which works exactly the same, except that you view the logs via network streaming instead. So, while it’s not quite as nice as using SSH to get a shell on a Pi, it’s close enough and has fewer things running.

I need to play with it some more. The real test comes when I want to do slightly more complicated things. So far, I’ve got a temperature/humidity sensor running and the data flows via Home Assistant to the Prometheus instance in my Kubernetes cluster. But the docs are inviting and I’m curious as to see how easy it is to slide some custom logic into the architecture.