Getting Started with ESPHome: How to Install and Integrate it with Home Assistant?

Getting Started with ESPHome

ESPHome is a simple yet powerful system that allows users to control ESP boards using YAML configuration files. It allows users to quickly and easily build custom firmware for sensors and devices without any programming skills. ESPHome supports a long list of devices, sensors, and protocols that can be configured with just a few lines of YAML. Apart from that, it can also control lights, displays, and even more. It can be integrated with Home Assistant in few clicks.

 

There are mainly two methods for installing ESPHome. The quickest and easiest way is using the Home Assistant add-on, the second way is to install through python using pip. In this tutorial, we are going to install ESPHome through the Home Assistant add-on. Once the installation is complete, we will test it by controlling an LED and reading DHT11 sensor data. If you are not familiar with Home Assistant, follow our previous tutorial on Getting Started with Home Assistant. You can also check our previous tutorial on Flashing Tasmota on ESP8266-01.

 

Components Required for Installing ESPHome

  • ESP8266-01
  • Arduino Uno
  • LED
  • DHT11
  • Jumper Wires

 

Installing ESPHome

Installing the ESPHome through the ESPHome Home Assistant add-on is very easy. To install ESPHome, first, navigate to Home Assistant Web UI and from there navigate to the Supervisor panel, then search for ESPHome in the “Add-on Store” tab.

ESPHome Home Assistant

 

Open the ESPHome and then simply click on the Install button in order to install it. After that, wait until the add-on is installed. Then start the add-on and switch on the ‘Show in Sidebar’ option for ease of access. After that, click “Open Web UI”.

 Installing ESPHome

 

Now you will be redirected to ESPHome Web UI. Click on the “+” icon to add a new device.

ESPHome Web UI

 

In the first step, enter the device or project name. The device name must be in lowercase and must not contain any spaces. For example, my device name is ‘office_temperature’ but you can choose any name you like.

ESPHome Node Name

 

In the second step, select the correct board type. Here, I am using an ESP-01 Wi-Fi board so I selected ‘Generic ESP8266’.

ESPHome Device Type

 

Then in the next step, enter the SSID and password of the Wi-Fi network. You can also set an additional password for future OTA firmware updates.

ESPHome Wi-Fi and Updates

 

Once you have entered your credentials, click Next and then click Submit in the next step to finish the process, and the device will be added to the ESPHome UI. It will then ask to select a port. If you are using a Board that has a USB interface, connect it to Laptop and select the port; else ignore it.

ESPHome UI

 

Now to create a configuration for the ESP-01 device, click on ‘Edit’ from the menu of the device. You will be presented with the YAML file. If the YAML page is blank then click on ‘Overview’ or any other tab and then click back to ESPHome and click ‘Edit’ again. You will see a YAML file currently configured for your device.

ESP-01 Device Configuration

 

Now in the next step, we are going to add a light component (LED) and binary sensor (DHT11) in the configuration file. ESPHome has tons of compatible sensors and devices that you can find on their website. Add the below lines of code to the configuration file:

# Web server
web_server:
  port: 80
  auth:
    username: admin
    password: 312124dc
# Sensors config
sensor:
  - platform: dht
    pin: GPIO0
    model: DHT11
    temperature:
      name: "Living Room Temperature"
    humidity:
      name: "Living Room Humidity"
    update_interval: 20s
output:
  - platform: gpio
    pin: GPIO2
    id: main_relay
light:
  - platform: binary
    name: "Lamp 1"
    id: rele1
    output: main_relay
text_sensor:
  - platform: wifi_info
    ip_address:
      name: espname ESP IP Address

 

Now go ahead and click save. Then click on three dots in the top right corner and then click 'Compile'.

ESPHome Compilation

 

The compilation process may take a while. Once the compilation completes successfully, click on ‘Download Binary.’

Install ESPHome

 

Note: If you are using a board with a USB interface, then you can directly upload the code from ESPHome UI by selecting the serial port but as we are using an ESP-01 board, we will use Arduino Uno to upload the firmware.

 

Flashing ESPHome on ESP-01

There are generally two methods for flashing ESPHome on ESP8266. One is Over the Air (OTA) and the other is using FTDI or Arduino Uno. In this project, we are going to use Arduino Uno.

 

