Esp32_touch lamp esp32-s2 sensor problem?

Hi, I’m feel I’m extremely close to getting this working but probably having one tiny issue. I’m wanting this steel frame lamp I made to be touch-activated via home assistant (currently plugged into a smart wall plug)


I’ve flashed the ESP32-S2 Mini with what I’m sure is the working code (below), with a 1M ohm resistor coming from GPIO4

esphome:
  name: lamptouch
  friendly_name: lamptouch

esp32:
  board: esp32-s2-saola-1
  framework:
    type: arduino

esp32_touch:
  setup_mode: true

logger:
  level: DEBUG

api:
  encryption:
    key: "redacted"

ota:
  platform: esphome
  password: "redacted"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "Lamptouch Fallback Hotspot"
    password: "redacted"

captive_portal:

binary_sensor:
  - platform: esp32_touch
    name: "Lamp Touch"
    id: LampTouch
    pin: GPIO4
    threshold: 1000
    on_press:
      - lambda: |-
          int raw = id(LampTouch).get_value();  
          ESP_LOGD("touch", "Raw value: %d", raw);
      - homeassistant.service:
          service: switch.toggle
          data:
            entity_id: switch.lampexample

when opening the logs, I’m seeing the following regardless of whether I touch either side of the resistor or not

[12:22:37.358][D][esp32_touch:282]: Event received, mask = 0x10, pad = 4
[12:22:37.442][D][esp32_touch:105]: Touch Pad 'Lamp Touch' (T4): 4185597 
[12:22:37.682][D][esp32_touch:282]: Event received, mask = 0x10, pad = 4 
[12:22:37.689][D][esp32_touch:105]: Touch Pad 'Lamp Touch' (T4): 4185597 
[12:22:37.943][D][esp32_touch:105]: Touch Pad 'Lamp Touch' (T4): 4185597 
[12:22:37.993][D][esp32_touch:282]: Event received, mask = 0x10, pad = 4 
[12:22:38.190][D [esp32_touch:105]: Touch Pad 'Lamp Touch' (T4): 4185597 
[12:22:38.316][D][esp32_touch:282]: Event received, mask = 0x10, pad = 4 
[12:22:38.445][D][esp32_touch:105]: Touch Pad 'Lamp Touch' (T4): 4185597
[12:22:38.624][D][esp32_touch:282]: Event received, mask = 0x10, pad = 4 
[12:22:38.699][D][esp32_touch:105]: Touch Pad 'Lamp Touch' (T4): 4185597 
[12:22:38.949][D][esp32_touch:282]: Event received, mask = 0x10, pad = 4 
[12:22:38.953][D][esp32_touch:105]: Touch Pad 'Lamp Touch' (T4): 4185597 
[12:22:39.213][D][esp32_touch:105]: Touch Pad 'Lamp Touch' (T4): 4185597 
[12:22:39.268][D][esp32_touch:282]: Event received, mask = 0x10, pad = 4 
[12:22:39.465][D][esp32_touch:105]: Touch Pad 'Lamp Touch' (T4): 4185597

I’ve also touched the frame of my macbook while grabbing the wire and no changes thinking it was a grounding issue. Any ideas why I’m not seeing ANY change in capacitance readings while logging? I’ve tried two other pins on the board and same issue.

I’ve actually just realised I need to add measurement_duration: 0.25ms under esp32_touch! solved!