DHT Temperature+Humidity Sensor

The DHT Temperature+Humidity sensor allows you to use your DHT11 (datasheet, adafruit), DHT22 (datasheet, adafruit), AM2302 (datasheet, adafruit) and RHT03 (datasheet, sparkfun) sensors with esphomelib.

../../../_images/dht-full.jpg

DHT22 Temperature & Humidity Sensor.

The DHT22 and DHT11 require external pull up resistors on the data line. To do this, solder a resistor with about 4.7kΩ (anything in the range from 1kΩ to 10kΩ probably works fine, but if you’re having issues try the 4.7kΩ recommended by the manufacturer) between DATA and 3.3V.

../../../_images/temperature-humidity.png
# Example configuration entry
sensor:
  - platform: dht
    pin: D2
    temperature:
      name: "Living Room Temperature"
    humidity:
      name: "Living Room Humidity"
    update_interval: 15s

Configuration variables:

  • pin (Required, Pin): The pin where the DHT bus is connected.
  • temperature (Required): The information for the temperature sensor.
    • name (Required, string): The name for the temperature sensor.
    • id (Optional, ID): Set the ID of this sensor for use in lambdas.
    • All other options from Sensor and MQTT Component.
  • humidity (Required): The information for the humidity sensor
    • name (Required, string): The name for the humidity sensor.
    • id (Optional, ID): Set the ID of this sensor for use in lambdas.
    • All other options from Sensor and MQTT Component.
  • model (Optional, int): Manually specify the DHT model, can be one of AUTO_DETECT, DHT11, DHT22, AM2302, RHT03 and helps with some connection issues. Defaults to AUTO_DETECT.
  • update_interval (Optional, Time): The interval to check the sensor. Defaults to 15s. See update_interval gotchas.

Note

If you’re seeing lots of invalid temperature/humidity warnings in the logs, try manually setting the DHT model with the model: configuration variable. Other problems could be wrong pull-up resistor values on the DATA pin or too long cables.