Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
Bettesworth Construction
DIY electronics

Build a Temperature and Humidity Monitor with ESP32 and Home Assistant

Configure an ESP32 with ESPHome and a supported sensor, then connect its temperature and humidity readings to Home Assistant.

By Bettesworth Construction Team 4 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can build a temperature and humidity monitor for Home Assistant with an ESP32, a supported sensor, and ESPHome. Configure the sensor in ESPHome, flash the firmware, then let Home Assistant discover the device or add it using its host name or IP address and the native API port.

What you need

  • An ESP32 development board.
  • A temperature and humidity sensor supported by ESPHome, such as a DHT22/AM2302, SHT31-D/SHT3x, or AHT10/AHT20/AHT30.
  • USB cable and a computer for configuring and flashing ESPHome.
  • For a DHT11 or DHT22, a data-line pull-up resistor; ESPHome recommends about 4.7 kΩ between DATA and 3.3 V. Check the sensor module’s wiring and documentation before connecting power.

Choose a sensor and wiring approach

Sensor family ESPHome support and interface Build considerations
DHT22 / AM2302 Supported through ESPHome’s DHT component, which also covers DHT11, DHT21 and related models. The data signal uses a single data line. ESPHome’s guide calls for an external data-line pull-up. Incorrect pull-up values or long cables can lead to invalid readings. ESPHome DHT documentation.
SHT31-D / SHT3x Supported by ESPHome; the component documentation includes the SHT85 family. The documented interface is I²C. Follow the breakout’s pin labels and configure the matching ESPHome component. ESPHome SHT3x documentation.
AHT10 / AHT20 / AHT30 Supported by ESPHome over I²C. If a module labeled AHT10 fails to return readings, ESPHome notes that configuring the AHT20 variant may be necessary. ESPHome AHT documentation.

The official component pages establish support, not a consistent comparison of price, accuracy, reliability, or service life. Choose a breakout with clear wiring information and use its exact sensor variant in the configuration; neither a sensor datasheet nor decimal places in Home Assistant prove the accuracy of the assembled monitor.

Configure a DHT22 in ESPHome

For a DHT22/AM2302 build, connect the sensor’s power and ground to the appropriate ESP32 pins, and connect DATA to a usable GPIO. Add the recommended pull-up from DATA to 3.3 V if the module does not already provide one. Verify the pinout for your specific board and module before powering the circuit.

Create or edit the device configuration in ESPHome. This example names separate temperature and humidity entities and uses the 60-second update interval shown in the ESPHome DHT22 example. Replace GPIO_NUMBER with the GPIO number actually used on your board, and adjust device details to suit your ESPHome setup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
HiLetgo 5pcs DHT11 Temperature Humidity Sensor Module Digital Temperature Humidity Sensor 3.3V-5V Humidity Measure Range 20%-95% Temperature Measure Range 0-50℃ Celsius with Wires
  • DHT11 digital temperature and humidity sensor is a digital signal output with a calibrated temperature and humidity combined sensor.
  • It uses a dedicated digital modules and acquisition of temperature and humidity sensor technology to ensure that products with high reliability and excellent long term stability.
  • Sensor consists of a resistive element and a sense of wet NTC temperature measurement devices, and with a high-performance 8-bit microcontroller connected.
  • The product has excellent quality, fast response, anti-interference ability, high cost and other advantages.
  • The single-wire wiring scheme makes it easy to be integrated to other applications.And the simple communication protocol greatly reduces the programming effort required.
sensor:
  - platform: dht
    pin: GPIO_NUMBER
    model: DHT22
    temperature:
      name: "Room Temperature"
    humidity:
      name: "Room Humidity"
    update_interval: 60s

Use model: DHT11 for a DHT11 rather than copying the DHT22 model setting. The ESPHome DHT documentation covers the supported model names and configuration options: DHT Temperature+Humidity Sensor.

ESPHome’s documentation describes the DHT11-derived default humidity precision as zero decimal places and says other DHT sensors can be configured for one decimal place. Decimal places are display/configuration precision, not a guarantee of measurement accuracy.

Rank #2
Teyleten Robot DHT11 Digital Temperature and Humidity Sensor Module for Arduino Raspberry 5pcs
  • Humidity measuring range: 20% -95% and humidity measurement error: + - 5%
  • Temperature measuring range: 0 degrees -50 degrees
  • Operating Voltage 3.3V-5V
  • Weighs about 8g each
  • temperature measurement error: + - 2 degrees

Flash the ESP32 and connect it to Home Assistant

  1. In ESPHome, create a device configuration for the ESP32 and enter the sensor configuration. Validate the configuration before flashing.
  2. Connect the board over USB and install the firmware using the option available in your ESPHome setup. Once it joins your Wi-Fi network, the device can communicate with Home Assistant over the ESPHome native API.
  3. Check Home Assistant for a discovered ESPHome device. If it appears, select it and complete the integration flow.
  4. If it is not discovered, open Settings > Devices & services, choose to add an integration, and select ESPHome. Enter the device’s IP address or hostname and its API port; the default port is 6053.

