AM2302 ESPHome Compatibility Problem

@truglodite, if you’re right that’s probably what I’ll do. I’m not a fan of customizing stuff just to make it work.

Try changing the model in your ESPHOME config.

Are you talking about the board: tag or the platform: tag? I had tried using board: nodemcuv2 but that didn’t fix it. Any specific suggestions? It looks like there are quite a few options to choose from…

I just got a few in the mail but haven’t tried them out yet. I only went to China because they’re so pricey on Amazon. Hopefully the batch of lolin nodemcu’s i ordered aren’t garbage too :frowning:

This

model: AM2302

Try the other models. DHT22, or DHT11.

There is also DHT22_TYPE2 in dev release

1 Like

I tried AUTO_DETECT, DHT11, DHT22, RHT03, and SI7021 – all of them result in this type of response:

[06:35:20][W][dht:160]: Requesting data from DHT failed!
[06:35:20][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[06:35:20][D][sensor:092]: 'Temperature': Sending state nan °C with 1 decimals of accuracy
[06:35:20][D][sensor:092]: 'Humidity': Sending state nan % with 0 decimals of accuracy
[06:35:25][W][dht:160]: Requesting data from DHT failed!
[06:35:25][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[06:35:25][D][sensor:092]: 'Temperature': Sending state nan °C with 1 decimals of accuracy
[06:35:25][D][sensor:092]: 'Humidity': Sending state nan % with 0 decimals of accuracy

I wonder when this will make it into the prod release. I’ve not used dev before, do I need to remove prod and install dev or is dev an adder to the normal installation?

You need to stop the ESPHome add-on, install and start the dev one. Recompile the firmware and upload it.

If you want to go back, stop the dev addon and start the first one

Ok, I tried it out with the dev version of ESPHome (I really like the tighter layout of devices!!) and DHT_TYPE2 as the model lo and behold it works!

[22:06:47][D][dht:048]: Got Temperature=27.0°C Humidity=38.7%
[22:06:47][D][sensor:092]: 'Temperature': Sending state 27.00000 °C with 1 decimals of accuracy
[22:06:47][D][sensor:092]: 'Humidity': Sending state 38.70000 % with 0 decimals of accuracy
[22:06:52][D][dht:048]: Got Temperature=27.0°C Humidity=38.7%
[22:06:52][D][sensor:092]: 'Temperature': Sending state 27.00000 °C with 1 decimals of accuracy
[22:06:52][D][sensor:092]: 'Humidity': Sending state 38.70000 % with 0 decimals of accuracy
[22:06:57][D][dht:048]: Got Temperature=27.0°C Humidity=38.7%
[22:06:57][D][sensor:092]: 'Temperature': Sending state 27.00000 °C with 1 decimals of accuracy
[22:06:57][D][sensor:092]: 'Humidity': Sending state 38.70000 % with 0 decimals of accuracy

@makai, is there any drawback to running the dev version? I might have to do that from now on if I don’t run across any issues. Unfortunately, it still has the ESPhome freezes during compile. :cry:

Thanks for the suggestion!

2 Likes

Nice!
You may encounter some bugs maybe. I have no issue here.

There may be undocumented changes and possibly some stability issues, but I’ve never had an issue with the short periods of time that I used it.

Not beside the possibilities of broken things. But in general dev is quite stable.

It is even possible to run esphome and esphome dev in parallel (each has it’s own hassio addon). They will not conflict and having mixed versions registered in home assistant also has no drawbacks.

I’m running both versions in parallel since a long time because I always have some bleeding edge nodes running the dev version. No problems what so ever

1 Like

Is there a reason that the dev version reinstalls itself when I click restart? I noticed that the dev version takes a LOT longer to fire up than the prod version. Looking at the logs, it appears to reinstall the whole ESPHome dev app on a click of the restart button. Is that by design for some reason?

Yes that would be by design to keep up to date with any recently merged PR’s.

Just got mine up and running. I too had to use the DHT_TYPE2. This feature is available in the ESPHome beta too, if anyone is interested.

1 Like

Hello All , Greetings to you all … this is my first post.
and I am a newbee to all these IoT Sensor and HA.
I have managed to get some ESP 8266 Relay modules working … Thx to this community :slight_smile:

I am stuck on the next project DTH 22 Sensor
my setup : RPi 4 - 2 GB Ram --> connected to my Router via Cable

HA version : 5.10

the Humidity and Temp sensor is mounted on the ESP-01S DHT22 Board from Aliexpress ! --> connected via ESP 8266 (esp01_01m board)

I am getting the same problem or error reading as mentioned above by " SpikeyGGGreg Grotsky"

The quote with Invalid Readings…

this is my code

#Humidity and Temperature Sensor for Cellar
‘’’’
sensor:

  • platform: dht
    pin: 4 #GPIO2
    temperature:
    name: “Cellar Room Temperature”
    humidity:
    name: “Cellar Room Humidity”
    update_interval: 20s ‘’’’

The sensor is the AM2302 , i have put a 10K resistor between VCC and Pin 2 ( Data) … no success with t

when i try to connect it on the Dashboard using the Entity as sensor.cellar_room_humidity : HA says
“Entity is non-numeric: sensor.cellar_room_humidity”

where have i gone wrong ?.

What state is the sensor reporting in the ESPHome terminal window?

Have you tried specifying the DHT model, as noted above the auto detection is flaky.

Also please read point 11 here. See how this is much easier to see the indentation (which is very important):

sensor:
  platform: dht
  pin: 4 
  model: DHT22 #### also try AM2302, and DHT22_TYPE2 in dev release  but try DHT22 first. #### 
  temperature:
    name: 'Cellar Room Temperature'
  humidity:
    name: 'Cellar Room Humidity'
  update_interval: 20s 

in the ESP Home window you mean ( where you edit or upload the code) … its in Green

when i read the log … this is its output ! hope this help you to dig deeper in helping me

[16:52:56][C][wifi:307]: Hostname: ‘esp_5’
[16:52:56][C][wifi:311]: Signal strength: -70 dB ▂▄▆█
[16:52:56][C][wifi:315]: Channel: 6
[16:52:56][C][wifi:316]: Subnet: 255.255.255.0
[16:52:56][C][wifi:317]: Gateway: 192.168.x.x
[16:52:56][C][wifi:318]: DNS1: 192.168.x.x
[16:52:56][C][wifi:319]: DNS2: (IP unset)
[16:52:56][C][logger:185]: Logger:
[16:52:56][C][logger:186]: Level: DEBUG
[16:52:56][C][logger:187]: Log Baud Rate: 115200
[16:52:56][C][logger:188]: Hardware UART: UART0
[16:52:56][C][dht:017]: DHT:
[16:52:56][C][dht:018]: Pin: GPIO4 (Mode: INPUT)
[16:52:56][C][dht:020]: Auto-detected model: DHT22
[16:52:56][C][dht:027]: Update Interval: 20.0s
[16:52:56][C][dht:029]: Temperature ‘Cellar Room Temperature’
[16:52:56][C][dht:029]: Unit of Measurement: ‘°C’
[16:52:56][C][dht:029]: Accuracy Decimals: 1
[16:52:56][C][dht:029]: Icon: ‘mdi:thermometer’
[16:52:56][C][dht:030]: Humidity ‘Cellar Room Humidity’
[16:52:56][C][dht:030]: Unit of Measurement: ‘%’
[16:52:56][C][dht:030]: Accuracy Decimals: 0
[16:52:56][C][dht:030]: Icon: ‘mdi:water-percent’
[16:52:56][C][captive_portal:169]: Captive Portal:
[16:52:56][C][ota:029]: Over-The-Air Updates:
[16:52:56][C][ota:030]: Address: esp_5.local:8266
[16:52:56][C][ota:032]: Using Password.
[16:52:56][C][api:095]: API Server:
[16:52:56][C][api:096]: Address: esp_5.local:6053
[16:53:07][W][dht:162]: Requesting data from DHT failed!
[16:53:07][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number) and consider manually specifying the DHT model using the model option.
[16:53:07][D][sensor:092]: ‘Cellar Room Temperature’: Sending state nan °C with 1 decimals of accuracy
[16:53:07][D][sensor:092]: ‘Cellar Room Humidity’: Sending state nan % with 0 decimals of accuracy
[16:53:27][W][dht:162]: Requesting data from DHT failed!
[16:53:27][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number) and consider manually specifying the DHT model using the model option.
[16:53:27][D][sensor:092]: ‘Cellar Room Temperature’: Sending state nan °C with 1 decimals of accuracy
[16:53:27][D][sensor:092]: ‘Cellar Room Humidity’: Sending state nan % with 0 decimals of accuracy
[16:53:47][W][dht:162]: Requesting data from DHT failed!
[16:53:47][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number) and consider manually specifying the DHT model using the model option.
[16:53:47][D][sensor:092]: ‘Cellar Room Temperature’: Sending state nan °C with 1 decimals of accuracy
[16:53:47][D][sensor:092]: ‘Cellar Room Humidity’: Sending state nan % with 0 decimals of accuracy
[16:54:07][W][dht:162]: Requesting data from DHT failed!
[16:54:07][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number) and consider manually specifying the DHT model using the model option.
[16:54:07][D][sensor:092]: ‘Cellar Room Temperature’: Sending state nan °C with 1 decimals of accuracy
[16:54:07][D][sensor:092]: ‘Cellar Room Humidity’: Sending state nan % with 0 decimals of accuracy

Auto-detected model: DHT22
...
...Sending state nan
...
Requesting data from DHT failed!
...
Invalid readings! Please check your wiring (pull-up resistor, pin number) and consider manually specifying the DHT model using the model option.

Do what I said in the comment in my posted code.

But try the AM2302, and DHT22_TYPE2 models (for which you will need the Dev version of ESPHome).