Esphome with ESP-01 & DHT11

I’ve purchased this set of ESP-01 with DHT11 temperature and humidity sensor.
https://www.aliexpress.com/item/ESP8266-ESP-01-ESP-01S-Wifi-DHT11-Temperature-Humidity-Sensor-Meter-Module-Wireless-Thermometer-for-NodeMCU/32967287653.html?spm=a2g0s.9042311.0.0.27424c4doegzX9
I’ve uplodaded the folowing code from esphome:

esphome:
  name: esp01
  platform: ESP8266
  board: nodemcu

wifi:
  ssid: '*****'
  password: '******'

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

web_server:
  port: 80
  
sensor:
  - platform: dht
    pin: 2
    temperature:
      name: "Living Room Temperature"
    humidity:
      name: "Living Room Humidity"
    update_interval: 60s

The firmware upload went fine. the web server is running, both temperature and humidity sensors are registered. I can also see the esp01 integration with both sensors in my Home Assistant. However, no temperature or humidity values are shown. I suspect it may have something to do with invalid pin number, but I’ve tried different values and none work. What pin number should be used on ESP-01?

found the solution here. it works now

5 Likes

the pin:2 is physically the GPIO2

thanks for the answer.

Hi, I’m sorry for bringing this thread to life again but facing the issue now, could you please mention what specifically helped you from that thread?

Thanks in advance.

Hi, I don’t remember exactly what, but I think I had wrong board type specified. Instead of “board: nodemcu” should be “board: esp01_1m”