Step1: Preparing Hardware

To flash a new firmware on ESP-01, connect ESP-01 with Arduino Uno as per the circuit diagram.

ESP-01 with Arduino Uno

Connect the VCC and GND of ESP-01 to 3.3V and GND of Arduino; also connect CH_PD to 3.3V andGPIO_0 to GND of Arduino. Connect RX and TX of ESP-01 to RX & TX of Arduino Uno respectively. GPIO_0 is grounded to enable the flashing mode of ESP8266-01. After making the circuit as per the diagram, connect the Reset pin of the Arduino to GND to bypass the Arduino. It will disable Arduino and upload the firmware directly to the ESP-01. Connect RST pin of ESP-01 to ground, remove the RST after half a second (the blue LED flashes for some millisecond).

 

Step 2: Download and install Tasmotizer

Tasmotizer is a specifically designed flashing tool for Tasmota but here we will use it to Flash ESPHome. Download the latest Tasmota version for your platform. After downloading, double click the downloaded file and it'll start, no installation is required.

 

Step3: Flashing the Firmware

Now in the final step, select the port to which Arduino Uno is connected. Then browse to the ESPHome firmware binary you downloaded. You can take a backup of your original firmware by checking in the “Save original firmware” option. Click Tasmotize! and wait until it is done.

Flashing the ESPHome Firmware

Once the Flashing is done, disconnect the RX, TX, CH_EN pins and connect an LED to GPIO2 and DHT11 to GPIO0 of ESP-01 as shown in the image given.

 

Wait until the ESP-01 connects to Wi-Fi and then click on Configuration to load the configuration page, then go to Integrations.

Home Assistant Configuration

 

Now on the Integrations page, you will see that Home Assistant has already discovered the ESPHome device.

ESPHome Device

 

If you didn’t turn on the Edit mode on your Dashboard, ESPHome will already be visible on the overview page, otherwise, add it manually.

ESPHome with Home Assistant

 

You can even access the ESPHome Web UI without Home Assistant. For that enter the IP address of ESP8266 into the browser URL and click Enter. It will ask you to enter the Username and Password that you provided in the configuration file.

ESPHome Web UI without Home Assistant

 

After entering the User name and Password, click on Sign in and you will be redirected to ESPHome Web UI.

ESPHome Web Server API

This is how you can integrate ESPHome with Home Assistant. It's that easy to add sensors and devices using ESPHome. A complete working video is given below. If you have any questions, please let me know in the comments below.

Video

701 Comments

I simply wished to appreciate you yet again. I am not sure the things that I would have accomplished in the absence of the entire ideas shared by you about my problem. Entirely was the depressing setting in my opinion, nevertheless witnessing a new expert way you treated that made me to weep over contentment. I'm happier for the assistance and thus hope that you really know what an amazing job you have been putting in training the rest by way of a web site. I am sure you haven't come across all of us.

I must show thanks to you just for rescuing me from this particular situation. Because of browsing through the online world and coming across concepts which are not productive, I figured my entire life was gone. Living minus the approaches to the issues you've resolved by means of your entire site is a crucial case, and the kind that would have adversely affected my entire career if I had not discovered the website. Your own competence and kindness in dealing with every part was very useful. I'm not sure what I would have done if I hadn't encountered such a subject like this. I can also at this moment relish my future. Thank you very much for this high quality and effective help. I will not think twice to suggest your web blog to anybody who desires direction on this issue.

I together with my buddies were found to be studying the good solutions found on your site and so the sudden I had an awful suspicion I had not expressed respect to you for those techniques. All of the men were definitely for that reason warmed to see them and already have in actuality been using those things. Many thanks for getting really accommodating and for making a choice on this kind of fantastic information most people are really desperate to be aware of. Our sincere regret for not saying thanks to you earlier.

I intended to post you that bit of observation so as to thank you very much yet again on your incredible information you have featured on this site. It was so extremely generous of people like you to deliver openly all that a number of people could have offered for an e book to generate some money on their own, most importantly given that you might have done it in the event you decided. The good ideas also served as the easy way to comprehend other people online have a similar eagerness just as my own to figure out very much more related to this matter. Certainly there are millions of more pleasurable opportunities ahead for many who discover your site.

