DHT22 Error - it was all working fine, now not so much

HI All,

I wonder if anyone else out there is having a similar issue and can help. some time ago I made some simply sensors using a D1 mini and a DHT22 sensor, everything worked wonderfully so I made enough to dott around my home and used then to report the average temperature of my home. however after a few ESPhome updates I’ve now noticed that the sensors are not reporting any data they ALL report that I need to check the wiring and pullup resistor. If one or two had reported this then I would think"OK, maybe they blew or something happened and I need to get new ones." But ALL my sensors to show the same problem? I’m guessing there is a fix I just don’t know it. also they ALL keep rebooting and again I have no idea why or where to look for the cause.

I don’t know which update caused the issue, or exactly when they stopped working.

any help in solving this would be greatly appreciated… I’m going to strip one of the sensors down to show the wiring, but from the code the DHT22 is connected to 3v, Gr and D2. power is supplied via USB.

thank you for your help and time

kind regards

Robin

Edit:

Here is my current Yaml in full from ESPhome.


esphome:
  name: "sensor-office"
  platform: ESP8266
  board: d1_mini
  on_boot:
    - priority: 400.0 # after sensor setup, before WIFI initialization 
      then:
        - light.turn_on: # indication that the controller has power
            id: office_led
            brightness: 100%
            red: 0%
            green: 0%
            blue: 100%
    - priority: 250.0 # after WIFI initialization
      then:
        - light.turn_on: # indication that the controller is looking for a wifi connection
            id: office_led
            brightness: 100%
            red: 100%
            green: 0%
            blue: 0%
        - delay: '00:00:05'    
    - priority: -100.0 # everything is initialized, system is online - if condition waits for connection
      then:
        if:
          condition:
            wifi.connected:
          then:
            - light.turn_on: # indication of wifi connection confirmation
                id: office_led
                brightness: 100%
                red: 0%
                green: 100%
                blue: 0%
            - delay: '00:00:05'
            - light.turn_on: # confirming that blue led's are working
                id: office_led
                brightness: 100%
                red: 100%
                green: 100%
                blue: 100%
            - delay: '00:00:02'
            - light.turn_off: # turns off light waiting on automation to start
                id: office_led
   

wifi:
  ssid: !secret ssid
  password: !secret password
  manual_ip:
    static_ip: 192.168.0.99
    gateway: 192.168.0.1
    subnet: 255.255.255.0
    dns1: 192.168.0.1
    dns2: 192.168.0.1

    
  
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "office sensor Fallback Hotspot"
    password: !secret appass

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  platform: esphome

# Enable Web server.
web_server:
  port: 80


output:
  - platform: esp8266_pwm
    pin: D1
    id: redgpio
  - platform: esp8266_pwm
    pin: D7
    id: greengpio
  - platform: esp8266_pwm
    pin: D3
    id: bluegpio

light:
  - platform: rgb
    name: "office LED"
    id: office_led
    red: redgpio
    green: greengpio
    blue: bluegpio


sensor:
  - platform: dht
    pin: D2
    model: dht22
    temperature:
      name: "office Temperature"
      on_value_range:
        - below: 16
          then:
            - light.turn_on:
                id: office_led
                brightness: 20%
                red: 0%
                green: 0%
                blue: 100%
        - above: 16
          then:
            - light.turn_on:
                id: office_led
                brightness: 20%
                red: 0%
                green: 100%
                blue: 0%
        - above: 25
          then:
            - light.turn_on:
                id: office_led
                brightness: 20%
                red: 100%
                green: 0%
                blue: 0%
    humidity:
      name: "office Humidity"
    update_interval: 30s

  - platform: wifi_signal
    name: "office WiFi signal"
    update_interval: 600s

  - platform: uptime
    name: "office uptime do not use"
    id: office_uptime
    internal: true
    update_interval: 600s

text_sensor:
  - platform: version
    name: "office ESPHome version"
    
  - platform: template
    name: "office Uptime"
    lambda: |-
      uint32_t dur = id(office_uptime).state;
      int dys = 0;
      int hrs = 0;
      int mnts = 0;
      if (dur > 86399) {
        dys = trunc(dur / 86400);
        dur = dur - (dys * 86400);
      }
      if (dur > 3599) {
        hrs = trunc(dur / 3600);
        dur = dur - (hrs * 3600);
      }
      if (dur > 59) {
        mnts = trunc(dur / 60);
        dur = dur - (mnts * 60);
      }
      char buffer[17];
      sprintf(buffer, "%ud %02uh %02um %02us", dys, hrs, mnts, dur);
      return {buffer};
    icon: mdi:clock-start
    update_interval: 600s

switch:
  - platform: restart
    name: office Restart


Probably caused by Esphome updates, but to get any support you should post your yaml.

HI Karosm,

thank you, I’ve added my full yaml to the original post. (something I’d overlooked)

Looks like some bug, but with quick search I didn’t find anything related. I see you have only one sensor in your yaml. You can try what was suggested, add a 4k7 pullup to your sensor to see if it gets happy.

ps don’t update your original post, it’s very confusing. Just post updated setup every time.

Thank you, I’ve tried the resistor but no joy, I have a new DHT in the post so will try swapping it out and see if that does it.