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

856 Comments

I wish to voice my love for your kind-heartedness in support of people that need help with this important content. Your personal dedication to passing the solution all through came to be particularly practical and have surely allowed regular people much like me to realize their endeavors. Your new informative guidelines entails a great deal a person like me and still more to my colleagues. Many thanks; from everyone of us.

I definitely wanted to construct a quick remark so as to express gratitude to you for some of the fantastic items you are placing here. My prolonged internet lookup has at the end of the day been rewarded with really good facts and strategies to go over with my neighbours. I 'd suppose that most of us visitors actually are really lucky to be in a superb network with so many outstanding people with valuable ideas. I feel somewhat grateful to have seen your entire web site and look forward to some more fun moments reading here. Thank you once again for all the details.

I wish to point out my appreciation for your kindness supporting women who absolutely need assistance with this issue. Your real dedication to getting the solution all around had become unbelievably informative and have in most cases encouraged many people much like me to arrive at their endeavors. Your personal useful facts entails this much a person like me and somewhat more to my fellow workers. Thank you; from everyone of us.

A lot of thanks for all of your effort on this site. Kate loves engaging in investigation and it's obvious why. Almost all notice all concerning the lively way you render functional tips through your website and therefore increase participation from some others on the area of interest and my girl is actually learning a whole lot. Take pleasure in the remaining portion of the new year. You have been performing a stunning job.

I must point out my admiration for your generosity supporting visitors who absolutely need assistance with this particular situation. Your very own dedication to getting the message throughout became wonderfully advantageous and have continuously empowered men and women just like me to attain their desired goals. Your important recommendations entails a great deal to me and especially to my colleagues. Regards; from each one of us.

I simply desired to say thanks yet again. I'm not certain what I might have accomplished without the actual tactics documented by you on such a field. It truly was a real traumatic issue in my opinion, however , viewing your skilled mode you resolved the issue made me to leap with joy. Extremely grateful for this advice and pray you know what a powerful job your are undertaking teaching people today via a blog. I know that you've never met all of us.

Thank you so much for giving everyone an extraordinarily brilliant chance to read from this blog. It is usually so excellent and also packed with a good time for me personally and my office acquaintances to visit your blog no less than thrice in one week to see the latest things you have got. Of course, we're at all times pleased considering the unbelievable pointers served by you. Certain 2 tips in this posting are in truth the best I have had.

My husband and i ended up being peaceful when Jordan managed to round up his studies with the precious recommendations he received out of the blog. It's not at all simplistic just to find yourself handing out instructions that many the others could have been making money from. And we fully understand we need the writer to give thanks to for this. All the explanations you have made, the straightforward website menu, the relationships you assist to promote - it's got everything excellent, and it's really making our son and our family recognize that the matter is cool, and that is quite indispensable. Many thanks for the whole thing!

I want to express thanks to you just for bailing me out of this type of difficulty. After surfing around throughout the internet and getting thoughts which were not helpful, I assumed my entire life was done. Being alive without the answers to the issues you've resolved by means of your entire post is a serious case, and those that might have negatively affected my career if I had not encountered your web site. Your primary knowledge and kindness in taking care of the whole lot was crucial. I am not sure what I would've done if I hadn't discovered such a point like this. I'm able to at this time look forward to my future. Thank you very much for the professional and sensible help. I will not think twice to suggest the sites to any person who would need counselling on this issue.

There are certainly a whole lot of particulars like that to take into consideration. That may be a great point to bring up. I provide the thoughts above as basic inspiration however clearly there are questions like the one you bring up where a very powerful factor will probably be working in honest good faith. I don?t know if best practices have emerged around issues like that, however I am sure that your job is clearly recognized as a fair game. Both girls and boys really feel the impact of just a moment抯 pleasure, for the rest of their lives.

I intended to write you this bit of word just to thank you over again on the extraordinary thoughts you've documented in this article. It was remarkably generous with you to present freely what exactly many individuals would have offered for an ebook in order to make some cash for their own end, especially since you could possibly have done it in case you decided. Those secrets additionally served as the fantastic way to comprehend some people have similar eagerness the same as my own to grasp lots more with regards to this issue. Certainly there are thousands of more enjoyable sessions up front for those who scan your website.

I really wanted to send a simple comment to thank you for the precious items you are showing at this site. My rather long internet investigation has finally been honored with brilliant strategies to talk about with my co-workers. I 'd repeat that we readers are rather endowed to be in a decent place with so many marvellous people with very helpful principles. I feel rather grateful to have used your entire webpage and look forward to many more enjoyable times reading here. Thank you once again for everything.

My husband and i got now thankful when Emmanuel could conclude his basic research through your precious recommendations he had out of your site. It is now and again perplexing just to happen to be releasing tips and hints that other folks have been trying to sell. And we all already know we need the writer to thank for that. These illustrations you made, the straightforward website menu, the friendships you will make it easier to create - it's got everything astonishing, and it's really making our son in addition to our family do think that article is enjoyable, which is certainly seriously vital. Thank you for all!

Thanks a lot for providing individuals with an extraordinarily superb opportunity to read critical reviews from here. It is usually so cool and as well , packed with a great time for me and my office mates to visit your blog at the least three times per week to find out the new items you will have. And lastly, I'm so usually impressed with all the spectacular creative ideas served by you. Some 1 areas in this post are basically the simplest we have all had.

I抦 impressed, I must say. Really hardly ever do I encounter a blog that抯 both educative and entertaining, and let me tell you, you will have hit the nail on the head. Your concept is outstanding; the issue is something that not enough persons are speaking intelligently about. I am very blissful that I stumbled across this in my seek for one thing referring to this.