I not to mention my buddies have already been studying the good information and facts located on your web page and so all of the sudden developed a terrible feeling I never thanked the website owner for those strategies. Most of the young boys ended up so happy to learn all of them and have now certainly been loving those things. Thank you for genuinely considerably thoughtful as well as for opting for varieties of smart themes millions of individuals are really needing to learn about. My very own sincere regret for not saying thanks to you sooner.

Needed to create you this very small remark to finally thank you very much over again considering the magnificent principles you've discussed on this website. It is quite particularly generous with people like you to present publicly all that a lot of people could possibly have advertised for an e-book to make some dough for themselves, most notably since you could possibly have tried it if you decided. These tricks in addition acted as a fantastic way to fully grasp someone else have the same passion really like my own to learn significantly more pertaining to this problem. Certainly there are millions of more enjoyable periods in the future for many who look into your site.

Thanks a lot for providing individuals with an extremely wonderful possiblity to read in detail from this site. It really is very cool and as well , jam-packed with a lot of fun for me and my office colleagues to visit the blog nearly three times in a week to see the new things you have. And lastly, I am also usually motivated considering the incredible secrets served by you. Certain 3 areas in this article are indeed the most beneficial we have all ever had.

Thanks so much for providing individuals with an extraordinarily splendid chance to read from this blog. It's always so good and jam-packed with amusement for me personally and my office mates to search your blog the equivalent of 3 times per week to study the new things you have. And lastly, I am also usually fascinated with your cool inspiring ideas you give. Selected 3 points in this post are easily the most efficient I've had.

The step-by-step instructions make it so easy to follow along, even for someone like me with limited programming skills. The author's personal experiences with installing and configuring ESPHome add a relatable touch to the tutorial. I can't wait to try it out myself and create custom firmware for my own sensors and devices. Thanks for sharing this fantastic guide!

I must point out my appreciation for your kindness for folks that really need assistance with this matter. Your special commitment to passing the message all-around ended up being rather insightful and have constantly helped professionals like me to attain their desired goals. Your entire invaluable facts indicates this much to me and substantially more to my office workers. Best wishes; from all of us.

I wish to point out my passion for your kind-heartedness giving support to those people that require help with this important study. Your real dedication to passing the solution all over became really helpful and has continuously enabled others much like me to reach their dreams. Your personal valuable guide implies a whole lot a person like me and much more to my mates. Regards; from all of us.

I wish to point out my respect for your kind-heartedness in support of men and women who need guidance on the content. Your personal commitment to getting the message up and down was certainly important and has in most cases encouraged professionals just like me to achieve their desired goals. This important tutorial signifies a lot to me and substantially more to my office colleagues. Many thanks; from everyone of us.

I precisely desired to thank you very much once more. I am not sure the things I might have accomplished in the absence of the type of basics discussed by you directly on such area of interest. It was actually an absolute frustrating case in my view, however , encountering this expert strategy you solved the issue forced me to cry for contentment. Extremely grateful for your information and have high hopes you really know what an amazing job you are doing educating some other people with the aid of your web blog. Most probably you've never met all of us.

I would like to show my appreciation to this writer just for rescuing me from such a circumstance. Just after browsing throughout the internet and getting tricks that were not helpful, I believed my entire life was over. Being alive minus the approaches to the issues you have resolved through your entire article content is a critical case, and the ones which might have negatively affected my entire career if I had not noticed your web site. Your personal mastery and kindness in maneuvering all the things was important. I am not sure what I would've done if I had not come across such a thing like this. I can also at this time look forward to my future. Thank you very much for your professional and results-oriented guide. I will not be reluctant to refer your blog post to anyone who needs direction on this topic.

I happen to be commenting to let you know what a fine encounter our child found using your web page. She even learned a lot of things, which include how it is like to have a wonderful giving nature to have most people with ease learn certain advanced subject areas. You undoubtedly did more than visitors' expectations. Many thanks for supplying these valuable, trusted, informative and also unique thoughts on that topic to Janet.

