WT32 SC01 PLUS to control a smart dry switch (SONOFF Mini-d)

As a backup for my heating system, I want a way to switch a sonoff mini-d as if it were hard wired to a physical switch.

The ‘switch’ in this case, would be some available pin headers on the WT32 SC01 PLUS.

With no idea how to do this, I asked chatgpt, which suggested a needed a relay in between.

Coincidentally, I have some spare of these which I think might work:-

https://www.aliexpress.com/item/32888878613.html

However, at this point I’m lost as to how to wire this whole thing together, and what ESPhome code I need. Chatgpt is also talking about needing resistors.

I know this is a big ask, but has anyone else tried something like this ?

Should be doable.
What exact relay module you have?
How are you powering Sonoff, mains or DC?

This is the relay:-

https://www.aliexpress.com/item/32888878613.html

The mini-d is already powered separately via the mains as its in use to toggle my boiler.

Your link gives 10 options…

They are all the same device, just with one or more relays in line.

I just need a single relay version:-

They are not, not even close.
The relay above is not compatible with Esp32 (3.3V trigger) and it doesn’t have optocoupler.

This instead has optocouplers and it can be wired for 3.3V trigger (removing the jumper). Just for my experience, description says: 5 V-12V to TTL control signal

@Karosm - that tells you how little I know!

Please recommend a relay and then how I might wire it up.

Almost whatever 5V relay module that has “JD-VCC” or “HIGH-LOW” jumper would likely work. Post here what you find available.

That connection to Sonoff could be done even without relay, but it’s not beginner task and I have no sonoff to guide you here…

I’m looking at getting one of these, I assume the 5V version?:-

Yep, the 5v version should be ok.

Perfect… so how would I wire up a spare GPIO on the WT32 to this, and then onto the sonoff mini-d ?

Looking at the data sheet for the WT32, these are the available GPIO Pins I could use:-

There are many ways. Preferred would be this, but you need to take 3.3V from the debug header.

If you prefer not, wire GND to the middle pin instead of 3.3V.
Use any available Gpio for trigger.

1 Like

Thanks for your help thus far.
I’ve read the esphome page on exposing a gpio pin as a switch, but I’m not familiar with some of the terms.

Chatgpt has suggested this epshome code:-

switch:
- platform: gpio
name: "Sonoff Mini-D Trigger"
id: sonoff_trigger
pin:
number: GPIO25 # Adjust this pin as wired
mode: OUTPUT_OPEN_DRAIN # safer with Sonoff pull-up
inverted: false
restore_mode: ALWAYS_OFF
on_turn_on:
- delay: 500ms # press duration
- switch.turn_off: sonoff_trigger

Just pick one free gpio from your datasheet.

switch:
  - platform: gpio
    pin:
      number: GPIOXX
      inverted: true

Go with Chatgpt or stay here.

I’d prefer the advice of a real human…

I was curious about this line which I didnt fully understand:-

mode: OUTPUT_OPEN_DRAIN # safer with Sonoff pull-up

It’s likely related to approach to control sonoff without relay (not beginner task) and likely not correct…

I’ll post back on this thread when all the parts have arrived and I’ve set it all up. Ty for your time and patience helping me get to this point.

No problem. Asking before fried components/person is preferred way…

For your curiosity, Sonoff S1/2 can be triggered without relay, but it’s likely bonded to AC mains, so without documentation/experience i’m not guiding anyone to that path.

Sorry for my question, but why do you need the relay? Wouldn’t be enough to use a physical switch (like one used for lights) and a smart switch with dry contact (as shelly 1/1 mini Gen4)?

You don’t need a relay if you’re using a physical switch. I need a relay because I’m triggering the switch from a GPIO pin on the WT32 spare pins.