From 9de8eaff24f63a0acc25fdc555babfc3b54c7b27 Mon Sep 17 00:00:00 2001 From: Erdem Date: Thu, 30 May 2024 08:31:09 +0300 Subject: [PATCH] Fix DHT reading timing for SI7021 on ESP32 (#6604) Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> --- esphome/components/dht/dht.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/esphome/components/dht/dht.cpp b/esphome/components/dht/dht.cpp index 5112092073..db1c851d5f 100644 --- a/esphome/components/dht/dht.cpp +++ b/esphome/components/dht/dht.cpp @@ -86,9 +86,14 @@ bool HOT IRAM_ATTR DHT::read_sensor_(float *temperature, float *humidity, bool r if (this->model_ == DHT_MODEL_DHT11) { delayMicroseconds(18000); } else if (this->model_ == DHT_MODEL_SI7021) { +#ifdef USE_ESP8266 delayMicroseconds(500); this->pin_->digital_write(true); delayMicroseconds(40); +#else + delayMicroseconds(400); + this->pin_->digital_write(true); +#endif } else if (this->model_ == DHT_MODEL_DHT22_TYPE2) { delayMicroseconds(2000); } else if (this->model_ == DHT_MODEL_AM2120 || this->model_ == DHT_MODEL_AM2302) {