Esphomelib - A comprehensive solution for using ESPs with Home Assistant



I am using Esphomelib with a variety of scope in my current setup and I can only thanks Otto for the great job creating something extremely easy and fast to setup even for someone who has limited HW/SW skills and not much time available to dedicate.

Currently I am looking to build a NodeMCU ESP32 based project with 7 light sensor: aim is to stick these sensors to an external water pump controller to report pump/alarm status (i.e. there are 7 big lights on the controller I would like to know when they are on or off).

Esphomelib integrates support for TCS34725 which is an RGB light sensor (a bit of overkill for my setup) but cheap enough.
I was wondering if I could (and how) wire 7 of them to a single NodeMCU ESP32 board or should I think to something simpler like a photoresistor?
in the latter case it is not clear to me how to setup, with esphomelib, the acquisition of a photoresistor (while I found different tutorial about how to wire it)

Can anyone provide some advice?


Solved the wifi issue specifying Arduino version

arduino_version: 2.4.0

Hope that @OttoWinter can answer on the second question



So I have the Olimex POE board working and can update OTA but the board is using the WiFi interface rather than the now available wired interface. How might I switch it to wired ? I’d hoped I might be able to not add the wifi part in the YAML.

I found this info on the Olimex Forum
and the next post just seems to add a couple of #defines which looks fairly simple but I don’t know quite where I can put this in Esphomelib and indeed to make it switchable between WiFi and wired , perhaps by a network/wifi section in the YAML ?

To get the Arduino library working, just add these #defines before your #include <eth.h>:

#define ETH_PHY_POWER 12


It’s in the wiki


I want to be able to read mqtt messages from has, I understand that that is a given, but at the same time to send fast UDP packets to other esp . Is that possible ?


Could you provide a link? I haven’t been able to find anything stating how to use an active low relay with esphomelib or esphomeyaml.



@OttoWinter do you have in the roadmap to be able to render ha type templates in service and data calls to ha ?

Example for a simple click to turn on (not toggle) if is off the smart light at full brightness. Then turn off if is on with the same simple click.

Use a fast double click to force the relay toggle inside esphomelib. Use the long press to reduce brightness for the same smart light if is on. This last I can do in nodered.

If I use service_template or data_template in homeassistant.service esphomeyaml validation doesn’t pass


Yes data_template is supported, see the documentation. Even the example there includes data_template.


Sorry i didn’t see that, data_template is there, service_template is not.

  [service_template] is an invalid option for [1].


Anyway to circumvent this we can use a script entity.
@OttoWinter is it possible to fetch from lambdas the time a binary sensor has been on? I want the long press time to be passed as an argument to the ha call


If you are still interested in adding support for RC522 I have seen lately in this project:
Which btw seems good to be used standalone for these RFID things…that regarding the stability of the library you should lock MFRC522 library to version 1.4.1. I think you could find which lib he uses from this project.


Yes I have seen the library and tried to do something similar in ESPHome, however after a while I found out that the library had horrible documentation and converting it to the ESPHome code-style and abstractions would be a lot of work (see esphomelib repo and search for RC522)

Not directly, no. The reason is efficiency, the mentality behind ESPHome is “if you don’t use a feature, don’t include it in the binary”. And adding such a feature to a core component would of course make each binary sensor a bit bigger.

I think though it’s not too hard to implement it with a lambda in your case.


I’ve already implemented something in node-red, I catch the single or long click, the double one is reserved for internal relay toggle in the esp.


can someone recommend the best vendor / variant of the esp32 and esp8266 to buy from aliexpress / banggood / gearbest, I’ve had a lot of problems with low quality chips and troubleshooting problems that might just relate to shitty chips. I can’t order from US sites.


This is one I bought a while back and has been working perfectly as a LED strip controller using ESPhome for some time now


The most reliable I’ve had so far is the wemos d1 mini pro.



I have been using Hassbian for about 3 years now, not, and I am having issues getting ESPHome installed.

[email protected]:~ $ pip install esphomeyaml
Looking in indexes:,
Collecting esphomeyaml
Downloading (518kB)
100% |████████████████████████████████| 522kB 256kB/s
Requirement already satisfied: colorlog>=3.1.2 in /usr/local/lib/python3.5/dist-packages (from esphomeyaml) (3.1.4)
Requirement already satisfied: pyyaml>=3.12 in /usr/local/lib/python3.5/dist-packages (from esphomeyaml) (3.13)
Requirement already satisfied: tornado>=5.0.0 in /usr/local/lib/python3.5/dist-packages (from esphomeyaml) (5.1.1)
Requirement already satisfied: paho-mqtt>=1.3.1 in /usr/local/lib/python3.5/dist-packages (from esphomeyaml) (1.4.0)
Collecting tzlocal>=1.4 (from esphomeyaml)
Requirement already satisfied: voluptuous>=0.11.1 in /usr/local/lib/python3.5/dist-packages (from esphomeyaml) (0.11.5)
Collecting protobuf>=3.4 (from esphomeyaml)
Downloading (390kB)
100% |████████████████████████████████| 399kB 891kB/s
Requirement already satisfied: typing>=3.0.0 in /usr/local/lib/python3.5/dist-packages (from esphomeyaml) (3.6.4)
Collecting platformio>=3.5.3 (from esphomeyaml)
Downloading (111kB)
100% |████████████████████████████████| 112kB 1.0MB/s
Complete output from command python egg_info:
PlatformIO Core v3.6.4 does not run under Python version 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516].
Minimum supported version is 2.7, please upgrade Python.
Python 3 is not yet supported.


Command “python egg_info” failed with error code 1 in /tmp/pip-install-fz8qq5zz/platformio/

[email protected]:~ $ python --version
Python 2.7.13

Can anyone offer some advice please?

UPDATE: I think I finally fixed it by running “sudo apt install python-pip” then using pip2 install esphomeyaml


Me again…

I have created the initial project, but I can’t validate or upload or anything…

The dashboard says “Terminated Process”

My Putty terminal shows the following:
ERROR Uncaught exception GET /validate (
HTTPServerRequest(protocol=‘http’, host=‘’, method=‘GET’, uri=’/validate’, version=‘HTTP/1.1’, remote_ip=‘’)
Traceback (most recent call last):
File “/home/pi/.local/lib/python2.7/site-packages/tornado/”, line 546, in _run_callback
result = callback(*args, **kwargs)
File “/home/pi/.local/lib/python2.7/site-packages/esphomeyaml/dashboard/”, line 73, in on_message
File “/home/pi/.local/lib/python2.7/site-packages/tornado/”, line 240, in init
self.proc = subprocess.Popen(*args, **kwargs)
File “/usr/lib/python2.7/”, line 390, in init
errread, errwrite)
File “/usr/lib/python2.7/”, line 1024, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

Stuck again?