From c2028f73786ad1d969958bf058ef42374a242916 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sat, 31 Aug 2019 21:14:10 +0200 Subject: [PATCH] DHT publish NAN on invalid reading Fixes https://github.com/esphome/issues/issues/590 --- esphome/components/dht/dht.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/components/dht/dht.cpp b/esphome/components/dht/dht.cpp index 936f87e3fa..1e28246bee 100644 --- a/esphome/components/dht/dht.cpp +++ b/esphome/components/dht/dht.cpp @@ -56,6 +56,8 @@ void DHT::update() { str = " and consider manually specifying the DHT model using the model option"; } ESP_LOGW(TAG, "Invalid readings! Please check your wiring (pull-up resistor, pin number)%s.", str); + this->temperature_sensor_->publish_state(NAN); + this->humidity_sensor_->publish_state(NAN); this->status_set_warning(); } }