Written by Paul Verburg


In part 1 of the series, we successfully got an instance of Home Assistant running on a Raspberry Pi, integrated 2 Google Chromecast devices, a Shelly device and a Tasmota device. We skipped over the wiring and set up of the sensors, and went straight into the integration of an already set up device into Home Assistant.

In this part we will look at how to do the wiring and preparation of the sensors to prepare them to be added into Home Assistant.

Hardware Requirements

For a list of all the hardware used so far, please have a look at Part 1 of the blog. The list below is the specific sensors and hardware we will use in this blog.

  • USB to Serial Converter to program the ESP8266 (This one works great for the ESP01S)
  • ESP01S To read the Temperature and humidity sensor and provide WiFi Access
  • DHT22 To measure the temperature and humidity
  • Breadboard and wires (To connect sensors to ESP8266 module)

The ESP based microcontrollers are arguably the most common controllers used by the home automation community. Not only can you use the various versions of the ESP8266 and ESP32 directly, but they often form the core of common home automation devices such as the Sonoff and Shelly devices.

We will look at two pieces of custom firmware that we will flash onto our ESP8266, and how to set them up to read data from a DHT22 sensor and integrate it into Home Assistant.

First we’ll look at Tasmota, and in the next part we’ll look at ESPHome.


In part 1 of the blog, we looked at how to integrate a tasmota device, but we didn’t look at how to tasmotize (load the tasmota firmware) the ESP8266 device, or how to do any of the wiring.

 In order to Tasmotize an ESP device, we need to connect the device to a PC/Laptop. We will do this using the USB to Serial converter listed in the Hardware requirements.
Plug the ESP-01S module into the converter, the plug the converter into your laptop.

Before we can flash the firmware, we need to download the firmware and install a flashing tool. There are 2 very easy ways to do this. Firstly, you can download the firmware from the Tasmota github and flash the firmware using Tasmotizer. This is the way I will be doing it in this blog, however, a new tool has been released that allows you to flash the firmware from your Google Chrome browser. If you follow the Google Chrome installer link, you should see this page:

 Tasmota Chrome

For Tasmotizer, first download the firmware file by following the link to the Tasmota Github.

Click on Tasmota 9.5.0 Mchael. You will be taken to the latest release page. Click on the file at the top of the page (tasmota.bin.gz) to download the standard version of Tasmota.

Choose a location where you can find the .bin file, the default location will be the downloads folder.

Now we need to download a tool to flash the firmware with. In this case Tasmotizer. Follow the link to the Tasmotizer github,

Tasmotizer Github

Scroll down and click on the “get Windows standalone executable” link next to “Option 1”.

Tasmotizer Download Link

You will be taken to the releases page:

Tasmotizer Releases

Click on tasmotizer-1.2.exe

This will prompt you for a location to save the downloaded file to, choose an appropriate location and select “save”.

Navigate to where you saved the tasmotizer executable file and run the application by double clicking on it. You should be greeted with the following screen:

Tasmotizer Home Page

Here we need to do 2 things, we need to ensure that the correct COM port is selected, and we need to select the image (The .bin file we downloaded earlier) that we want to flash onto our ESP-01S. To get the com port, enter “device manager” into your start menu.

Device Manager Start menu

Open device manager, and navigate to ports:

Device Manager

Under Ports, if you have inserted your USB to Serial device into a USB port on your PC/Laptop, you will see a “USB-SERIAL CH340 (COM_)”, with a port number next to it. That COM Port number is the one we will select on our Tasmotizer software.
If you don’t see the device under Ports, and you DO see a device listed under “Other Devices”, you need to update the device drivers. These steps are explained well at the wiki for the USB to serial converter. Please have a look at that and proceed with the rest of this blog after you see the device listed under your Ports with a COM port number.

With the correct COM port selected, click on Open next to the text box with “BIN file” selected. Navigate to the location you chose earlier (Downloads on default) and select the tasmota.bin file.

You should now have a screen similar to this:

Click on the “Send config” button. This will prompt you to enter your WiFi information. It also allows you to setup MQTT information should you wish to use MQTT. All you need to enter, is your WiF SSID as well as it’s corresponding password. Click the save button the close the “Send config” page.

We are now ready to flash the firmware to your ESP01S module. Ensure that the switch on the serial to USB connector is set to FLASH. Click the Tasmotize! button. The firmware should start to be loaded onto the ESP01-S module.

