Sonoff T1-1 problem

Hi, got a sonoff t1-1 (r2)
i have flashed it to esphome, however the touchbutton is acting wierd, when i press the touch it recognizes it and send ON, immidiatly after it sends OFF

[00:36:29][D][binary_sensor:037]: ‘Living Room Roof Touchpad’: Sending state ON
[00:36:29][D][binary_sensor:037]: ‘Living Room Roof Touchpad’: Sending state OFF

my yaml looks like this:

esphome:
  name: lr_switch
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "*************"
  password: "**********"

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: '********'

ota:
  password: '*********'

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Living Room Roof Touchpad"

switch:
  - platform: gpio
    name: "Living Room Roof"
    pin: GPIO12

output:
  - platform: esp8266_pwm
    id: blue_led
    pin: GPIO13
    inverted: True

light:
  - platform: monochromatic
    name: "Living Room Blue LED"
    output: blue_led

Am i doing something wrong or is it anything else?

note:
It was working a few hours ago when i had installed it, then i pushed update to change the name of the binary sensor and the switch…

Please post your code correctly, see How to help us help you - or How to ask a good question

Perhaps you need some debouncing?

@nickrout Thanks! I will try that tonight :slight_smile:

I tried up to 1000ms delay for off but it didnt do anything at all…
Any other tips?

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Living Room Roof Touchpad"
    filters:
      - delayed_off: 1000ms

I also tried this:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Living Room Roof Touchpad"
    on_click:
      min_length: 50ms
      max_length: 350ms
      then:
        - switch.turn_on: relay_1
    on_double_click:
      min_length: 50ms
      max_length: 350ms
      then:
        - switch.turn_off: relay_1

Single click will turn the lights on, double click turns it off but also on…

Ok for future reference, this solved my problem:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Living Room Roof Touchpad"
    on_press:
      - switch.toggle: relay_1
    
switch:
  - platform: gpio
    name: "Living Room Roof"
    pin: GPIO12
    id: relay_1
3 Likes

Hello @Pelle_Kallstrom
I am having the same issue of ghost switching. Glad to know your solved the problem. Just to confirm what I understood is that I should not use output and light functions and just use the binary_sensor and switch functions.