Is DHT11 Temperature & Humidity Sensor Compatible with Home Assistant (ESPHome)?
Electrical Specifications
Always confirm pin assignments against the manufacturer datasheet before wiring.
Compatibility Overview
Entry-level digital temperature and humidity sensor module with resistor pull-up for basic room monitoring.
Wiring DHT11 Temperature & Humidity Sensor to ESP32
| Module pin | ESP32 | Note |
|---|---|---|
| VCC / + | 3V3 | 3–5.5V. If you power it at 5V, the pull-up on the data line must still go to 3.3V, or the pin sees 5V. |
| DATA / S | GPIO4 | Three-pin modules have the 10kΩ pull-up on board. A bare four-pin sensor needs 4.7–10kΩ from DATA to VCC; its third pin is unconnected. |
| GND / − | GND |
Host pins are the ones the configuration on this page uses. Move a pin here and change it in the YAML — they are documented together so they cannot disagree.
Technical Specification Matrix
| Feature / Attribute | Specification / Status |
|---|---|
| Hardware Protocol | Digital Single-Wire / 3.3V |
| Bridge Required | NO |
| Border Router Needed | None |
| Hardware Capabilities & Peripherals | Temperature (C) Humidity (%) Note: these entities come from the ESPHome configuration you flash — each one needs its matching component in that YAML before it appears. |
| Pairing Complexity | Plug-and-Play |
| Factory Reset Instruction | Hold BOOT button for 3s. |
Wire, Flash, Adopt, Check
Wire it up
Follow the wiring table above. The ESP32 pins there are the ones the configuration uses, so if you move one, change it in both places.
Flash the configuration
Create a new device in the ESPHome dashboard (the Home Assistant add-on) and paste the configuration below into it, or save it as emb_esp32_dht11_ha.yaml and run esphome run emb_esp32_dht11_ha.yaml. The first flash goes over USB. If it is not detected, hold BOOT button for 3s to put it in download mode. Every update after that is over the air.
Adopt it in Home Assistant
Settings → Devices & Services. A node on the same network shows up as a discovered ESPHome device within a minute of joining Wi-Fi; choose Configure and enter the API encryption key from your secrets.yaml. If discovery does not find it, add the ESPHome integration by hand with the node's IP address.
Check it works
Temperature and Humidity appear in Home Assistant within the first update interval, and breathing on the sensor lifts humidity by twenty points. Values of NaN on every read are the pull-up; a temperature of exactly 0 with humidity 0 is the model set wrong.
ESPHome Configuration
Starting configuration for DHT11 Temperature & Humidity Sensor on ESP32. Untested on hardware — verify wiring and pins against your own board.
# ESPHome configuration for DHT11 Temperature & Humidity Sensor
# Host: ESP32. Pin numbers below are host-side defaults — any free
# GPIO will do, and you should change them to match your own wiring.
esphome:
name: emb_esp32_dht11_ha
friendly_name: "DHT11 Temperature & Humidity Sensor"
esp32:
board: esp32dev
framework:
type: esp-idf
logger:
api:
encryption:
key: !secret api_encryption_key
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
sensor:
- platform: dht
pin: GPIO4
model: DHT11
temperature:
name: "Temperature"
humidity:
name: "Humidity"
update_interval: 60s
Before you flash:
the !secret values come from your
secrets.yaml, and the GPIO numbers are host-side
defaults rather than properties of this part — change them to match how you actually wired it.
What Appears in Home Assistant
Whole degrees. That is the resolution of the part, not a config setting.
Whole percent, valid between 20% and 80% RH.
Known Problems and Fixes
What ±2°C and ±5%RH mean in practice
Two DHT11s in the same room disagree by a few degrees and ten percent. It is a "roughly what is it like in here" sensor. Anything that controls heating or a dehumidifier deserves an SHT31 or BME280.
Set the model
A DHT11 read as a DHT22 returns plausible-looking wrong numbers, and AUTO_DETECT guesses wrong often enough to matter. model: DHT11 in the config is deliberate.
Failed reads are normal
The single-wire protocol is timing-sensitive and the occasional read fails, with a line in the log. Once a minute is plenty for this sensor and leaves the failures invisible; sub-2s intervals make them frequent.
Keep the wire short
A metre of cable with the onboard pull-up works. Beyond that, drop the pull-up to 4.7kΩ or lower and accept more failed reads.
Condensation kills it
The element does not recover from a dew event. Outdoors, or in a bathroom, it wants a vented enclosure and the expectation of replacing it.
Report a Pinout Error or Submit Tested Code Snippets
Found a pin mapping quirk or built a custom ESPHome YAML driver for DHT11 Temperature & Humidity Sensor? Submit a pull request or report corrections to our index.
Hardware Correction Reporter (emb-esp32-dht11-ha)
Frequently Asked Questions
Does DHT11 Temperature & Humidity Sensor work without an internet connection?
How is DHT11 Temperature & Humidity Sensor powered and wired to the host board?
How does the host board reach Home Assistant (ESPHome)?
Alternatives
DHT22 AM2302 Temp & Humidity Sensor
Same wiring and protocol, 0.1° resolution and ±0.5°C. The obvious step up.
AHT20 Humidity & Temperature Sensor
I2C, cheaper than a DHT22, and better than both.
SHT31 Digital Temp & Humidity Sensor
The part to use where the reading controls something.
BME280 Temp Humidity & Pressure Sensor
Adds pressure, on I2C.