Sonoff Touch 2-Kanal Wandschalter (T0EU2C)

Electronics-Salon 10 x Prototyp Leiterplatte für Arduino UNO R3 Schutzplatte DIY, von CZH-LABS
Electronics-Salon 10 x Prototyp Leiterplatte für Arduino UNO R3 Schutzplatte DIY, von CZH-LABS
--

Hier ein Beispiel ESPHome-Programm für einen Sonoff Touch (2-Kanal Variante).
Dieser Wandschalter existiert als 1, 2 und 3-Weg Schalter.


Pinbelegung

Die Pinbelegungen der 3 Varianten (EU-Version) sehen wie folgt aus:

Sonoff Touch T1 (1 Gang)

Button – GPIO01
Relay and LED – GPIO12
LED – GPIO13

Sonoff Touch T1 (2 Gang)

Button 1 – GPIO01
Button 2 – GPIO09
Relay 1 and LED – GPIO12
Relay 2 and LED – GPIO05
LED – GPIO13

Sonoff Touch T1 (3 Gang)

Button 1 – GPIO01
Button 2 – GPIO09
Button 3 – GPIO10
Relay 1 and LED – GPIO12
Relay 2 and LED – GPIO05
Relay 3 and LED – GPIO04
LED – GPIO13


Programmcode

esphome:
  name: sonoff_t1_ch2
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: !secret WLanSSID
  password: !secret WLanPassword

  ap:
    ssid: "Sonoff T1 Ch2 Fallback Hotspot"
    password: "123456789"

captive_portal:

logger:

api:
ota:

  
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    id: button_1
    on_press:
      then:
        - light.toggle: light_1

  - platform: gpio
    pin:
      number: GPIO9
      mode: INPUT_PULLUP
      inverted: True
    id: button_2
    on_press:
      then:
        - light.toggle: light_2

  - platform: status
    name: "T1 Status"

output:
  - platform: gpio
    pin: GPIO12
    id: relay_1

  - platform: gpio
    pin: GPIO5
    id: relay_2

light:
  - platform: binary
    name: "T1 A"
    id: light_1
    output: relay_1

  - platform: binary
    name: "T1 B"
    id: light_2
    output: relay_2

status_led:
  pin:
    number: GPIO13
    inverted: yes