Needed to create you a tiny word in order to say thanks once again with the precious knowledge you have discussed on this page. This has been quite wonderfully generous with people like you to allow easily what a lot of people could possibly have made available for an e-book to generate some money on their own, primarily considering that you could have done it in the event you decided. The smart ideas likewise acted like the great way to be aware that other people online have a similar interest similar to mine to know the truth whole lot more with respect to this condition. I am sure there are many more fun situations ahead for individuals that view your website.

A lot of thanks for your own work on this blog. My niece delights in participating in internet research and it's really simple to grasp why. My spouse and i notice all regarding the powerful way you make useful guides via your blog and even inspire participation from others on this matter while our favorite daughter is without question learning a whole lot. Have fun with the rest of the new year. You're conducting a fantastic job.

My spouse and i felt so thankful when Michael managed to finish off his reports out of the precious recommendations he obtained when using the site. It is now and again perplexing to simply be giving away things which often the others might have been trying to sell. And we take into account we need you to thank for that. Most of the illustrations you have made, the straightforward site menu, the friendships you will make it easier to promote - it's got mostly unbelievable, and it is making our son in addition to us consider that this theme is thrilling, which is really essential. Thanks for the whole thing!

I wanted to post you the little remark to help say thanks again on the spectacular guidelines you've provided in this case. It's quite wonderfully open-handed with people like you to present unhampered precisely what many of us could have offered for sale for an electronic book to end up making some cash on their own, especially considering the fact that you might have done it if you wanted. These strategies as well worked as the easy way to realize that someone else have similar eagerness the same as my very own to find out whole lot more when it comes to this condition. Certainly there are lots of more fun periods ahead for individuals that read carefully your blog post.

Can I simply say what a aid to find somebody who truly is aware of what theyre speaking about on the internet. You definitely know the best way to convey an issue to gentle and make it important. Extra individuals need to learn this and perceive this facet of the story. I cant believe youre not more in style since you positively have the gift.

I simply wanted to write down a simple comment so as to express gratitude to you for these fabulous techniques you are writing at this website. My prolonged internet lookup has finally been compensated with extremely good facts and techniques to share with my best friends. I 'd express that most of us readers actually are unequivocally lucky to exist in a wonderful website with many outstanding people with great tricks. I feel very privileged to have seen your entire website and look forward to so many more amazing moments reading here. Thanks a lot once again for all the details.

Thank you for your entire work on this web page. Kate really likes setting aside time for research and it is easy to understand why. Many of us learn all relating to the dynamic ways you provide priceless items on the web site and therefore welcome response from website visitors about this issue then our favorite girl is without a doubt starting to learn so much. Have fun with the rest of the year. You have been carrying out a brilliant job.

My wife and i have been very cheerful that Peter managed to carry out his analysis through the entire ideas he received through your web site. It is now and again perplexing just to possibly be giving for free techniques which often a number of people could have been trying to sell. And we all do understand we've got the blog owner to appreciate because of that. The specific explanations you've made, the easy web site menu, the friendships you will make it possible to promote - it is many fantastic, and it's letting our son in addition to us know that the subject is entertaining, and that's unbelievably important. Thank you for all!

Thanks for your own hard work on this web page. Debby really likes participating in research and it's really easy to understand why. Many of us learn all of the powerful method you convey functional solutions on this blog and therefore foster participation from other people about this matter and our favorite child is now starting to learn a lot. Enjoy the remaining portion of the new year. You have been performing a powerful job.

Thank you so much for providing individuals with an extremely superb chance to read articles and blog posts from here. It's always very enjoyable and packed with fun for me personally and my office peers to visit the blog the equivalent of three times per week to read the fresh tips you have got. And of course, I'm actually fulfilled for the very good pointers you serve. Certain 4 points in this posting are honestly the best I've ever had.

I want to express my passion for your kind-heartedness in support of individuals that really need assistance with this important subject matter. Your personal dedication to passing the solution all over appears to be certainly helpful and has constantly allowed professionals just like me to realize their targets. Your informative report means a whole lot to me and extremely more to my fellow workers. Thanks a ton; from all of us.

Thanks for all of your effort on this blog. Betty take interest in getting into investigations and it's really obvious why. Many of us notice all concerning the lively mode you present very helpful thoughts through this blog and therefore increase participation from some other people about this idea while our own daughter is certainly being taught a lot of things. Enjoy the rest of the new year. You have been conducting a wonderful job.

I have to express my thanks to the writer for rescuing me from this type of problem. As a result of exploring throughout the the web and seeing tips that were not beneficial, I figured my entire life was done. Being alive without the presence of strategies to the issues you've solved by means of this guideline is a crucial case, as well as the kind which may have adversely affected my entire career if I had not noticed your blog post. That competence and kindness in controlling all areas was useful. I'm not sure what I would have done if I had not discovered such a thing like this. I can at this point look ahead to my future. Thank you so much for the reliable and sensible guide. I will not be reluctant to endorse the sites to any individual who desires guidance about this subject.

I have to show some thanks to the writer for rescuing me from this incident. Right after looking out through the search engines and finding solutions which were not helpful, I believed my life was well over. Existing devoid of the approaches to the difficulties you have sorted out as a result of your short article is a critical case, as well as the ones which may have in a negative way damaged my career if I hadn't encountered your web page. That competence and kindness in touching all areas was helpful. I'm not sure what I would've done if I hadn't come across such a stuff like this. I can at this point relish my future. Thanks a lot very much for your specialized and sensible guide. I won't think twice to propose the blog to any person who wants and needs direction on this matter.

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.