ESPHome in Domotics: Configuring vs Programming

Like many among us, I no longer have a peaceful relationship with vacations: No longer just in August, good old times. So for a number of reasons that we’ll go into in future posts, I had the pleasure of taking a wonderful and in-depth excursion into a branch of home automation that I hadn’t been hanging out with for a while, but which is part of our Domotics 101 journey: ESPHome

What is ESPHome?

ESPHome is a system that allows programming ESP8266 and ESP32-based microcontrollers for use (but not limited to) with Home Assistant, a popular open source home automation platform (which we will inevitably spend more time on in the future). ESPHome offers an easy way to define and program these devices using configuration files in YAML.

ESPHome’s first commit was 5 years ago.. Which makes us think it was born in 2018, although I suspect the project originated within Home Assistant and its many plugi-ins. With Home Assistant it shares the bizarre – and in some ways complex – YAML syntax.

The need for ESPHome is related to two connected elements.

  1. The great popularity of ESP8266 and ESP32 chips. Both as rapid prototyping tools for Makers, and within home automation devices
  2. The need to target a broader audience of users than those who knew how to program (and thus use the Arduino core, that of Espressif or Micro-Python)

ESPHome was born for the N00bs (like me lol). Interestingly, Arduino was also born for the N00bs too, so it is probably a market direction: simplify and make it more accessible.

Configuring Vs Programming

On its homepage, the developers of ESPHome describe it as, “ESPHome is a system to control your ESP8266/ESP32s through simple but powerful configuration files and control them remotely through home automation systems.”

The main concept behind ESPHome is that you do not code / program the ESP8266 or ESP32 device, you edit / configure it. You sort out the recipe and then invoke / edit the pins connected to a component, such as a sensor. It is not necessary to declare the sensor, read / write its values in a loop, and process them.

Configuring is very different programming. It lowers the bar even further. With ESPHome, anyone can make home automation devices.

In sostanza, ESPHome crea codice C++ in base alla configurazione. Il processo รจ il seguente:

Having used various “code generators” or “configurators” in the past (one among all, TASMOTA), I was pleasantly surprised by the maturity of ESPHome compared to a few years ago. Now you can use it on its own (without Home Assistant) through its own dashboard. Beautiful videos by Csongor Varga about it. I embed one of them, but I highly recommend subscribing to the channel.

What are the benefits of this approach? embracing such a big community allows for many robust and functional features to be choose from:

  1. Many many many compatible boards (ESP8266 / ESP32)
  2. Works locally
  3. Automations on board
  4. OTA (programming Over The Air)
  5. Great Documentation

In short, a question comes up (perhaps only to me who has been teaching Arduino and the like for years): would it be possible to hold a Home Automation workshop using this type of board and creating custom sensors solely through the use of the ESPHome configuration language? Probably yes, of course it would be reductive to the students, who may be faced with more specific microcontroller-related needs tomorrow, but the tool is certainly mature enough that – for time reasons, for example – we could focus on more high-level automations (i.e. Node-RED or Home Assistant) without having to deal with Arduino, install cores, etc.

In closing, we wanted to promote a very interesting text that addresses these and other issues: Getting Started with ESPHome by Koen Vervloesem. The programming image is his, and the book is one of the few publications to take nothing for granted!

Leave a Reply

Your email address will not be published. Required fields are marked *