AM2302 ESPHome Compatibility Problem

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).

Thank you for you tipp … tried the
model : DHT22 - no success
model : AM2302 - no success !

As mentioned by you I need to install the dev. version of ESP home ( not sure where to find … but will dig ) .
Will try and update this thread.

Add this repository:

https://github.com/esphome/hassio

You should then be able to add the dev version.

wow … that is nice of you . Thank you “tom_I” will do it.

oops … i seem to have the same issues … even with the dev. version.

sensor:
  - platform: dht
    model:  DHT22_TYPE2
    pin: 4  #GPIO2
    temperature:
      name: "Cellar Room Temperature"
    humidity:
      name: "Cellar Room Humidity"
    update_interval: 20s

17:43:38][C][wifi:307]:   Hostname: 'esp_5'
[17:43:38][C][wifi:311]:   Signal strength: -70 dB ▂▄▆█
[17:43:38][C][wifi:315]:   Channel: 6
[17:43:38][C][wifi:316]:   Subnet: 255.255.255.0
[17:43:38][C][wifi:317]:   Gateway: 192.168.1.1
[17:43:38][C][wifi:318]:   DNS1: 192.168.1.1
[17:43:38][C][wifi:319]:   DNS2: (IP unset)
[17:43:38][C][logger:185]: Logger:
[17:43:38][C][logger:186]:   Level: DEBUG
[17:43:38][C][logger:187]:   Log Baud Rate: 115200
[17:43:38][C][logger:188]:   Hardware UART: UART0
[17:43:38][C][dht:017]: DHT:
[17:43:38][C][dht:018]:   Pin: GPIO4 (Mode: INPUT)
[17:43:38][C][dht:024]:   Model: DHT22 (or equivalent)
[17:43:38][C][dht:027]:   Update Interval: 20.0s
[17:43:38][C][dht:029]:   Temperature 'Cellar Room Temperature'
[17:43:38][C][dht:029]:     Unit of Measurement: '°C'
[17:43:38][C][dht:029]:     Accuracy Decimals: 1
[17:43:38][C][dht:029]:     Icon: 'mdi:thermometer'
[17:43:38][C][dht:030]:   Humidity 'Cellar Room Humidity'
[17:43:38][C][dht:030]:     Unit of Measurement: '%'
[17:43:38][C][dht:030]:     Accuracy Decimals: 0
[17:43:38][C][dht:030]:     Icon: 'mdi:water-percent'
[17:43:38][C][captive_portal:169]: Captive Portal:
[17:43:38][C][ota:029]: Over-The-Air Updates:
[17:43:38][C][ota:030]:   Address: esp_5.local:8266
[17:43:38][C][ota:032]:   Using Password.
[17:43:38][C][api:095]: API Server:
[17:43:38][C][api:096]:   Address: esp_5.local:6053
[17:43:38][W][dht:162]: Requesting data from DHT failed!
[17:43:38][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[17:43:38][D][sensor:092]: 'Cellar Room Temperature': Sending state nan °C with 1 decimals of accuracy
[17:43:38][D][sensor:092]: 'Cellar Room Humidity': Sending state nan % with 0 decimals of accuracy
[17:43:44][D][api.connection:604]: Client 'Home Assistant 2021.1.0 (192.168.1.128)' connected successfully!
[17:43:45][D][api.connection:604]: Client 'Home Assistant 2021.1.0 (192.168.1.128)' connected successfully!
[17:43:58][W][dht:162]: Requesting data from DHT failed!
[17:43:58][W][dht:060]: Invalid readings! Please check your wiring (pull-up resistor, pin number).
[17:43:58][D][sensor:092]: 'Cellar Room Temperature': Sending state nan °C with 1 decimals of accuracy
[17:43:58][D][sensor:092]: 'Cellar Room Humidity': Sending state nan % with 0 decimals of accuracy
´´´

Can you sketch your wiring and post it here?

I have taken pic of my wiring … hope that is not a issue

tried with ESP home beta … same error code as before - Invalid readings! …
Not sure if this helps to resolve. during compiling the code these were the two errors that showed up …
´´´
Compiling /data/esp_5/.pioenvs/esp_5/lib87b/ESPAsyncWebServer-esphome/WebRequest.cpp.o
In file included from /data/esp_5/.piolibdeps/esp_5/ESPAsyncWebServer-esphome/src/SPIFFSEditor.cpp:1:0:
/data/esp_5/.piolibdeps/esp_5/ESPAsyncWebServer-esphome/src/SPIFFSEditor.h:16:101: warning: ‘SPIFFS’ is deprecated (declared at /root/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/FS.h:269): SPIFFS has been deprecated. Please consider moving to LittleFS or other filesystems. [-Wdeprecated-declarations]
SPIFFSEditor(const String& username=String(), const String& password=String(), const fs::FS& fs=SPIFFS);
^
Compiling /data/esp_5/.pioenvs/esp_5/lib87b/ESPAsyncWebServer-esphome/WebResponses.cpp.o
´´´
and

``
INFO Successfully compiled program.
INFO Resolving IP address of esp_5.local
WARNING Exception occurred:
Traceback (most recent call last):
File “/opt/esphome/esphome/zeroconf.py”, line 486, in handle_read
data, (addr, port) = socket_.recvfrom(_MAX_MSG_ABSOLUTE)
OSError: [Errno 9] Bad file descriptor
INFO -> 192.168.x.xx
INFO Uploading /data/esp_5/.pioenvs/esp_5/firmware.bin (401984 bytes)
Uploading: [============================================================] 100% Done…

INFO Waiting for result…
INFO OTA successful

``

has this got anything to do with that

I can’t really tell what is going on other than your soldering is not good (very likely the issue) and even if the DHT was working it would be no use as it would be self heating from the ESP board.

Thank you for your help … will keep trying …

@Indysach, how/why are you using GPIO4? Looking at the pinout for an ESP01 there isn’t any GPIO4:
image

Looking at your pictures, I can’t tell which pin you have it connected to. If you can see the diagram and find the GPIO you’re using you should write your ESPHome YAML file with the correct GPIO.

Also, please post your whole ESPHome YAML file if you want help (with proper formatting). There may be mistakes in the board designations. ESPHome usually does a pretty good job of detecting when you’re trying to use pins that don’t exist so I’m wondering if you’ve chosen the wrong ESP device…

  • I have in the meantime changed the Resistor from 10K to 4.8 K - No Success
  • I have tried ever pin possible which the code editor has allowed … 1- 4 - No success
  • I have tried all the model variations in combination with the pins 1 -4 - No Success !
    I am using the Home Assistant (dev) mode