Trigger Sonoff mini with a ESP32, locally

Is there any way that you can trigger a toggle with an ESP32 on a Sonoff mini?

My idea is that the ESP32 will be sitting next to the Sonoff and have a few sensors on it, and should be able to controll the Sonoff mini.
I know I can set the state in Home Assistant but I’m looking for a hardware solution so that I’m not relying on any network at all.

The Sonoff mini already use the S1 and S2 for human interface, now I need a ESP32 interface.
The switch connected to S1 and S2 is a two state switch (not NO/NC) only on/off so I can’t build a 2-way or 3-way switch.

Do anyone know of a solution for this?

Did you flash the sonoff mini with tasmota ?

No, but if that helps it can be done.

If you flash your mini with tasmota, you can define S1/S2 as a button, and use it as a 2-way/more-way switch.

How can I do that? How does that differ from stock?
The switch I have to use does not have NO/NC, how can that be done?

Obviously, you would need to change the connected switch.

Can’t be done.

Anyone that knows about the hardware side of Sonoff switches?
As I understand it GPIO0 is the one that toggles the relay and has a button connected to it.
This button is closed to ground to toggle (?).

So what if I solder a wire from ESP32 to GPIO0 of the Sonoff?
Wouldn’t that toggle the Sonoff?

Did you find a solution, mate?

No. Not a tested working solution. But I have heard from a good source that my idea should work.
I don’t have all the parts yet (to the complete thing), so I’m still waiting to start the testing.

Of course your idea is sound and will work. To find spare GPIOs you can use on mini, look here…


Be careful on pin you use as it may have inherent limitations.

I think you have misunderstood it.
I’m not going to use the Sonoff to do something.

A esp32 chip will set a GPIO to ground, this GPIO is connected to the Sonoff GPIO0 which will toggle the relay of the Sonoff.

As far as I know I don’t need to find an unused pin on the Sonoff, or even flash it, I just need a physical connection between the two

1 Like