November 24, 2026 · 8 min read
Sonoff MINI R4 & R4M: Setup, Wiring, and Home Assistant Guide
How to wire the Sonoff MINI R4 (MINI Extreme) and its Matter sibling, the MINI R4M, set them up in eWeLink, use Detach Relay with smart bulbs, and add them to Home Assistant — plus how they compare to the older MINI R2.

The Sonoff MINI R4 — sold as the "MINI Extreme" — is the small WiFi relay that turns an ordinary wall switch and light into a smart one. It hides in the back box behind your existing switch, keeps that switch working, and adds app, voice, and automation control on top. Its sibling, the MINI R4M, is the same idea with Matter built in, so it pairs straight into Apple Home, Google Home, Alexa, SmartThings, and Home Assistant without the eWeLink cloud in the middle.
This guide covers which one to buy, how to wire it, the switch modes that trip most people up, and how to get either version into Home Assistant.
MINI R4 vs MINI R4M vs MINI R2: which one?
| MINI R4 (MINI Extreme) | MINI R4M | MINI R2 (older) | |
|---|---|---|---|
| Protocol | WiFi + Bluetooth (pairing), eWeLink | WiFi + Matter | WiFi, eWeLink |
| Chip | ESP32 | ESP32-C3 (flash locked) | ESP8266 |
| Max load | 10A | 10A (~2400W at 240V) | 10A |
| Neutral wire | Required | Required | Required |
| Apple Home | Only via Home Assistant bridge | Native (Matter) | Only via Home Assistant bridge |
| Home Assistant | SonoffLAN (local) or ESPHome | Built-in Matter integration | SonoffLAN or ESPHome/Tasmota |
- Buy the MINI R4 if you're mostly in eWeLink, Alexa, or Google Home and want the cheapest, most compact option — or if you like the idea of reflashing it with ESPHome later.
- Buy the MINI R4M if you use Apple Home, run several smart home apps at once, or want local control without depending on eWeLink's cloud. It's the more future-proof pick.
- The MINI R2 is the previous generation. It still works well and is easy to flash with Tasmota, but it's bulkier, so the R4 is the better buy for a new install unless you specifically want an ESP8266 board.
Shop the MINI range



Before you start: safety and the neutral wire
The MINI R4 and R4M run on mains voltage (100–240V). Turn off the circuit at the breaker before you open a switch box, confirm it's dead with a voltage tester, and if you're not comfortable with household wiring — or local rules require it — have an electrician do the install.
Both models need a neutral wire to power themselves. Many older homes, especially in North America, only run live (hot) and switched-live wires to the switch box, with no neutral. Check before you buy. If there's no neutral at the switch, either fit the MINI at the light fitting instead (where neutral is almost always present), or use the ZBMini L2, a Zigbee relay built for no-neutral boxes.
How to wire a Sonoff MINI R4 / R4M
The wiring is the same for both models. The MINI sits between your mains supply and the light. The existing wall switch no longer carries the load: it connects to the MINI's low-current switch inputs and becomes a signal.
- Supply in: connect the incoming live (L) and neutral (N) from the circuit to the MINI's L-in and N terminals.
- Load out: connect the MINI's switched-live output (L-out) to the light, and run the light's neutral back to the neutral (the R4M has a second N terminal for exactly this).
- Wall switch: connect your existing switch across the S1 and S2 terminals. Never connect S1 or S2 to neutral or earth.
- Tuck the MINI into the back box behind the switch (it's about 40 × 33 mm, small enough for most standard boxes), restore power, and the LED should start blinking for pairing.
Two-way (SPDT) switches, momentary push-buttons, and ordinary rocker switches all work on S1/S2. You just tell the app which kind you have (see below).
Setting it up
MINI R4: eWeLink
- Install the eWeLink app and create an account.
- Tap + to add a device. The MINI R4 uses Bluetooth for pairing, so keep your phone close by.
- Enter your 2.4GHz WiFi credentials. The MINI doesn't support 5GHz networks.
- Once it's online, link eWeLink to Alexa, Google Home, SmartThings, or IFTTT if you use them. Our ecosystem compatibility guide covers each one.
MINI R4M: Matter
- Open your Matter controller's app: Apple Home, Google Home, Alexa, SmartThings, or Home Assistant.
- Choose Add device → Matter and scan the Matter QR code on the device or in the box. Photograph that code before you install the MINI, because it'll be behind a wall plate afterwards.
- Your controller commissions it onto your 2.4GHz WiFi. To use more than one ecosystem, add it to the first one, then use that app's "share with another app" / multi-admin option to add the others.
Switch modes and Detach Relay
In the device settings you'll find options that control how the wall switch on S1/S2 behaves:
- Edge mode for normal rocker or toggle switches. Every flip toggles the light, whichever way the switch ends up.
- Pulse mode for momentary push-buttons that spring back.
- Following mode where the relay follows the switch's state exactly. Useful for dry-contact sensors.
Detach Relay is the feature that makes the MINI great with smart bulbs. Normally, flipping the wall switch cuts power to the bulb and it drops offline. With Detach Relay on, the wall switch is separated from the relay: the bulb stays powered and online, and the switch press becomes an event you can use in an automation, such as toggling the smart bulb, running a scene, or controlling something in another room.
Adding the MINI R4 / R4M to Home Assistant
MINI R4M via Matter (recommended)
Home Assistant has a built-in Matter integration. Go to Settings → Devices & Services → Add Integration → Matter, then add the device from the Home Assistant companion app on your phone. The phone handles the Bluetooth part of commissioning. After that, control is fully local with no eWeLink account involved. If the R4M is already in Apple Home or Google Home, share it to Home Assistant from that app instead of resetting it.
MINI R4 via SonoffLAN
The non-Matter R4 works with the community SonoffLAN integration (install via HACS). Set the device up in eWeLink first, add SonoffLAN with your eWeLink login, and Home Assistant will control it over your local network, falling back to the cloud only if it has to.
ESPHome (MINI R4 only)
Want to drop eWeLink entirely? The ESP32-based MINI R4 can be reflashed with ESPHome, but it means opening the case and soldering to the programming pads, so it's for confident tinkerers only. The MINI R4M can't be reflashed: its flash is locked as part of Matter certification. That's no great loss, since Matter already gives you local control.
For the bigger picture of WiFi vs Zigbee vs Matter in Home Assistant, see our complete Sonoff + Home Assistant guide.
Troubleshooting
- Won't pair: make sure your phone is on 2.4GHz (or that your router broadcasts 2.4GHz), keep the phone close, and hold the MINI's button for about 5 seconds to re-enter pairing mode.
- Wall switch does nothing: check the switch mode (edge vs pulse) matches your switch type, and confirm Detach Relay isn't on when you don't want it.
- Light flickers or buzzes: stay within the 10A rating, and avoid large inductive loads like motors. For heavy loads, use a higher-rated relay such as the TH16.
- Drops offline: metal back boxes block WiFi. If signal is weak, move your access point closer or fit the MINI at the light fitting instead.
Bottom line
For most new installs the MINI R4M is the one to get: Matter gives you native Apple Home support and local Home Assistant control, and Detach Relay makes it the best way to keep a normal wall switch working alongside smart bulbs. Pick the MINI R4 if you live in eWeLink, Alexa, or Google Home and want to save a few dollars, or you plan to flash ESPHome. No neutral wire? Skip both and look at the ZBMini L2 instead.