diff --git a/esphome/components/esp32_touch/esp32_touch_v1.cpp b/esphome/components/esp32_touch/esp32_touch_v1.cpp index f5410f910e..2c1f7a79e0 100644 --- a/esphome/components/esp32_touch/esp32_touch_v1.cpp +++ b/esphome/components/esp32_touch/esp32_touch_v1.cpp @@ -171,7 +171,7 @@ void ESP32TouchComponent::loop() { // If we've never seen this pad touched (last_time == 0) and enough time has passed // since startup, publish OFF state and mark as published with value 1 if (last_time == 0 && now > this->release_timeout_ms_) { - child->publish_state(false); + child->publish_initial_state(false); this->last_touch_time_[pad] = 1; // Mark as "initial state published" ESP_LOGV(TAG, "Touch Pad '%s' state: OFF (initial)", child->get_name().c_str()); } else if (child->last_state_ && last_time > 1) { // last_time > 1 means it's a real timestamp diff --git a/esphome/components/esp32_touch/esp32_touch_v2.cpp b/esphome/components/esp32_touch/esp32_touch_v2.cpp index 12b8989ee2..105ac19c0a 100644 --- a/esphome/components/esp32_touch/esp32_touch_v2.cpp +++ b/esphome/components/esp32_touch/esp32_touch_v2.cpp @@ -309,21 +309,16 @@ void ESP32TouchComponent::loop() { // In setup mode, periodically log all pad values if (this->setup_mode_ && now - this->setup_mode_last_log_print_ > SETUP_MODE_LOG_INTERVAL_MS) { for (auto *child : this->children_) { - uint32_t raw = 0; - uint32_t benchmark = 0; - uint32_t smooth = 0; - - touch_pad_read_raw_data(child->get_touch_pad(), &raw); - touch_pad_read_benchmark(child->get_touch_pad(), &benchmark); + uint32_t value = 0; + // Read the value being used for touch detection if (this->filter_configured_()) { - touch_pad_filter_read_smooth(child->get_touch_pad(), &smooth); - ESP_LOGD(TAG, " Pad T%d: raw=%d, benchmark=%d, smooth=%d, threshold=%d", child->get_touch_pad(), raw, - benchmark, smooth, child->get_threshold()); + touch_pad_filter_read_smooth(child->get_touch_pad(), &value); } else { - ESP_LOGD(TAG, " Pad T%d: raw=%d, benchmark=%d, threshold=%d", child->get_touch_pad(), raw, benchmark, - child->get_threshold()); + touch_pad_read_raw_data(child->get_touch_pad(), &value); } + + ESP_LOGD(TAG, "Touch Pad '%s' (T%d): %d", child->get_name().c_str(), child->get_touch_pad(), value); } this->setup_mode_last_log_print_ = now; }