TTP223 on ESP8266 Mini Issues

Hi Everyone, Hope you are well.

I’ve recently got into using ESPHome but I’m really struggling with a simple capacitive switch to turn off a neopixel led. I have a ESP8266 Mini and one of the red TTP223 capacitive touch sensors but no matter what I add to the code, I can’t get the touch sensor to turn off the light when pressed.

I’ve tested all the components and they appear to be working so I do think it’s on the code side. Below is a copy of the code I have added (I’ve played around with it alot so it probably makes no sense what so ever now!:

Im aware I could use home assistant to map the button and the lights but I’d rather do a simple command on the board to take some load off of Home Assistant.

I have tried different pins on the board also but unfortunately this makes no difference. When I used the “Switch” instead of binary sensor, the LED on TTP223 would flash when the button was touched but it wouldn’t register anything within the logs.

Any help would be massively appreciated thanks!

Try using on_press: rather than on_click:, and post the logs.

Thanks Daryl, Unfortunately it’s a no go. In the logs it doesn’t even register that the button has been pressed? It shows the light has been turned on and off if I turn off light in the weconsole

Isn’t there a couple of jumper pads on that board that change the behaviour? Maybe check that.

Please don’t post your code and logs as image. Do copy-paste using code tags.
For testing purpose use:
on_state:
instead of click/press.
Also, don’t use quotations for id

id: bindicator_light

- light.toggle: bindicator_light

Anyway if you don’t get anything on the log from your TTP223 you probably have hardware issue. Are you sure it’s wired to Gpio5 (pin D1)?

Sorry I should have thought about doing text rather than images!

On a side note, Sucess! It turns out I did have a dodgy ttp223 sensor. For anyone in the future the code which is working for me is as follows:

light:

  • platform: neopixelbus
    type: RGB
    id: bindicator_light
    variant: ws2812
    pin: GPIO0
    num_leds: 14
    name: Bindicator NeoPixel Light
    restore_mode: ALWAYS_ON

binary_sensor:

  • platform: gpio
    filters:
    • invert:
      pin: GPIO14
      id: bindicator_light_button
      name: Bindicator_light_button
      on_state:
      then:
      • light.turn_off: bindicator_light

Thanks again for everyones help,

Much better now, but if you use code tags, it’s really becoming readable.

If that works, I wonder how you turn the light on?

I will be using a home assistant automation to turn it on to the various colours. Im not sure whether I need to set the colours I want to use on the esp code though or whether I can fully do it via home assistant?

I always do all automation on esphome, I don’t know what steps you need to do for HA automation.