⚠️ Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through our links, we may earn a small commission at no extra cost to you. Every product below was checked against its live Amazon listing before publishing. Prices change often, so we don’t list them here. Tap any Buy Here button to see the current price on Amazon.
Ultimate Buying Guide
⚡ Best Wi-Fi Smart Relay Modules and DIY Switch Modules
13 relays that turn ordinary lights, fans, pumps and gates into Home Assistant devices, from tiny in-box SONOFF modules to programmable ESP32 relay boards.
✅ 13 Modules Reviewed
✅ ESPHome & Tasmota
✅ Matter & DIN Rail
✅ Honest Pros & Cons
A smart plug only controls things that plug in. For ceiling lights, bathroom fans, garage doors, irrigation valves and anything wired into a panel, you need a Wi-Fi relay module: a small switch that sits behind a wall switch, inside a fixture or on a DIN rail and is controlled over your network. The best ones keep your existing wall switch working, report their state back and can run without a cloud through ESPHome, Tasmota, a local API or Matter.
This guide covers two families: finished relay modules (SONOFF, Shelly) that you wire and pair, and programmable ESP32 and ESP8266 relay boards that you flash with your own code. It continues our Wi-Fi local control series after the local control smart plugs guide. If you prefer to build from scratch, our ESP32 web server with push button tutorial is a good starting point.
💡 Reality check before you buy: Most modules here are wired to mains voltage. Turn off the breaker, follow your local electrical code, and hire an electrician if you are not qualified. Check the load rating against your device, especially for motors and LED drivers with high inrush current. Many SONOFF modules need a neutral wire in the switch box. Firmware support changes between hardware revisions, so a module documented as ESPHome-friendly today may ship with different internals later; finished modules work fine with their stock app, Matter or LAN mode if flashing is not an option. Programmable boards from smaller sellers often list 220 V AC input, so confirm the supply range before using one on 120 V.
⚡ Quick Comparison: All 13 Relay Modules
| Module | Type | Local Control Path | Amazon Rating | Best For | Buy |
|---|
| 🥇 SONOFF MINIR4 | In-box relay, 10 A | eWeLink LAN, ESPHome community | 4.7 (2,759) | Best Overall | Buy Here → |
| 🔧 SONOFF BASICR4 | Inline relay, ESP32 | eWeLink LAN, ESP32 flashable | 4.5 (615) | Best Inline Module | Buy Here → |
| 🟦 SONOFF MINIR4M | In-box relay, Matter | Matter over Wi-Fi | 4.5 (512) | Best Matter Relay | Buy Here → |
| 🔌 Shelly 1 Mini Gen4 | In-box relay, 8 A | Shelly local API, Matter, Zigbee | 4.6 (885) | Best Local API | Buy Here → |
| 🚪 SONOFF MINI-D | Dry contact NO/NC | Matter over Wi-Fi | 4.7 (1,108) | Garage and Boilers | Buy Here → |
| 🏭 SONOFF BASIC-1GSP | DIN rail, up to 32 A | Matter, eWeLink | 4.6 (367) | High Loads in a Panel | Buy Here → |
| 🎛️ SONOFF 4CH Pro R3 | 4-channel DIN rail | eWeLink LAN, Tasmota community | 4.5 (323) | Multi-Circuit Control | Buy Here → |
| 🪟 SONOFF DUALR3 | 2-gang with metering | eWeLink LAN | 4.6 (321) | Shades and Metering | Buy Here → |
| 🌡️ SONOFF THR320D | 20 A thermostat relay | LAN control per listing | 4.6 (98) | Heaters and Fans | Buy Here → |
| 🏗️ Waveshare ESP32-S3 6-Ch Relay | Programmable board | Your firmware (ESPHome, Arduino) | 4.6 (77) | Best ESP32 Relay Board | Buy Here → |
| 🧪 LILYGO T-Relay | Programmable board, 4 relays | Your firmware | 4.0 (41) | 5 V Low-Voltage Projects | Buy Here → |
| 🧰 ESP32-WROOM-32E 4-Ch Relay | Programmable board | Your firmware | 4.1 (22) | Budget 4-Channel Board | Buy Here → |
| 🔰 ESP8266 ESP-01S Relay (5-pack) | Single relay kit | Your firmware (Tasmota, ESPHome) | 4.0 (27) | Learning and Prototyping | Buy Here → |
Specs and ratings are from the Amazon listings at the time of writing. “Community” flashing notes describe what Home Assistant users commonly do; they are not manufacturer features and depend on the hardware revision you receive.
🔍 How to Choose a Wi-Fi Relay Module
📦
Where It Mounts
Behind a wall switch (MINIR4, Shelly 1 Mini), inline in a cord or fixture (BASICR4), or on a 35 mm DIN rail in a panel (BASIC-1GSP, 4CH Pro R3).
🔋
Load and Contact Type
Powered outputs switch mains to the load. Dry contacts (MINI-D, Shelly 1 Mini) just close a circuit, which is what garage openers, boilers and gate controllers expect.
🔁
Wall Switch Input
Keep the existing switch working. “Detach relay” mode lets a switch send events to Home Assistant without cutting power to smart bulbs.
🏠
Local Control Route
Matter models pair locally by QR code. Shelly has a local API. eWeLink devices support LAN mode, and ESP-based modules can often run ESPHome or Tasmota.
💻
Finished vs Programmable
Finished modules are certified and compact. Programmable ESP32 boards give you GPIO, RS485 and full code control but need an enclosure and careful wiring.
🏆 Detailed Reviews: All 13 Relay Modules
🥇 BEST OVERALL WI-FI RELAY
SONOFF MINIR4 Smart Wi-Fi Switch
⭐ 4.7/5 on Amazon (2,759 ratings) · In-Box DIY Module
Buy on Amazon →