I wanted to construct a quick message in order to say thanks to you for some of the wonderful suggestions you are sharing at this website. My long internet research has finally been honored with good facts and techniques to exchange with my company. I 'd say that most of us readers are truly lucky to exist in a fantastic place with very many lovely individuals with interesting guidelines. I feel somewhat privileged to have discovered your website page and look forward to so many more fabulous minutes reading here. Thank you again for a lot of things.

My spouse and i felt so ecstatic when Peter managed to complete his researching by way of the precious recommendations he came across through the web site. It's not at all simplistic to simply always be giving freely tips and tricks which many others might have been trying to sell. And we already know we have got you to appreciate for this. These illustrations you made, the straightforward blog navigation, the friendships you will help to engender - it's most excellent, and it's letting our son in addition to our family understand this idea is pleasurable, and that's exceedingly mandatory. Many thanks for the whole thing!

I have to voice my affection for your kind-heartedness supporting people that have the need for guidance on the theme. Your real commitment to getting the solution all-around had been exceptionally good and has in every case encouraged many people just like me to reach their pursuits. The insightful publication can mean a lot a person like me and further more to my mates. Warm regards; from all of us.

I wish to show thanks to you just for rescuing me from this type of matter. Just after exploring through the world wide web and obtaining basics that were not pleasant, I assumed my entire life was well over. Existing minus the solutions to the difficulties you've fixed by means of your good post is a serious case, as well as the kind which might have badly damaged my entire career if I hadn't discovered your web page. Your know-how and kindness in playing with a lot of things was precious. I don't know what I would have done if I hadn't come upon such a point like this. I can at this time relish my future. Thanks for your time very much for the skilled and results-oriented guide. I won't be reluctant to refer your web sites to any individual who needs guide about this issue.

I wanted to send a quick word so as to say thanks to you for all of the unique pointers you are sharing here. My extended internet lookup has at the end of the day been compensated with extremely good knowledge to go over with my guests. I would suppose that many of us readers are very much lucky to be in a wonderful site with so many marvellous individuals with great principles. I feel rather lucky to have encountered your entire website and look forward to many more excellent times reading here. Thank you once more for everything.

I am also commenting to make you understand of the terrific experience our child undergone using your web site. She mastered lots of issues, not to mention what it is like to possess an ideal coaching mood to let many people very easily know a number of extremely tough issues. You truly did more than our own expectations. Thanks for displaying such valuable, trusted, educational and even unique tips about this topic to Evelyn.

I have to express my thanks to the writer for rescuing me from such a matter. Right after surfing through the world-wide-web and seeing strategies that were not helpful, I thought my life was over. Being alive minus the strategies to the problems you've fixed as a result of your entire article is a serious case, as well as the kind which may have badly damaged my entire career if I hadn't come across your website. Your own personal knowledge and kindness in playing with everything was useful. I don't know what I would have done if I hadn't come across such a subject like this. I am able to now relish my future. Thank you very much for the professional and results-oriented guide. I won't be reluctant to endorse your blog post to anyone who should get tips on this issue.

I and my guys were found to be following the great suggestions from your website and all of a sudden came up with a horrible suspicion I had not expressed respect to the web site owner for them. Most of the ladies appeared to be joyful to study all of them and now have in actuality been having fun with those things. We appreciate you simply being simply thoughtful and for going for certain superior topics millions of individuals are really wanting to discover. My honest apologies for not expressing gratitude to earlier.

My wife and i got really lucky Peter managed to finish off his research through your precious recommendations he grabbed in your web site. It is now and again perplexing just to continually be freely giving information and facts most people have been trying to sell. And we all realize we have the website owner to thank for that. These illustrations you have made, the straightforward website menu, the relationships your site help to foster - it is many sensational, and it's really aiding our son and us understand that subject matter is fun, which is certainly exceedingly indispensable. Thank you for the whole thing!

I precisely desired to say thanks all over again. I am not sure the things that I would've gone through in the absence of the methods shared by you regarding such area. This was a very frightening dilemma for me, however , being able to view a new well-written fashion you processed it took me to cry for joy. Extremely happier for this help and thus have high hopes you really know what an amazing job you are always accomplishing training some other people with the aid of your blog post. More than likely you've never met all of us.

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.