Table of Contents
Sonoff makes some of the most affordable smart home hardware available. Their WiFi relays, smart plugs, switches, and sensors are based on ESP8266 or ESP32 chips — which means they're highly hackable and work great with Home Assistant. The question is how to integrate them.
You have four main options, ranging from the simplest (eWeLink cloud) to the most powerful (custom firmware). This guide covers all of them so you can pick the right approach for your needs.
Sonoff Device Overview
Popular Sonoff devices include:
- Basic R2/R4: Single relay module, fits in wall boxes
- Dual R3: Two-channel relay with power monitoring
- Mini R2/R4: Tiny relay that fits behind existing switches
- SNZB series: Zigbee sensors (temperature, humidity, motion, door)
- NSPanel: Smart wall panel with touchscreen
- S26 Plug: Smart outlet plug
- THR316/THR320: Temperature/humidity monitoring relay
Integration Methods
| Method | Local? | Firmware Change? | Difficulty |
|---|---|---|---|
| SonoffLAN (HACS) | Yes | No | Easy |
| Tasmota | Yes | Yes | Medium |
| ESPHome | Yes | Yes | Medium |
| eWeLink Cloud | No | No | Easiest |
SonoffLAN (Local, No Flash)
SonoffLAN is a HACS integration that communicates with Sonoff devices locally — without changing their firmware. It works by intercepting the local LAN protocol that Sonoff devices use.
Requirements
- HACS installed in Home Assistant
- Sonoff device paired to eWeLink app (initial setup only)
- Device on same network as HA
Setup
Install SonoffLAN via HACS. Restart HA. Go to Settings → Integrations → Add Integration → SonoffLAN. Enter your eWeLink username and password. Your devices will appear automatically.
Flashing with Tasmota
Tasmota is open-source firmware for ESP-based devices. Installing it on a Sonoff device gives you full local control via MQTT, a web interface, and excellent HA integration through MQTT discovery.
Flashing Methods
- OTA (Over-the-Air): Some older Sonoff firmware versions allow OTA flashing via a tool like Sonoff-Tasmota WebInstaller. Check tasmota.github.io for current compatibility.
- Serial flashing: Connect GPIO0 to GND during boot and flash via USB-to-serial adapter. Requires opening the device.
After Flashing
Connect to the Tasmota WiFi hotspot, configure your home WiFi, then access the Tasmota web interface. Set up MQTT with your broker's details. Home Assistant will auto-discover the device via MQTT autodiscovery.
Flashing with ESPHome
ESPHome gives you the most flexibility. You write a YAML config that defines every aspect of the device's behaviour, and ESPHome compiles and flashes custom firmware.
For a Sonoff Basic, a minimal ESPHome config might be:
esphome:
name: kitchen-relay
esp8266:
board: esp01_1m
wifi:
ssid: "YourSSID"
password: "YourPassword"
api:
switch:
- platform: gpio
pin: GPIO12
name: "Kitchen Relay"
Flash this via serial (same method as Tasmota), and the device appears in HA via the native ESPHome integration with full local API communication.
eWeLink Cloud Integration
If you want the simplest setup and don't mind cloud dependency, the official eWeLink integration is available. Install it via HACS or the built-in integrations. Enter your eWeLink credentials and your devices appear as entities.
The downsides: cloud dependency means a delay of 1-3 seconds for commands, and if eWeLink's servers are down, your devices won't respond through HA.
Which Method Should You Use?
- For most users: SonoffLAN via HACS. It's local, doesn't require firmware changes, and is well-maintained.
- For tinkerers: ESPHome. Total flexibility, native HA integration, and you control every aspect of the device.
- For reliability enthusiasts: Tasmota. Battle-tested, huge community, excellent MQTT integration.
- For beginners who just want it to work: eWeLink cloud. Simplest setup, just less reliable and private.
For Sonoff's Zigbee devices (SNZB series), pair them directly via Zigbee2MQTT or ZHA — no eWeLink account needed, and full local control from day one.
Bottom Line
Sonoff devices punch well above their price point for Home Assistant users. SonoffLAN provides the best balance of simplicity and local control for WiFi devices, while Zigbee2MQTT handles the SNZB sensor range flawlessly. If you're comfortable with firmware flashing, ESPHome turns Sonoff hardware into perfectly customised HA nodes.
SmartWired participates in the Amazon Associates Programme. We may earn a commission from qualifying purchases at no extra cost to you.