Sonoff DIY Tools
Local control toolkit for Sonoff smart switches
This entry covers Sonoff-LAN, a Python library and component enabling local control of Sonoff and eWeLink devices without the cloud. It integrates these devices into Home Assistant over the local network.
Key features
- Local Sonoff device control
- No cloud dependency
- Home Assistant integration
- Supports many eWeLink devices
Pros & cons
Strengths
- Frees devices from the cloud
- Active maintenance
Trade-offs
- Device firmware dependent
- Setup can be fiddly
Sonoff DIY Tools replaces
Last reviewed Sep 13, 2026 · 834 words
SonoffLAN is a Home Assistant custom integration, not a server, and its value is one specific trick: it lets Sonoff and other eWeLink-branded devices on stock firmware be switched from your LAN, with the cloud unplugged. That is the difference between a smart plug that works when your internet is down and one that does not. It does need a one-time login to your eWeLink account to fetch device keys, it depends on the device firmware playing along, and for the devices that can take it, flashing Tasmota or ESPHome is still the cleaner end state.
Three modes, and only one of them is the point
The integration, published by AlexxIT and installed through HACS, offers a mode setting per install: cloud, local, or auto. Cloud mode uses eWeLink's servers exactly like the phone app and is only there as a fallback. Local mode talks to each device on your LAN directly, over the same encrypted LAN protocol the eWeLink app uses when your phone is on home wifi. Auto uses local when it can and cloud when it cannot. The whole reason to install SonoffLAN is local mode, so plan for it: your Home Assistant box and the devices must be on the same subnet or you must route mDNS between VLANs, which is the point at which many setups get described as fiddly.
The device key comes from the cloud, once
Stock-firmware Sonoffs encrypt their LAN traffic with a per-device key that only eWeLink knows. SonoffLAN therefore needs your eWeLink username and password at setup to download the device list and keys. After that the keys are cached in Home Assistant and the cloud is never needed again unless you add a device. Block the devices at your firewall afterwards if you like; local control keeps working. This is the honest limit of "no cloud dependency": it is no cloud dependency after a single handshake, and if eWeLink ever changes the protocol on a firmware update your device pulls, you are back at the mercy of the integration's maintainer. Maintenance has been consistent for years, which is why it has 3,300 stars, but a firmware change is the failure mode to expect.
DIY mode is a different thing and mostly better
Some Sonoff models (the Basic R3, RF R3 and Mini family) have an official DIY mode where the device drops the eWeLink cloud entirely and exposes a small HTTP API on port 8081, advertised over mDNS, with no key exchange. You enable it by holding the button until the LED blinks, joining the device's temporary access point, and pointing it at your wifi. SonoffLAN discovers DIY-mode devices with no eWeLink account at all. If your fleet is those models, prefer DIY mode over LAN mode: nothing ever touches a cloud, and there is no key to lose. It also supports one-command OTA to third-party firmware, which brings up the real question.
The competing path: just flash it
SonoffLAN exists for people who cannot or will not flash. The alternative, for every ESP8266 and ESP32 based Sonoff, is to put Tasmota or ESPHome on it and get a device that speaks MQTT or the native ESPHome API to Home Assistant with no vendor in the loop, ever, plus features the stock firmware will never have (power monitoring calibration, custom buttons, local schedules). The cost is opening some devices to solder a serial header, a voided warranty, and an afternoon per batch. Newer Sonoff hardware built on other chips cannot be flashed at all, and that is where SonoffLAN becomes the only local option rather than the convenient one.
Where it fits in a real setup
A typical house: 8 Sonoff Minis behind light switches on stock firmware because they were installed before the owner cared, 3 Sonoff plugs doing energy readings, and a Zigbee mesh for everything else. SonoffLAN in local mode brings the 11 eWeLink devices into Home Assistant as normal switches and sensors with roughly 200 ms response, low enough that automations feel instant. RAM cost is negligible next to Home Assistant itself; the 128 MB figure on the catalogue entry is really about running the library standalone in Python, which almost nobody does. The rest of the home automation category carries on around it unchanged.
What I'd do
Install SonoffLAN via HACS in auto mode, log in once, confirm every device shows as local in the integration's diagnostics, then switch to local mode so nothing silently falls back to the cloud. Put the devices on the IoT VLAN with mDNS reflection to the Home Assistant VLAN. Over the following months, as devices come off the wall for any reason, flash the ESP-based ones to ESPHome and retire them from SonoffLAN. Keep the integration for the hardware that cannot be flashed, and accept that those particular devices live one firmware update away from a bad day.
Similar home automation apps
Home Assistant
Home AutomationOpen-source home automation that puts privacy first
Replaces SmartThings, Google Home
Frigate
Home AutomationLocal NVR with real-time AI object detection
Replaces Google Home
ntfy
Home AutomationSend push notifications to your phone via simple HTTP
Replaces Pushover, Pushbullet
Homebridge
Home AutomationBring non-HomeKit smart devices into Apple Home
Replaces Apple HomeKit hubs
Tasmota
Home AutomationOpen-source firmware for ESP-based smart devices
Replaces Tuya Cloud
ThingsBoard
Home AutomationOpen-source IoT platform for device management and data
Replaces AWS IoT, Azure IoT