ESPHome with Sonoff 4CH Pro R1 relays curious beahavior

Hello,

I just flashed an old Sonoff 4CH Pro R1 with ESPHome configured with the code sample from ESPHome web site.

Every relay is working individually but not when I switch on multiple relays, it doesn’t work.
Any suggestion on what could be wrong?

esphome:
  name: esphome-web-8606ae
  friendly_name: Sonoff R1

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "hqI0ptQVr+7TlMmX1q8TGRQOBl/mKjXaZ6DXKkT+TQA="

ota:


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-8606Ae"
    password: "YrgRLs7ZyTYW"

captive_portal:
    

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode:
        input: true
        pullup: true
      inverted: true
    name: "Sonoff 4CH Button 1"
    filters:
      - delayed_on: 50ms
  - platform: gpio
    pin:
      number: GPIO9
      mode:
        input: true
        pullup: true
      inverted: true
    name: "Sonoff 4CH Button 2"
    filters:
      - delayed_on: 50ms
  - platform: gpio
    pin:
      number: GPIO10
      mode:
        input: true
        pullup: true
      inverted: true
    name: "Sonoff 4CH Button 3"
    filters:
      - delayed_on: 50ms
  - platform: gpio
    pin:
      number: GPIO14
      mode:
        input: true
        pullup: true
      inverted: true
    name: "Sonoff 4CH Button 4"
    filters:
      - delayed_on: 50ms
  - 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"

output:
  # Register the blue LED as a dimmable output ....
  - platform: esp8266_pwm
    id: blue_led
    pin: GPIO13
    inverted: true

light:
  # ... and then make a light out of it.
  - platform: monochromatic
    name: "Sonoff 4CH Blue LED"
    output: blue_led

There are switches on the board that control the relay modes. You need to set them to self-locking (for independent control of the relays):

https://wiki.iteadstudio.com/Sonoff_4CH_Pro

So:

S6 → 1
K5 (switches 1 to 4) → 1
K6 (switches 1 to 4) → doesn’t matter.
S5 → doesn’t matter.

4CH-Pro

1 Like

You are my hero for today. Thank you so much for your previous help !
I will try it right now !