Multiple DHT22 sensors

I am configuring 2 DHT22 sensors in the configuration.yaml as follows:

  - platform: dht
    sensor: DHT22
    pin: 17
    monitored_conditions:
      - temperature
      - humidity

  - platform: dht
    sensor: DHT22
    pin: 25
    monitored_conditions:
      - temperature
      - humidity

This will generate four sensors:

sensor.dht_sensor_humidity
sensor.dht_sensor_temperature
sensor.dht_sensor_humidity_2
sensor.dht_sensor_temperature_2

But how can I know what order they are in? In the actual server sensor.dht_sensor_temperature_2 refers to the first sensor declared in the YAML file, which leads me to believe that they can be loaded in any order. So when I try to name them in the customize section. I do not know which is which.

Those sensors have an optional “name” parameter.

1 Like

Totally correct. I had tried using the name parameter but since I had a “friendly_name” it took precedence. Eliminating the friendly_name and now it works. Thanks!

Actually I got confused. The test is not working… The Name parameter is having no effect. This is the new config:

  - platform: dht
    sensor: DHT22
    Name: Room
    pin: 17
    monitored_conditions:
      - temperature
      - humidity

  - platform: dht
    sensor: DHT22
    Name: Hall
    pin: 25
    monitored_conditions:
      - temperature
      - humidity

but the sensors I receive are the same

sensor.dht_sensor_humidity
sensor.dht_sensor_temperature
sensor.dht_sensor_humidity_2
sensor.dht_sensor_temperature_2

Python is case sensitive.
Give name: Hall a try.

1 Like

Just realized that! thanks!! And yes it works!