DHT Sensor


The dht sensor platform allows you to get the current temperature and humidity from a DHT11, DHT22 or AM2302 device.

Configuration

To use your DHTxx sensor in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
sensor:
  platform: dht
  sensor: DHT22
  pin: 23
  monitored_conditions:
    - temperature
    - humidity

Configuration Variables

sensor

(string)(Required)

The sensor type, supported devices are DHT11, DHT22, and AM2302.

pin

(integer)(Required)

The pin the sensor is connected to.

name

(string)(Optional)

The name of the sensor.

Default value:

DHT Sensor

monitored_conditions

(list)(Required)

Conditions to monitor. Available conditions are only temperature and humidity.

temperature

Temperature at the sensor’s location.

humidity

Humidity level at the sensor’s location.

temperature_offset

(integer | float)(Optional)

Add or subtract a value from the temperature.

Default value:

0

humidity_offset

(integer | float)(Optional)

Add or subtract a value from the humidity.

Default value:

0

The name of the pin to which the sensor is connected has different names on different platforms. ‘P8_11’ for Beaglebone, ‘23’ for Raspberry Pi.

Example

An example for a Raspberry Pi 3 with a DHT22 sensor connected to GPIO4 (pin 7):

sensor:
  - platform: dht
    sensor: DHT22
    pin: 4
    temperature_offset: 2.1
    humidity_offset: -3.2
    monitored_conditions:
      - temperature
      - humidity