diff --git a/esphome/components/dht/dht.cpp b/esphome/components/dht/dht.cpp index 5a18f6f36e..f2a33a26ac 100644 --- a/esphome/components/dht/dht.cpp +++ b/esphome/components/dht/dht.cpp @@ -23,6 +23,7 @@ void DHT::dump_config() { } else { ESP_LOGCONFIG(TAG, " Model: DHT22 (or equivalent)"); } + ESP_LOGCONFIG(TAG, " Internal Pull-up: %s", ONOFF(this->pin_->get_flags() & gpio::FLAG_PULLUP)); LOG_UPDATE_INTERVAL(this); @@ -101,7 +102,7 @@ bool HOT IRAM_ATTR DHT::read_sensor_(float *temperature, float *humidity, bool r } else { delayMicroseconds(800); } - this->pin_->pin_mode(gpio::FLAG_INPUT | gpio::FLAG_PULLUP); + this->pin_->pin_mode(this->pin_->get_flags()); { InterruptLock lock; diff --git a/esphome/components/dht/sensor.py b/esphome/components/dht/sensor.py index da92a97e1f..be53df2625 100644 --- a/esphome/components/dht/sensor.py +++ b/esphome/components/dht/sensor.py @@ -34,7 +34,7 @@ DHT = dht_ns.class_("DHT", cg.PollingComponent) CONFIG_SCHEMA = cv.Schema( { cv.GenerateID(): cv.declare_id(DHT), - cv.Required(CONF_PIN): pins.internal_gpio_input_pin_schema, + cv.Required(CONF_PIN): pins.internal_gpio_input_pullup_pin_schema, cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema( unit_of_measurement=UNIT_CELSIUS, accuracy_decimals=1,