Tasmotizer Flashing

During the flashing process, you should see a screen similar to the one above.

Tasmotizer Done Flashing

After successfully flashing the device, you will see a screen like the one above, which asks you to power cycle your ESP device. To power cycle a device simply means to switch it off and back on again.

You can now remove the converter from the laptop, then change the switch from “Flash” to “Boot” and insert it again to the PC/Laptop in order to power cycle the ESP-01S.

If the flash was successful, then the ESP01-S will broadcast an SSID for you to connect to.

WiFi Name

The SSID will always start with “tasmota_” followed by a combination of numbers and letters.
Connect to that SSID.

Once you’ve connected to that SSID, you should be automatically directed to the web page of your new Tasmota Device.

Tasmota Select WiFi

On this page, you will be prompted to enter the details of your Wi-Fi network. Then click save.

If a connection is successful, you will see a “Successful WiFi Connection” message, alongside the newly assigned IP Address of your device.

Tasmota Successful WiFi Connection

You will also be redirected to the new IP Address automatically.

NOTE: When originally connecting to the Tasmota WiFi Access point, you were disconnected from your current WiFi. After you connected your Tasmota device to your WiFi network, and it redirects you to the new page, you need to reconnect to your WiFi network. For most people this should happen automatically, but if it doesn’t, just make sure you are connected to your home WiFi network again.

You will now see the home page of your Tasmota device.

Tasmota Home Page


The IP address assigned to my device is
If this does not happen automatically, you can click on Get IP on the Tasmotizer software. This will show you the IP address that was assigned to the device you just flashed with the tasmota software. Enter this IP address into the URL bar of your browser. This should take you to the home page of your tasmota device.

Tasmotizer Get IP

From this page you will do all configurations of the tasmota device in the future, and you won’t use Tasmotizer again, unless you want to create a new tasmota device.

We are going to configure this device using templates. Click on “Configure Template”
Tasmota Sonoff Basic

On this page, select “Sonoff Basic (1)” from the “module type” drop-down menu. You will have a column with 4 GPIO labels and a column next to it with “None” written inside of it. We will use GPIO Pin 2 for our DHT22 sensor. Click on the drop-down menu of GPIO2, and select AM2301.

Click save, and you will get a page saying your configuration was saved, and your device will restart.

Tasmota Configuration Saved

After it restarted, you will see the three new parameters, Temperature, Humidity and Dew Point.

The values are currently “null”, because there is no sensor connected to the GPIO2 pin.

We now need to connect the sensor to our Tasmota device and provide it external power
During prototyping, we usually use a breadboard and jumper wires.

For this, we will need:

  • 3V power for ESP01-S
  • Jumper wires
  • DHT22
  • Breadboard

The ESP01-S requires 3.3V DC power. A breadboard power supply as listed in the beginning of this blog is usually the best option for use in prototyping with a breadboard. However, as you’ll see in the photo of my setup, I used a DC to DC converter, the AMS1117, alongside a 5V power supply and a DC barrel jack.

In the photo above, you see my Raspberry Pi Home Assistant server connected to my home router with an Ethernet cable as was shown in Part 1 of the blog. Next to it, is a breadboard, with my new Tasmota device.

From the AMS1117, the 3.3V positive is connected to the 3.3V pin of the ESP01-S. The negative is connected to the GND pin of the ESP01-S.

This provides the ESP device with power. You should be able to go to the Tasmota Home screen by entering the same IP address as before.

If your connections were done correctly, you will now see the temperature, humidity and dew point data.

Now we’re ready to add the information into Home Assistant!
This will be done in the same way that we added the Chromecast and Shelly integrations in Part 1.

Go to Integrations, click Add Integration, then search for Tasmota.

Click on Tasmota, and you will be prompted to set up Tasmota.

You will now see the Tasmota device listed under Integrations.

All the entities from the Tasmota device will now be available to add to cards in your dashboard, just as we’ve done in Part 1.


The process above can be followed to “Tasmotize” any ESP device. This also includes Sonoff devices.

This blog was quite long and can be intimidating. However, once you’ve gone through this process a few times, you’ll realize it’s actually very quick and easy.

I’ve mentioned that we’ll look at another way to integrate ESP devices into Home Assistant, via and integration called ESPHome. We’ll split this Part into subsections, in order to make it easier to follow and easier to refer back to once you’ve decided whether ESPHome or Tasmota is the way you want to go.


Leave a comment