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

21 Comments

Just desire to say your article is as astounding. The clarity on your submit is simply excellent and that i can suppose you are an expert in this subject. Fine with your permission allow me to grasp your RSS feed to keep updated with coming near near post. Thanks one million and please continue the rewarding work.|

Thanks for the wonderful posting! I actually relished reading through it, you're a wonderful author. I will make sure to bookmark your website and can often come back eventually. I choose to inspire a single to continue your terrific work, Possess a awesome night! sasilu.se/map39.php lock f?¶r ?¶rat yrsel

I actually wanted to make a message so as to say thanks to you for these great instructions you are placing at this site. My time consuming internet lookup has at the end been rewarded with excellent know-how to write about with my friends and family. I 'd declare that many of us readers are undoubtedly lucky to be in a fine network with many perfect individuals with useful pointers. I feel extremely lucky to have discovered the weblog and look forward to some more awesome times reading here. Thanks once more for everything.

Thanks a lot for providing individuals with remarkably special chance to read articles and blog posts from here. It is always very cool plus jam-packed with a great time for me personally and my office fellow workers to visit your website at minimum thrice a week to learn the latest items you will have. And indeed, I am certainly fulfilled with the tremendous techniques you serve. Selected two areas in this post are indeed the simplest we have had.

My husband and i were so cheerful when Emmanuel managed to carry out his reports through the ideas he received while using the web pages. It is now and again perplexing to simply happen to be releasing points some people could have been making money from. And we also fully understand we have you to appreciate for this. These illustrations you have made, the straightforward web site navigation, the friendships your site make it possible to instill - it is mostly unbelievable, and it's leading our son and us understand the subject is pleasurable, and that's exceptionally mandatory. Thank you for all the pieces!

Thanks a lot for giving everyone remarkably pleasant possiblity to read articles and blog posts from this web site. It can be so excellent and as well , packed with a lot of fun for me personally and my office fellow workers to search your web site more than 3 times in a week to study the fresh stuff you have. And lastly, I'm also usually amazed with your effective advice served by you. Some 3 tips in this article are honestly the very best we have had.

ich habe alles installiert und compeliert. Auf den D1_mini übertragen und dann tat sich nichts mehr . im Wifi-Netz wird kein Modul angezeigt. Mit dem Ergebniss kann ich nicht arbeiten. Fertige Bin-Files, die ich testen kann finde ich brauchbarer. Bin entteucht.

When I initially commented I seem to have clicked on the -Notify me when new comments are added- checkbox and from now on each time a comment is added I receive 4 emails with the exact same comment. There has to be a way you are able to remove me from that service? Thank you!|

I and also my buddies appeared to be following the excellent tips located on your web blog and then the sudden got a horrible feeling I had not thanked the web blog owner for them. Those boys became absolutely excited to read them and have seriously been enjoying those things. Many thanks for really being well thoughtful and then for opting for this sort of important areas most people are really wanting to be aware of. Our own honest apologies for not expressing gratitude to sooner.

I and also my guys were going through the great secrets on your site and so suddenly came up with a horrible feeling I never thanked the web blog owner for those tips. The young boys were as a consequence thrilled to read through them and have in effect clearly been loving these things. Appreciation for turning out to be quite kind and also for considering certain great ideas most people are really needing to know about. My honest apologies for not expressing gratitude to earlier.

I simply wanted to appreciate you yet again. I do not know the things that I would have handled in the absence of the aspects provided by you regarding such a subject matter. It was actually a real distressing situation in my position, but considering a specialized form you managed that forced me to weep with joy. I am thankful for this information and as well , wish you are aware of a powerful job you are always providing instructing most people via your web blog. I am certain you've never come across all of us.

Thank you a lot for giving everyone such a marvellous possiblity to discover important secrets from this site. It can be very beneficial and also full of a great time for me and my office mates to search your site nearly 3 times in 7 days to study the new stuff you have got. And of course, we're actually fascinated with the magnificent information served by you. Certain 1 tips in this post are really the very best we have all had.

I must express my gratitude for your generosity supporting folks who have the need for assistance with your idea. Your personal commitment to passing the message all around was incredibly interesting and have usually empowered guys and women much like me to attain their pursuits. Your new important advice implies so much a person like me and far more to my colleagues. Thanks a ton; from all of us.

Thanks for all of your labor on this web page. My niece takes pleasure in participating in investigations and it's really easy to see why. My partner and i know all concerning the dynamic medium you give insightful solutions via the web site and even increase contribution from the others on the content while our favorite simple princess is now discovering a lot of things. Enjoy the rest of the new year. You are always performing a useful job.

I'm also writing to let you be aware of of the extraordinary discovery my princess went through browsing your blog. She figured out too many pieces, most notably what it's like to have an excellent helping character to make the rest without problems learn about a variety of hard to do subject areas. You truly surpassed visitors' expectations. Thank you for presenting the warm and helpful, safe, revealing and even cool tips on your topic to Mary.

Thank you a lot for providing individuals with an extraordinarily wonderful opportunity to check tips from this website. It is usually so enjoyable and packed with fun for me and my office friends to visit your site more than 3 times in a week to read through the latest guides you will have. And of course, I am also certainly contented with your astounding pointers you serve. Selected 1 ideas in this posting are undoubtedly the most suitable we have ever had.

I just wanted to construct a simple note to appreciate you for all the unique guidelines you are giving out at this website. My considerable internet lookup has finally been paid with extremely good suggestions to go over with my pals. I would admit that most of us readers actually are definitely lucky to live in a fantastic site with so many lovely people with valuable points. I feel pretty privileged to have seen your entire weblog and look forward to some more entertaining minutes reading here. Thank you again for a lot of things.

My husband and i felt really glad Peter managed to deal with his survey through the entire ideas he received through your web pages. It is now and again perplexing to simply always be handing out information and facts which a number of people may have been selling. Therefore we fully understand we have the writer to thank because of that. The entire illustrations you've made, the straightforward blog menu, the friendships your site aid to create - it's mostly remarkable, and it's aiding our son in addition to us feel that that article is cool, which is certainly really indispensable. Thanks for everything!

I as well as my pals came digesting the great techniques from your website and so all of a sudden got a horrible feeling I never expressed respect to the site owner for those secrets. Those people were consequently very interested to learn all of them and have now without a doubt been loving them. Many thanks for simply being really kind as well as for pick out these kinds of superior resources most people are really needing to be aware of. My honest regret for not saying thanks to earlier.

I must convey my admiration for your generosity supporting men and women who require help with your content. Your personal dedication to getting the solution along turned out to be astonishingly valuable and has continually allowed girls just like me to realize their goals. Your useful recommendations denotes this much a person like me and somewhat more to my office colleagues. Regards; from 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.