At the moment i run this config :
esphome:
name: sonoff_4ch
platform: ESP8266
board: esp01_1m
substitutions:
# Modify variables based on your settings
hostname: 'Sonoff 4ch garage'
wifi:
ssid: "xxxx"
password: "xxxxx"
fast_connect: true
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: "Sonoff 4CH Button 1"
on_press:
- switch.toggle: relay_1
- platform: gpio
pin:
number: GPIO9
mode: INPUT_PULLUP
inverted: True
name: "Sonoff 4CH Button 2"
on_press:
- switch.toggle: relay_2
- platform: gpio
pin:
number: GPIO10
mode: INPUT_PULLUP
inverted: True
name: "Sonoff 4CH Button 3"
on_press:
- switch.toggle: relay_3
- platform: gpio
pin:
number: GPIO14
mode: INPUT_PULLUP
inverted: True
name: "Sonoff 4CH Button 4"
on_press:
- switch.toggle: relay_4
- platform: status
name: "Sonoff 4CH Status"
switch:
- platform: gpio
name: "Sonoff 4CH Relay 1"
pin: GPIO12
id: relay_1
- platform: gpio
name: "Sonoff 4CH Relay 2"
pin: GPIO5
id: relay_2
- platform: gpio
name: "Sonoff 4CH Relay 3"
pin: GPIO4
id: relay_3
- platform: gpio
name: "Sonoff 4CH Relay 4"
pin: GPIO15
id: relay_4
# Exposed switches
- platform: restart
name: ${hostname}_restart
status_led:
pin:
number: GPIO13
inverted: yes
# Sensors with specific and general information
sensor:
# Extra sensor to keep an eye on the Wi-Fi signal
- platform: wifi_signal
name: ${hostname}_Wi-Fi_Signal
update_interval: 60s
# Extra sensor to keep track of plug uptime
- platform: uptime
name: Uptime
id: uptime_s
update_interval: 15s
# Text sensors with general information
text_sensor:
# Expose ESPHome version as sensor.
- platform: version
name: ${hostname}_esphome_version
# Expose WiFi information as sensors.
- platform: wifi_info
ip_address:
name: ${hostname}_wifi_ip
icon: mdi:ip
ssid:
name: ${hostname}_wifi_ssid
icon: mdi:wifi
- platform: template
name: ${hostname}_Uptime_Sensor
lambda: |-
uint32_t dur = id(uptime_s).state;
int dys = 0;
int hrs = 0;
int mnts = 0;
if (dur > 86399) {
dys = trunc(dur / 86400);
dur = dur - (dys * 86400);
}
if (dur > 3599) {
hrs = trunc(dur / 3600);
dur = dur - (hrs * 3600);
}
if (dur > 59) {
mnts = trunc(dur / 60);
dur = dur - (mnts * 60);
}
char buffer[17];
sprintf(buffer, "%ud %02uh %02um %02us", dys, hrs, mnts, dur);
return {buffer};
icon: mdi:clock-start
update_interval: 15s
# Enable Web server
web_server:
port: 80
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
But when i press the Sonoff 4CH Button 2 and/or 3 the relay doesnt switch . When using hassio or the esp home webserver relay 3 and 4 does toggle okay . So maybe there’s somehting wrong with the GPIO ports : GPIO9 / GPIO10 .
Can somebody tell of help me with this , so the buttons are functional ?