The MINIR4 is small enough for even the smallest European back box, per the listing, and accepts momentary, latching and SPDT switches or dry contact sensors as its external input. Its detach relay mode separates the wall switch from the relay, so a switch can trigger Home Assistant scenes while smart bulbs stay powered. It works with eWeLink out of the box, supports LAN control, and is one of the most documented ESPHome conversions in the community. With 2,759 ratings averaging 4.7 stars, it is the most proven module here.
✅ Pros- Very compact
- Flexible switch inputs
- Huge user base
❌ Cons- Needs neutral wire
- No energy metering
🎯 Verdict: The default choice for making any wall switch smart.
👉 Check Price on Amazon →
🔧 BEST INLINE MODULE
SONOFF BASICR4 Wi-Fi Smart Switch
⭐ 4.5/5 on Amazon (615 ratings) · ESP32 Based
Buy on Amazon →

The classic SONOFF Basic box, now built on an ESP32 according to the listing. It wires in line with a lamp, fan or fixture feed. “Magic Switch” mode keeps app control working even after someone flips the old wall switch off, and it doubles as a gateway for eWeLink-Remote 433 MHz buttons. Because it is ESP32 based, it is a natural ESPHome target for makers who want fully local firmware, though you should confirm the current board revision first.
✅ Pros- ESP32 inside
- Works after wall switch is off
- RF remote gateway
❌ Cons- Larger than MINIR4
- No metering
🎯 Verdict: The easiest in-line relay for fixtures, fans and ESPHome projects.
👉 Check Price on Amazon →
🟦 BEST MATTER RELAY · ⭐ 4.5/53. SONOFF MINIR4M Matter Smart Switch
512 ratings · Matter certified, detach relay mode
Buy Here →

The Matter-certified version of the MINIR4. It pairs with Home Assistant, Apple Home, Alexa and Google Home through Matter, so control stays on your LAN with no flashing. The listing confirms detach relay mode, eWeLink control and schedules.
✅ Pros: Local Matter control; tiny.
❌ Cons: Less hackable than MINIR4.
🎯 Verdict: Pick this when you want local control without touching firmware.
🔌 BEST LOCAL API · ⭐ 4.6/54. Shelly 1 Mini Gen4 Smart Relay
885 ratings · Wi-Fi, Matter, Zigbee, 8 A dry contacts
Buy Here →

Shelly’s relay pairs a documented local API with Wi-Fi, Zigbee and Matter in one module. The listing describes dry contacts, loads up to 8 A, an upgraded processor and 8 MB of memory, in a size made for tight switch boxes. Home Assistant finds it automatically through the Shelly integration. More Shelly options are in our Shelly guide.
✅ Pros: Three radios; dry contacts.
❌ Cons: 8 A limit.
🎯 Verdict: The most flexible relay if you want to switch protocols later.
🚪 GARAGE AND BOILERS · ⭐ 4.7/55. SONOFF MINI-D Dry Contact Switch
1,108 ratings · NO and NC dry contact, Matter
Buy Here →

The MINI-D provides a potential-free contact with both normally open and normally closed terminals, which is exactly what garage door openers, boilers and access control panels expect. The listing says it can drive small DC motors and solenoid valves up to 8 W, and clearly states its outputs are not for AC circuits. Matter support keeps it local.
✅ Pros: NO/NC contacts; Matter.
❌ Cons: Not for switching AC loads.
🎯 Verdict: The right tool for “press a button” style equipment.
🏭 HIGH LOADS IN A PANEL · ⭐ 4.6/56. SONOFF Basic DIN Rail (BASIC-1GSP)
367 ratings · 35 mm DIN rail, up to 32 A
Buy Here →

