DHT22 - Sensor not working - Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11

Hi, my DHT22 Sensor not working - getting the below error message

Code
"

sensor:

  • platform: dht
    pin: 3
    temperature:
    name: “Living Room Temperature”
    humidity:
    name: “Living Room Humidity”
    update_interval: 60s
    "

Error Message

option.
[18:11:45][D][sensor:094]: ‘Living Room Temperature’: Sending state nan °C with 1 decimals of accuracy
[18:11:45][D][sensor:094]: ‘Living Room Humidity’: Sending state nan % with 0 decimals of accuracy
[18:12:11][D][api:102]: Accepted 192.168.1.13
[18:12:11][W][api.connection:083]: 192.168.1.13: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[18:12:45][W][dht:169]: Requesting data from DHT failed!
[18:12:45][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.
[18:12:45][D][sensor:094]: ‘Living Room Temperature’: Sending state nan °C with 1 decimals of accuracy
[18:12:45][D][sensor:094]: ‘Living Room Humidity’: Sending state nan % with 0 decimals of accuracy
[18:12:47][I][ota:117]: Boot seems successful, resetting boot loop counter.
[18:12:47][D][esp32.preferences:114]: Saving 1 preferences to flash…
[18:12:47][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[18:13:11][D][api:102]: Accepted 192.168.1.13
[18:13:11][W][api.connection:083]: 192.168.1.13: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11

wire connection
Capture

Looks like you need a pull up resistor, That’s something like 4k7 or 10k from signal to VCC.

1 Like

Could you please confirm on which PIN (sensor) i need to put the resistor on ?

It needs to be connected between the pins on the sensor. This can be done either where it is connected to.the esp or directly on the sensor. So gpio3 to vcc.

1 Like

okay, i will put the 10k resistor Gpio3 to vcc and do the testing again. will get back
Thanks suggestion

It’s also in the docs.

It also tells you in the log line 18:12:45. When ever I get that message just adding a resistor sorts it out. But the easy way is to buy you sensors already mounted on a small board as they have the pull up built in.

i have connected the resistor between VCC and Data PIN - this time is got the temperature value but socket error still coming

[15:52:05][C][mdns:116]: Hostname: dht-temperature
[15:52:05][C][ota:097]: Over-The-Air Updates:
[15:52:05][C][ota:098]: Address: dht-temperature.local:3232
[15:52:05][C][ota:101]: Using Password.
[15:52:05][C][api:139]: API Server:
[15:52:05][C][api:140]: Address: dht-temperature.local:6053
[15:52:05][C][api:142]: Using noise encryption: YES
[15:52:31][D][api:102]: Accepted 192.168.1.13
[15:52:31][W][api.connection:092]: : Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[15:52:58][D][dht:048]: Got Temperature=20.8°C Humidity=41.7%
[15:52:58][D][sensor:094]: ‘Living Room Temperature’: Sending state 20.80000 °C with 1 decimals of accuracy
[15:52:58][D][sensor:094]: ‘Living Room Humidity’: Sending state 41.70000 % with 0 decimals of accuracy
[15:53:31][D][api:102]: Accepted 192.168.1.13
[15:53:31][W][api.connection:092]: : Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[15:53:58][D][dht:048]: Got Temperature=20.6°C Humidity=42.3%
[15:53:58][D][sensor:094]: ‘Living Room Temperature’: Sending state 20.60000 °C with 1 decimals of accuracy
[15:53:58][D][sensor:094]: ‘Living Room Humidity’: Sending state 42.30000 % with 0 decimals of accuracy
[15:54:31][D][api:102]: Accepted 192.168.1.13
[15:54:31][W][api.connection:092]: : Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[15:54:58][D][dht:048]: Got Temperature=20.5°C Humidity=42.0%

In my experience, just reboot and that will disappear, may take a couple of boots. This is assuming you have set the api in the code and connected that to HA with said API code.

I have just been having this issue with one of my d1 minis Every time I update it it does this fault a few times but settles down soon. I either just leave it for an hour or so before i look again at its output or reboot it a few times.

Finally, it working – Socker error will not fix - there might be some bug or compatibility issue
Manually discover the Device in ESPhome with ip add of sensor

Below link i have used for reference
New device won’t show in HA? - ESPHome - Home Assistant Community (home-assistant.io)