Illustration: ESP32 + ESPHome temperature sensor for Home Assistant (condensed)

AI-generated illustration

Updated 24 October 2026 By Emmanuel SAUVAGE

ESP32 + ESPHome temperature sensor for Home Assistant (condensed)

Build a room temperature and humidity sensor with ESP32, DHT22 or BME280 and ESPHome—wiring sketch, minimal YAML, and links to full ESPHome docs.

Also available in French.

A DIY ESP32 temperature sensor with ESPHome shows up automatically in Home Assistant—good when you want USB power and full control. This is a short path; for deep troubleshooting, enclosures and battery builds, see the full ESPHome getting started with Home Assistant and our ESP32 project ideas.

Board choice: which ESP32 for smart home.

Parts

ItemNotes
ESP32 dev boardClassic ESP32 or ESP32-C6 DevKit—search UK · US
DHT22Simple 1-wire, ±0.5 °C typical—UK · US
BME280 (optional)I2C, humidity + pressure—UK · US
Breadboard + dupont wiresPrototype before enclosure

Use 2.4 GHz Wi-Fi only (ESP32 does not join 5 GHz).

1. Install ESPHome in Home Assistant

Settings → Add-ons → ESPHome → Install → Start → Show in sidebar. Docs: ESPHome on Home Assistant.

2. Wire DHT22 (example)

DHT22          ESP32
VCC    →       3.3V
DATA   →       GPIO4
GND    →       GND

Optional 4.7 kΩ from DATA to 3.3V if reads are unstable on long wires.

BME280 (I2C): VCC/GND to 3.3V/GND; SDA/SCL to board defaults (often GPIO21/22 on classic ESP32, GPIO6/7 on some C6 boards—check your pinout).

3. Create and flash

  1. ESPHome → New device → name living-room-sensor → pick chip type.
  2. Enter Wi-Fi SSID/password (2.4 GHz).
  3. Install → Plug into this computer (first time USB); hold BOOT if flash fails.
  4. Device appears under Settings → ESPHome.

4. Minimal YAML (DHT22)

Edit the device and add or merge:

sensor:
  - platform: dht
    pin: GPIO4
    model: DHT22
    temperature:
      name: "Living Room Temperature"
    humidity:
      name: "Living Room Humidity"
    update_interval: 60s

BME280: use bme280_i2c with i2c: block—see ESPHome BME280.

Install wirelessly (OTA) after the first USB flash.

5. Use in Home Assistant

Entities appear as sensor.living_room_temperature etc. Add to dashboard; automate heating with a Zigbee plug (temperature sensors compared).

Example: turn on radiator plug when below 19 °C between 06:00–22:00—same pattern as Zigbee sensors in our getting started path.

Quick fixes

  • Wi-Fi fails: wrong band (5 GHz), guest isolation, or charge-only USB cable.
  • DHT22 NaN: wiring, GPIO pin, or update_interval under 2 s.
  • Readings high: sensor too close to the ESP32—extend with 20–30 cm wires; optional offset filter in YAML.

Prefer no soldering and battery life? Use Zigbee temperature sensors instead.

All smart-home guides

Have a question about this guide or need advice? Ask us here

Torn between two models or stuck on a build? Drop us a line and we will get back to you by email.