Designed for electrical panels, the BASIC-1GSP clips onto a 35 mm DIN rail and supports loads up to 32 A with integrated terminals, per the listing, and its title lists Matter support. It suits water heaters, pumps and circuits that are too big for in-box modules. Panel work is a job for a qualified electrician.
✅ Pros: High current; neat panel install.
❌ Cons: Wi-Fi inside metal panels can be weak.
🎯 Verdict: The panel-mounted choice for heavy single circuits.
🎛️ MULTI-CIRCUIT CONTROL · ⭐ 4.5/57. SONOFF 4CH Pro R3
323 ratings · 4 channels, interlock and inching modes
Buy Here →

Four independent relays in a DIN rail housing, with self-locking, interlock (one on, others off) and inching (auto off after 1 to 16 seconds) modes listed. Interlock is handy for motor direction control and inching for gate or door pulses. The 4CH Pro has long been a Tasmota community favourite, but check your revision before flashing.
✅ Pros: Four circuits; useful modes.
❌ Cons: Older design; no metering.
🎯 Verdict: One box for four circuits in a garage or workshop panel.
🪟 SHADES AND METERING · ⭐ 4.6/58. SONOFF DUALR3 Dual Relay with Power Metering
321 ratings · 2 gangs, V/A/W per channel
Buy Here →

The DUALR3 controls two loads or one roller shade motor, and the listing says each gang measures voltage, current and power independently. It supports six types of external switch detection. It is the only module here that combines two channels with per-channel energy data, which is ideal for twin bathroom fans or a curtain motor.
✅ Pros: Metering; shade mode.
❌ Cons: Bulkier than single relays.
🎯 Verdict: Best for motorised shades and metered dual loads.
🌡️ HEATERS AND FANS · ⭐ 4.6/59. SONOFF THR320D Temperature and Humidity Switch
98 ratings · 20 A, LCD, LAN control
Buy Here →

A relay with a built-in thermostat brain: the listing covers a 20 A load, dry contact output, an LCD that refreshes every 5 seconds, six months of exportable history and LAN-based automatic control. Add a compatible SONOFF probe (sold separately) and it can run a greenhouse heater or grow-room fan on its own.
✅ Pros: Standalone thermostat logic; 20 A.
❌ Cons: Probe needed; fewer reviews.
🎯 Verdict: Great for climate control that keeps working offline.
🏗️ BEST ESP32 RELAY BOARD · ⭐ 4.6/510. Waveshare Industrial 6-Channel ESP32-S3 Relay
77 ratings · 10 A relays, isolated RS485, Pico HAT header
Buy Here →

For makers who want to write the firmware, this board combines a dual-core ESP32-S3 at 240 MHz with Wi-Fi and Bluetooth LE, six relays rated up to 10 A 250 VAC / 30 VDC, an isolated RS485 port for Modbus modules and a 40-pin header that fits some Raspberry Pi Pico HATs, all per the listing. Run ESPHome, Arduino or ESP-IDF on it.
✅ Pros: Six relays; RS485; good docs.
❌ Cons: You write and maintain the code.
🎯 Verdict: The best programmable relay board for serious ESPHome builds.
🧪 5 V LOW-VOLTAGE PROJECTS · ⭐ 4.0/511. LILYGO T-Relay ESP32 4-Channel
41 ratings · ESP32-WROVER-B, 8 MB PSRAM, optocoupler isolation
Buy Here →

LILYGO’s T-Relay is a 5 V development board with an ESP32-WROVER-B, 4 MB flash, 8 MB PSRAM, four optocoupler-isolated relays and 16 expansion GPIO, with examples on LILYGO’s GitHub. It suits low-voltage jobs like valves, LED strips and sprinklers driven from a 5 V supply.
✅ Pros: PSRAM; GitHub examples.
❌ Cons: 4.0 stars from 41 ratings.
🎯 Verdict: A tidy dev board for low-voltage relay projects.
🧰 BUDGET 4-CHANNEL BOARD · ⭐ 4.1/512. ESP32-WROOM-32E 4-Channel Relay Board
22 ratings · Onboard AC-DC supply, reset and program buttons
Buy Here →

