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
configuration.yaml
1esphome:
2 name: sonoff_t1_ch2
3 platform: ESP8266
4 board: esp01_1m
5
6wifi:
7 ssid: !secret WLanSSID
8 password: !secret WLanPassword
9
10 ap:
11 ssid: "Sonoff T1 Ch2 Fallback Hotspot"
12 password: "123456789"
13
14captive_portal:
15
16logger:
17
18api:
19ota:
20
21
22binary_sensor:
23 - platform: gpio
24 pin:
25 number: GPIO0
26 mode: INPUT_PULLUP
27 inverted: True
28 id: button_1
29 on_press:
30 then:
31 - light.toggle: light_1
32
33 - platform: gpio
34 pin:
35 number: GPIO9
36 mode: INPUT_PULLUP
37 inverted: True
38 id: button_2
39 on_press:
40 then:
41 - light.toggle: light_2
42
43 - platform: status
44 name: "T1 Status"
45
46output:
47 - platform: gpio
48 pin: GPIO12
49 id: relay_1
50
51 - platform: gpio
52 pin: GPIO5
53 id: relay_2
54
55light:
56 - platform: binary
57 name: "T1 A"
58 id: light_1
59 output: relay_1
60
61 - platform: binary
62 name: "T1 B"
63 id: light_2
64 output: relay_2
65
66status_led:
67 pin:
68 number: GPIO13
69 inverted: yes
