One switch, many actions: wall switches become scene buttons
The “Detach Relay” mode of the Sonoff MINIR4 separates the wall switch from the relay and turns it into a scene button in eWeLink. We explain how it works and what you give up: the switch no longer turns on its own lamp.
- Level
- Intermediate
- Active time
- 30–60 minutes
- Home Assistant required
- Optional
The wall switch in the living room turns on one lamp, but you want to use it to launch a whole scene: evening lighting, “everything off” or “good night”. The “Detach Relay” mode of the Sonoff MINIR4 separates the switch from the relay: pressing the switch sends a signal but doesn’t change the relay.
What you will get
A switch on the wall that launches a scene while the relay stays powered and controlled by the app. The project covers the mode in which the switch no longer turns on its own lamp.
What we need
- Sonoff MINIR4 — 10 A Wi-Fi relay, neutral wire is required.
- 2.4 GHz Wi-Fi and the eWeLink app.
- Sonoff relay to install behind the switch.
How it works
Sonoff describes it like this: with “Detach Relay Mode” on, the state of the external switch and of the relay are separated, and pressing the switch doesn’t change the relay. eWeLink adds an extra scene condition, “external switch (press)”, and the action can be turn on, turn off or toggle for other devices.
Advantage: if the lamp is a smart bulb, it stays powered and always online. Cost: if Wi-Fi or the system goes down, the switch doesn’t turn anything on.
How it is at our place
Marto’s Home Assistant has seven Sonoff MINIR4 relays.
Steps
No neutral or earth is connected to S1 and S2. You make the settings below after installation.
- Install the relay behind the switch and check that the switch turns the lamp on and off in normal mode.
- Add the relay to eWeLink. You should see a device with an on/off switch.
- In the device settings, turn on “Detach Relay” (Device Settings → Switch Mode).
- Create a scene in eWeLink: condition — the external switch is pressed; action — turn other devices on, off or toggle them (for example, an evening scene).
- If you use Home Assistant, how the switch press shows up there depends on the Sonoff integration. Build the scene in eWeLink first.
Checking the result
- Press the switch: the relay in the circuit should not change from the switch alone.
- The scene should run.
- Turn Wi-Fi off for a few minutes: the switch does nothing. That is how you know what happens in a failure.
If it doesn’t work
- The lamp still reacts to the switch → “Detach Relay” is not on → check the setting.
- The scene doesn’t run → the external switch condition appears only when Detach Relay is on → turn the mode on and create the scene again.
- The switch doesn’t turn the lamp on by itself → that is by design in this mode.
Limitations
- In detached mode the switch doesn’t turn the lamp on. For a room that must always have light, keep the normal mode.
Sources and verification status
Checked against the Sonoff documentation, 22.11.2026.
At home
MartoSince February 2025 (the Sonoff integration in Home Assistant)
Home Assistant has seven Sonoff MINIR4 relays. We don't use the "Detach Relay" mode or a switch as a scene button in any automation (as of 19.10.2026).
Need a hand?
We can set up and install everything in this project. In some regions we install it ourselves — ask us.
Contact us