A generic four-relay board with an ESP32-WROOM-32E (4 MB flash), an onboard AC-DC switching supply, reset and program buttons and an exposed UART for flashing. The listing gives the supply range as AC 220 V or DC 5 to 30 V, so on 120 V mains power it from DC to be safe. Unbranded, with only 22 ratings.
✅ Pros: Cheap; flexible DC input.
❌ Cons: Unbranded; 220 V AC input only.
🎯 Verdict: A budget board for bench prototypes on a DC supply.
🔰 LEARNING AND PROTOTYPING · ⭐ 4.0/513. ESP8266 ESP-01S Wi-Fi Relay Module (5-Pack)
27 ratings · ESP-01S with relay adapter
Buy Here →

The cheapest way to learn: each kit is an ESP-01S module plugged into a single-relay adapter. Flash Tasmota or ESPHome with a USB to serial adapter and you have a networked relay for low-voltage tests. These boards lack certification and enclosures, so keep them away from mains wiring in permanent installs.
✅ Pros: Five kits; easy to flash.
❌ Cons: Hobby grade; needs a programmer.
🎯 Verdict: Perfect for learning Tasmota and ESPHome on the bench.
🛒 Which Relay for Which Job
💡
Smart ceiling light, keep the switch
SONOFF MINIR4 or MINIR4M behind the existing switch, with detach mode for smart bulbs.
🚗
Garage door opener
SONOFF MINI-D or Shelly 1 Mini Gen4 dry contact across the opener’s button terminals, plus a door sensor for state.
🪟
Motorised curtains
SONOFF DUALR3 in shade mode with per-channel metering to detect end stops.
🚿
Water heater or pump
SONOFF BASIC-1GSP on a DIN rail for high-current circuits, installed by an electrician.
🌱
Irrigation controller
Waveshare ESP32-S3 6-channel running ESPHome sprinkler logic, with RS485 for a soil sensor.
🌡️
Greenhouse heater
SONOFF THR320D with a probe so heating keeps working even if Wi-Fi drops.
⚙️ Finished Modules vs Programmable Relay Boards
| Aspect | Finished Module (SONOFF, Shelly) | ESP32 Relay Board (Waveshare, LILYGO) | ESP-01S Relay Kit |
|---|
| Setup time | Minutes ⭐ | Hours (firmware, enclosure) | Hours (flashing) |
| Safety certification | Typically certified ⭐ | Board only | None |
| Channels | 1 to 4 | 4 to 6, plus GPIO ⭐ | 1 |
| Firmware freedom | Stock, Matter or community flash | Full ⭐ | Full |
| Extra interfaces | Switch input, metering (some) | RS485, I2C, sensors ⭐ | None |
| Best use | Permanent home wiring | Custom controllers | Learning |
❓ Frequently Asked Questions
Do I need a neutral wire for a smart relay?
Most Wi-Fi relays here need a neutral to power their electronics. Many older homes lack neutral at the switch box; in that case a no-neutral Zigbee relay is often a better fit. Compare options in our SONOFF Zigbee guide and Matter relay modules guide.
What is detach relay mode?
It decouples the wall switch input from the relay. Flipping the switch sends an event to Home Assistant instead of cutting power, so smart bulbs stay online and the switch can trigger any scene.
Can I flash SONOFF relays with ESPHome?
Many ESP-based SONOFF modules, including the MINIR4 and BASICR4, are widely flashed by the community using a USB to serial adapter on the board’s pads. Flashing voids the warranty, must be done with mains disconnected, and depends on the hardware revision. If you would rather not, use eWeLink LAN mode or a Matter model.
Wi-Fi, Zigbee or Z-Wave relays?
Wi-Fi relays need no hub and are cheapest. Zigbee and Z-Wave relays build a mesh and often have no-neutral options. See our Z-Wave relays guide for the alternative.
How much load can a 10 A relay really handle?
Treat the rating as a ceiling for resistive loads like heaters and incandescent lamps. Motors, compressors and large LED drivers draw high inrush current, so leave generous headroom or use the relay to drive a properly rated contactor.
🏁 Final Verdict: Best Wi-Fi Smart Relay Modules
Our picks by job:
🏗️ Best ESP32 Relay Board: Waveshare 6-Channel ESP32-S3
Buy Here →For everyday light switches, the SONOFF MINIR4 is hard to beat, and the MINIR4M gives you the same hardware with Matter for zero-flash local control. Reach for the MINI-D or Shelly 1 Mini Gen4 for dry contacts, and the Waveshare ESP32-S3 board when you want to write your own controller. This is part two of our Wi-Fi local control series after the local control smart plugs guide; see also our Shelly devices, Modbus relay and I/O modules and Matter relay modules guides.
💬 What did you automate with a relay module, and which firmware runs on it? Share your build in the comments below.
All Amazon links above use our affiliate tag (microlab05-20). Purchasing through them supports microcontrollerslab.com at no extra cost to you. Prices and availability change frequently, so always confirm the current price on Amazon before buying.