Home Assistant’s ESPHome integration maintains a persistent connection to each device using the native API rather than polling for sensor values or device states. See the Home Assistant ESPHome integration documentation for the current setup details.

Troubleshoot missing or invalid readings

  • No readings or invalid values on a DHT sensor: confirm the configured model matches the physical sensor, check DATA wiring and the pull-up value, and shorten a long data cable if practical. ESPHome notes that incorrect pull-up values and long cables can cause invalid readings.
  • An AHT module is not returning data: confirm the I²C wiring and configured variant. A board marked AHT10 may need the AHT20 variant selected in ESPHome.
  • The sensor works in ESPHome but Home Assistant does not show it: look for device discovery first; otherwise add the ESPHome integration manually with the board’s IP address or hostname and API port.
  • Values look more precise than expected: displayed decimal places do not establish real-world accuracy. Compare the assembled monitor with a more accurate reference instrument before making calibration changes.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Calibrate readings against a reference

ESPHome supports sensor calibration from measured-to-truth data points. Take readings from the monitor alongside a more accurate reference instrument under representative conditions, then use those paired values to configure the calibration filter. Depending on configuration, the filter can apply a least-squares fit or an exact mapping. See the ESPHome sensor component documentation for the filter syntax and options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Lonely Binary 6-Pack DHT22 DHT11 Temperature Humidity Sensor AM2302
  • 【MIXED SENSOR BUNDLE (3x DHT22 + 3x DHT11)】Includes 3 DHT22 sensors for applications like weather stations or greenhouses, and 3 DHT11 sensors for basic indoor monitoring, organized in a storage container.
  • 【CALIBRATED DIGITAL OUTPUT】Calibrated digital outputs for temperature and humidity readings — for ESP32, ESP8266, STM32, and other MCU-based DIY electronics.
  • 【GOLD IMMERSION PLATING】Gold-plated contacts for corrosion resistance and signal integrity in humid environments. Lead-free, RoHS-compliant.
  • 【WIDE COMPATIBILITY (3.3V–5V)】Works with microcontrollers operating on 3.3V to 5V (up to 6V for DHT22), using single-wire digital communication — no extra components needed for most projects like smart home automation or data logging.
  • 【DHT22 vs DHT11 SPECS】DHT22: -40°C to 80°C, 0–100% RH, ±0.5°C/±2% accuracy for precise needs. DHT11: 0–50°C, 20–80% RH, ±2°C/±5% accuracy for basic monitoring. Choose based on your project.

Calibration can adjust reported values to match the reference data; it does not establish how the monitor will behave in every location or over time. The cited component documentation does not settle enclosure design, sensor placement relative to the ESP32, self-heating, or comparative long-term drift, so treat those as build factors to assess in the installed monitor rather than assumed performance guarantees.

Best Value
2pcs AHT30 High Precision Digital Temperature and Humidity Sensor Measurement Module I2C IIC Communication AHT20 AHT21 AHT10 Upgraded Version for Arduino Humidity Temperature Sensor
  • 2pcs AHT30 High Precision Digital Temperature and Humidity Sensor Measurement Module I2C IIC Communication
  • Digital temperature and humidity sensor, I2C master output, support simultaneous online access to multiple I2C electronic devices or modules.
  • DC 2.0V-5V voltage can be used, voltage is easy to adapt, low power consumption, simple circuit, accurate temperature measurement point.
  • Stable and fast transmission speed.
  • 4P test line connection is adopted, which is convenient for users to use it quickly. Product parameters:
Rank #4
DHT11 Temperature and Humidity Sensor Module 2-Pack, for Arduino, ESP32, ESP8266, Raspberry Pi, IoT DIY Projects, Built-in Resistor for Easy Integration
  • RELIABLE TEMPERATURE AND HUMIDITY SENSING – DHT11 module provides accurate and stable readings, ideal for monitoring environmental conditions in electronics and IoT projects.
  • 2-PACK VALUE FOR MULTIPLE PROJECTS – Includes two modules for use in redundant setups, multiple builds, or classroom and prototyping environments.
  • BUILT-IN RESISTOR FOR EASY CONNECTION – Simplifies wiring by allowing direct connection to Arduino, ESP32, ESP8266, or Raspberry Pi without a breadboard.
  • COMPATIBLE WITH POPULAR MICROCONTROLLERS – Fully supported by widely available libraries and sample code for Arduino IDE, MicroPython, and more.
  • ONLINE TUTORIALS AVAILABLE – Easy-to-follow tutorials for Arduino, Raspberry Pi, ESP32, and ESP8266 projects are available online by searching: DIYables DHT11 sensor.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Site Office

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.