Hey all,
I’m new to ESPHome and have been trying to get some basic experience under my belt before moving forward with a simple hydroponics setup. My goal with this straightforward initial project has been to connect a DHT22 temperature and humidity sensor to HA using an ESP32 via ESPHome.
Unfortunately, I’ve run into a roadblock, and I’m not sure where to go from here despite scouring resources online. I’ve been using this tutorial guide along with a few others to help work through things.
So far I’ve:
- installed ESPHome and created a new node via the web UI
- manually downloaded the bin file to install and flashed the ESP32 using esphome flasher
- went to Settings > Integrations and added the node manually via its IP address on my network (router doesn’t support mDNS) which allowed HA to detect the device
- applied a manual IP to the device via ESPHome to get ESPHome to recognize the device as online
- wired the DHT22 to my ESP32 (data pin to GPIO2 and powered via 3v3)
With the steps above I can see my device online in ESPHome, but according to the tutorials it seems as if the sensor should be automatically detected from this point. I don’t see any new sensor in HA and don’t see any sensor measurements via the ESPHome log or the serial logs for the device.
Log for the device is as follows:
INFO Reading configuration /config/esphome/testtemp32.yaml...
WARNING GPIO4 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Starting log output from 192.168.0.28 using esphome API
INFO Successfully connected to 192.168.0.28
[18:33:43][I][app:102]: ESPHome version 2023.3.2 compiled on Apr 16 2023, 18:59:03
[18:33:43][C][wifi:504]: WiFi:
[18:33:43][C][wifi:362]: Local MAC: E0:5A:1B:A1:24:64
[18:33:43][C][wifi:363]: SSID: 'Aperture Science'[redacted]
[18:33:43][C][wifi:364]: IP Address: 192.168.0.28
[18:33:43][C][wifi:366]: BSSID: 02:83:CC:E0:6A:19[redacted]
[18:33:43][C][wifi:367]: Hostname: 'testtemp32'
[18:33:43][C][wifi:369]: Signal strength: -29 dB ▂▄▆█
[18:33:43][C][wifi:373]: Channel: 11
[18:33:43][C][wifi:374]: Subnet: 255.255.255.0
[18:33:43][C][wifi:375]: Gateway: 192.168.0.1
[18:33:43][C][wifi:376]: DNS1: 0.0.0.0
[18:33:43][C][wifi:377]: DNS2: 0.0.0.0
[18:33:43][C][logger:293]: Logger:
[18:33:43][C][logger:294]: Level: DEBUG
[18:33:43][C][logger:295]: Log Baud Rate: 115200
[18:33:43][C][logger:296]: Hardware UART: UART0
[18:33:43][C][captive_portal:088]: Captive Portal:
[18:33:43][C][mdns:108]: mDNS:
[18:33:43][C][mdns:109]: Hostname: testtemp32
[18:33:43][C][ota:093]: Over-The-Air Updates:
[18:33:43][C][ota:094]: Address: 192.168.0.28:3232
[18:33:43][C][ota:097]: Using Password.
[18:33:43][C][api:138]: API Server:
[18:33:43][C][api:139]: Address: 192.168.0.28:6053
[18:33:43][C][api:141]: Using noise encryption: YES
[18:33:51][D][api:102]: Accepted 192.168.0.8
[18:33:51][W][api.connection:071]: 192.168.0.8: Socket operation failed: CONNECTION_CLOSED errno=128
[18:34:51][D][api:102]: Accepted 192.168.0.8
[18:34:51][W][api.connection:071]: 192.168.0.8: Socket operation failed: CONNECTION_CLOSED errno=128
[18:35:51][D][api:102]: Accepted 192.168.0.8
[18:35:51][W][api.connection:071]: 192.168.0.8: Socket operation failed: CONNECTION_CLOSED errno=128
[18:36:51][D][api:102]: Accepted 192.168.0.8
[18:36:51][W][api.connection:071]: 192.168.0.8: Socket operation failed: CONNECTION_CLOSED errno=128
My config entry for the device is as follows:
esphome:
name: testtemp32
friendly_name: testtemp32
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xyz"
ota:
password: "xyz"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
# Set this to the IP of the ESP
static_ip: 192.168.0.28
# Set this to the IP address of the router. Often ends with .1
gateway: 192.168.0.1
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Testtemp32 Fallback Hotspot"
password: "xyz"
sensor:
- platform: dht
pin: GPIO2
temperature:
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
update_interval: 30s
model: DHT22
captive_portal:
A picture of the wiring setup:
I notice a repeating error in my log, but haven’t been able to figure out how to troubleshoot it, though I can’t even be sure it’s relevant to the sensor not being detected.
I didn’t expect to hit a wall with how simple this intro project looked from reading instructions online, but I’m genuinely really excited to keep moving forward! Any thoughts from the community on how best to proceed?
