ESP8266-01 pull GPIO2 down only after boot

the specific TTP223B I have doesn't have jumper to change "active high" to "active low". This is the answer that is usually given to my problem

I am currently working on a touch-activated wall-mounted light switch.

I am using an ESP8266 ESP-01S (specific one) module programmed via ESPHome in Home assistant. GPIO2 is used to read the switch state.

I am using a ZHITING TTP223B Capacitive Touch Switch Module for the switching action.

note: this schematic doesn't include any resistors because I'm currently doing testing using a curent-limited desktop PSU and kept it simple for development purposes

simulate this circuit – Schematic created using CircuitLab

ESPHome config file (for those not used to ESPHome, it basically generates templated programs to flash on the ESP based on yaml config)

api: ~
binary_sensor:
-
name: "Test ESP8266 binary sensor"
pin: GPIO2
platform: gpio
captive_portal: ~
esphome:
board: esp01_1m
name: wall_mounted
platform: ESP8266
logger: ~
wifi:
ap:
ssid: "REDACTED"
ssid: "REDACTED"


My current circuit looks like the above schematic. It works well as long as GPIO2 is not connected to the IO during the ESP8266's boot sequence. If I connect them after the ESP has booted, the circuit works well.

The problem seems to come from the fact that, to boot in "normal" mode, GPIO2 must be high on the ESP and the TTP223B pulls the IO low when in "open" state.

• I tried using a weak pull-up between the IO-GPIO2 and VCC. Didn't work
• I tried using GPIO0 (which has an internal pull-up) as the VCC input for the TTP2223B but all I ended up doing with that is pulling GPIO0 low ... which prevent "normal" boot again

I thought of using some kind of transistor or relay setup to keep the TTP223B's GND line open during boot but I find that solution overcomplicated ...

QUESTION: How can I use the TTP223B with an ESP8266-01S without having to disconnect the IO line during boot time.

notes:

• The *-01S version of the ESP8266 only has two accessible GPIOs, both must be pulled high for normal boot
• I would like to avoid switching to an other declination of the ESP. I only need one IO pin and am looking for the smallest possible form-factor.
• You should not link to store websites when referencing your hardware. Please reference a valid datasheet so people don't have to search for them. Feb 28, 2021 at 1:42
• You’ve got rx and tx as gpio. Or solder a wire to the esp8266 chip for another gpio. Feb 28, 2021 at 4:44
• Can you post a picture of the both sides of the TTP223 board? The chip has the pins... if they are not connected to anything, you can still solder a wire to the pins. Feb 28, 2021 at 9:47
• @Kartman Can you please create an answer so that I can accept it. For some reason it didn't occur to me that RX & TX were actually GPIOs ... -_- Feb 28, 2021 at 9:52