From 0021e766496aaac9b0ecec2ac8727552540c1752 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 12 Jun 2025 13:07:25 -0500 Subject: [PATCH] working --- .../components/esp32_touch/esp32_touch_v2.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/esphome/components/esp32_touch/esp32_touch_v2.cpp b/esphome/components/esp32_touch/esp32_touch_v2.cpp index 37f6b2c49a..020570e092 100644 --- a/esphome/components/esp32_touch/esp32_touch_v2.cpp +++ b/esphome/components/esp32_touch/esp32_touch_v2.cpp @@ -122,6 +122,13 @@ void ESP32TouchComponent::setup() { // Start FSM touch_pad_fsm_start(); + + // Set thresholds for each pad + for (auto *child : this->children_) { + if (child->get_threshold() != 0) { + touch_pad_set_thresh(child->get_touch_pad(), child->get_threshold()); + } + } } void ESP32TouchComponent::dump_config() { @@ -278,12 +285,10 @@ void ESP32TouchComponent::loop() { child->value_ = value; // This is an INACTIVE event, so not touched - if (child->last_state_) { - child->last_state_ = false; - child->publish_state(false); - ESP_LOGD(TAG, "Touch Pad '%s' released (value: %d, threshold: %d)", child->get_name().c_str(), value, - child->get_threshold()); - } + child->last_state_ = false; + child->publish_state(false); + ESP_LOGD(TAG, "Touch Pad '%s' released (value: %d, threshold: %d)", child->get_name().c_str(), value, + child->get_threshold()); break; } }