Modding sonoff 4ch

Hi everyone!

I recently bought 4 used sonoff 4ch on subito.it to a super kind person that I really thank!

I had to integrate in my new house some lights

But damn!!! The sonoff 4ch doesn’t allow 230V inputs! :(

I was really upset at the beginning, but then I took the solderer and solved the problem, as always ;)

Enabling external buttons

I took some spare cat5 inside cables and solder the line and ground of the buttons.

buttons down

Then I made 2 holes in the PCB and the case to make the wires comes out.

buttons down

Done!

Here the video with the result!!!

Here is the esphome configuration for my tavern light ;)

substitutions:
  device_name: tavern-lights

esphome:
  name: ${device_name}
  platform: ESP8266
  board: esp01_1m

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

  ap:
    ssid: ${device_name} Hotspot
    password: !secret hotspot_password

logger:
api:
ota:
web_server:

binary_sensor:
  - platform: gpio
    name: "Sonoff 4CH Button 1"
    internal: true
    pin:
      number: GPIO0
      mode:
        input: true
        pullup: true
      inverted: true
    on_press:
      then:
        - light.toggle: lightid1
  - platform: gpio
    internal: true
    name: "Sonoff 4CH Button 2"
    pin:
      number: GPIO9
      mode:
        input: true
        pullup: true
      inverted: true
    on_press:
      then:
        - light.toggle: lightid2
  - platform: gpio
    internal: true
    name: "Sonoff 4CH Button 3"
    pin:
      number: GPIO10
      mode:
        input: true
        pullup: true
      inverted: true
    on_press:
      then:
        - light.toggle: lightid3
  - platform: gpio
    name: "Sonoff 4CH Button 4"
    internal: true
    pin:
      number: GPIO14
      mode:
        input: true
        pullup: true
      inverted: true
    on_press:
      then:
        - light.toggle: lightid4
  # - platform: gpio
  #   pin:
  #     number: GPIO1 # TX
  #     inverted: true
  #     mode:
  #       input: true
  #       pullup: true
  #   name: "tx"
  # - platform: gpio
  #   pin:
  #     number: GPIO3 # RX
  #     inverted: true
  #     mode:
  #       input: true
  #       pullup: true
  #   name: RX
  - platform: gpio
    pin:
      number: GPIO2 # I02
      inverted: true
      mode:
        input: true
        pullup: true
    name: "tavern door"

light:
  - platform: binary
    name: "basement bathroom light"
    output: relay_1
    id: lightid1
  - platform: binary
    name: "tavern light"
    output: relay_2
    id: lightid2
  - platform: binary
    name: "hot-bath light"
    output: relay_3
    id: lightid3
  - platform: binary
    name: "basement bathroom mirror light"
    output: relay_4
    id: lightid4

output:
  - platform: gpio
    id: relay_1
    pin: GPIO12
  - platform: gpio
    id: relay_2
    pin: GPIO5
  - platform: gpio
    id: relay_3
    pin: GPIO4
  - platform: gpio
    id: relay_4
    pin: GPIO15

Enabling intarnal GPIOs

Then, I decided to use this hardware also to manage the ofuro in my house!

ofuro 1 ofuro 2

This basically needs to:

  • measure the temperature of the water
  • turn on a pump that make the water circulate
  • turn on an electrical water heater to heat the water!

Then, I have a fan to ventilate the bathroom. This sonoff will enable me to use that too!

Here are the pictures of the mod:

I soldered some pins in the serial holes and soldered a black 0.75 mmq cable for the ground

gpio down

Then, I used 5 duponts to connect to the 3 gpio and the 3.3v and the ground too

gpio up

Now I can easily reach the gpio from outside the shelly 4ch!

gpio closed

This is the configuration for esphome:

substitutions:
  device_name: hot-bath

esphome:
  name: ${device_name}
  platform: ESP8266
  board: esp01_1m

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

  ap:
    ssid: ${device_name} Hotspot
    password: !secret hotspot_password

logger:
api:
  reboot_timeout: 0s
ota:
web_server:

dallas:
  - pin: GPIO2
    update_interval: 3s

sensor:
  - platform: dallas
    address: 0xc77f414e1f64ff28
    name: "hot bath temperature"

binary_sensor:
  - platform: gpio
    name: "Sonoff 4CH Button 1"
    pin:
      number: GPIO0
      mode:
        input: true
        pullup: true
      inverted: true
    on_press:
      then:
        - switch.toggle: hotbathheather
  - platform: gpio
    name: "Sonoff 4CH Button 2"
    pin:
      number: GPIO9
      mode:
        input: true
        pullup: true
      inverted: true
    on_press:
      then:
        - switch.toggle: hotbathpump
  - platform: gpio
    name: "Sonoff 4CH Button 3"
    pin:
      number: GPIO10
      mode:
        input: true
        pullup: true
      inverted: true
    on_press:
      then:
        - switch.toggle: bathroomfan
  - platform: gpio
    pin:
      number: GPIO14
      mode:
        input: true
        pullup: true
      inverted: true
    name: "Sonoff 4CH Button 4"
    on_press:
      then:
        - switch.toggle: relay4
  - platform: gpio
    pin:
      number: GPIO1 # TX
      inverted: true
      mode:
        input: true
        pullup: true
    name: "hot bath window"
  # - platform: gpio
  #   pin:
  #     number: GPIO3 # RX
  #     inverted: true
  #     mode:
  #       input: true
  #       pullup: true
  #   name: RX
  # - platform: gpio
  #   pin:
  #     number: GPIO2 # I02
  #     inverted: true
  #     mode:
  #       input: true
  #       pullup: true
  #   name: "hot bath window"

switch:
  - platform: gpio
    id: hotbathheather
    name: "hot bath heater"
    pin: GPIO12
  - platform: gpio
    id: hotbathpump
    name: "hot bath pump"
    pin: GPIO5
  - platform: gpio
    id: bathroomfan
    name: "basement bathroom fan"
    pin: GPIO4
  - platform: gpio
    id: relay4
    name: "Sonoff 4CH Relay 4"
    pin: GPIO15

I will add an automation to keep the temperature around 42.5 degrees celsius… but this in the future!

Stay tuned for other updates!

For any question come in the telegram channel