1.在esphome裏面加入如下配置代碼。
sensor:
- platform: dht
pin: GPIO23
temperature:
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
update_interval: 60s
model: DHT11
2.將dht11連接到esp32的3.3v 、GND和GPIO23,打開homeassistant,即可自動發現esp32,讀取溫溼度狀態