private@homelab: ~/latest
Home Assistant · Zigbee2MQTT · local control
private@homelab:~$ cat guides/article.md
·
· ·
8–12 minutes
read

Sonoff DIY Mode: Local Control Without eWeLink Cloud

Sonoff's DIY Mode swaps eWeLink cloud control for a local HTTP API, no reflash needed. Which devices support it, and how to bring it into Home Assistant.

Sonoff’s Basic R3, Mini, RF R3, and D1 are Wi-Fi devices built around the eWeLink app and eWeLink’s cloud. But ITEAD, the company behind Sonoff, also documents an official DIY Mode: a local HTTP REST API that supported devices can expose on the LAN instead of talking to eWeLink’s servers. It’s not a firmware replacement. It’s a mode that ships in the stock firmware.

That distinction matters because it puts DIY Mode in a different category from the Tasmota and ESPHome reflash routes that most local-control writing about Sonoff assumes. Enabling the local interface keeps stock firmware, although changing operating modes can clear user settings. The device exposes a local API in DIY Mode. Do not confuse this with standard eWeLink LAN control, which can coexist with cloud control and uses device encryption keys.

This piece works from ITEAD’s own DIY Mode protocol documentation, a Home Assistant Community thread on the feature, and the SonoffLAN project that’s grown up around it, not from hands-on testing. Blocking Tuya devices from the internet covers the parallel question on the Tuya side, if that’s the platform you’re comparing against.

Note · before you start

DIY Mode is not a blanket Sonoff feature. It’s documented for a specific device list, above a specific firmware version. Check your exact model and firmware against both before assuming your Sonoff plug or switch can do this.

What DIY Mode actually is

Per ITEAD’s own protocol documentation, DIY Mode switches a supported device from eWeLink cloud control to a local, unencrypted HTTP REST API. Once enabled, commands and status queries go directly to the device on the LAN. You keep stock firmware, although an older unit may need an official firmware update before the relevant DIY setup works. A local HTTP client or a compatible home-automation integration is still needed to send commands. This is an official, vendor-supported local-control path, which is a different trust posture than a community reflash even though the end result, control without the cloud, looks similar from the outside.

Which Sonoff devices support it, and which don’t

The current official DIY Mode protocol page lists the following models and firmware references. These are documented combinations, not a promise that every later product or firmware behaves identically. The archived GitHub v2.0 PDF is narrower than the current help page.

Model Type Documented firmware / scope
BASICR3 / RFR3 Wi-Fi relay; RFR3 adds RF 3.5.0 for the AP setup described here; 3.3.0–3.4.0 use the older v1.4 protocol
MINI / MINIR2 Compact Wi-Fi relay MINI is in the archived v2.0 spec; MINIR2 appears in the current table and MINI/MINIR2 in its setup example, with the 3.5.0 reference
MINIR3 Compact Wi-Fi relay 1.4.0 reference; use its separate API, rather than assuming MINI command payloads
D1 Wi-Fi dimmer 3.5.0; setup uses an RM433 remote
SPM-Main Power-meter controller 1.2.0; separate setup and SPM HTTP API
B02-BL-A60 / B05-BL-A19 / B05-BL-A60 Wi-Fi LED bulbs 1.4.0 reference; bulb-specific pairing sequence

SPM-Main belongs in this discussion because the vendor includes it in the DIY device set, but it is not a BASICR3 with power monitoring. It has a controller/sub-device API and a different commissioning route. Likewise, a later MINI revision does not automatically inherit the original MINI API.

Note · model naming

Match the exact model printed on the unit. A marketplace description such as “DIY smart switch” can describe its installation rather than support for this HTTP protocol. Check the model’s own documentation before buying for account-free control.

How discovery and the local API work

A device in DIY Mode advertises itself on the LAN via mDNS/DNS-SD, under the _ewelink._tcp service type, per ITEAD’s documentation. Clients discover the device’s IP address, port, and API version through standard DNS PTR, SRV, and TXT records. There’s no cloud lookup involved in finding the device once it’s on your network.

You can see this advertisement with any generic mDNS browsing tool. On Linux, that looks like:

terminal
avahi-browse -r _ewelink._tcp

A device in DIY Mode should show up with its resolved IP, port, and TXT record data. If nothing appears, check DIY commissioning, power and Wi-Fi first, then multicast reachability, wireless client isolation and VLAN boundaries. A missing advertisement has several possible causes; it does not establish that the feature is unsupported.

Because the local API doesn’t require an eWeLink account once DIY Mode is active, a supported device can be controlled without an eWeLink login for normal local operation. A unit that needs an official firmware upgrade may still need eWeLink for that earlier step. That’s the headline benefit. It comes with a real tradeoff covered further down, so don’t treat “no cloud login” as the whole story.

Enabling DIY Mode and initial local provisioning

The setup route depends on firmware and model, not simply whether the hardware looks old. The v1.4 documentation describes BASICR3, RFR3 and MINI firmware 3.3.0/3.4.0 using a GPIO16 jumper and an initial Wi-Fi network named sonoffDiy, password 20170618sn. That is a legacy procedure, not the AP configuration used in 3.5.0.

For BASICR3/RFR3/MINI/MINIR2 in the documented AP flow, hold the pairing button for five seconds. A unit already paired with eWeLink may require the documented reset followed by another five-second press. Connect a phone or computer to the device’s ITEAD-XXXXXXXXXX access point with password 12345678, open http://10.10.7.1/, and enter the destination Wi-Fi SSID and password. The page is a commissioning interface: once the device joins the LAN in DIY Mode, use its LAN address and advertised API port instead.

Use a 2.4 GHz Wi-Fi network and allow the controller to discover the device through mDNS. The current official page gives MINIR3 the same button/AP setup example but a separate 1.4.0 firmware reference. D1 enters pairing through the RM433 remote; SPM-Main uses its button/Bluetooth-pairing state and an Ethernet connection to reach its setup page. The listed bulbs use a power-switch sequence. Follow those model-specific instructions rather than applying the relay’s button sequence to everything.

SONOFF documents firmware 3.5.0 for DIY Mode 2.0 on BASICR3, RFR3, MINI and D1. This is a documented reference version, not a universal minimum for all models in the table. Its protocol page also says official firmware upgrades are available through the eWeLink app. Local operation can be account-free after commissioning without making every possible upgrade or setup path cloud-free.

Warning

These relays and dimmers are mains devices. The legacy jumper procedure requires opening the enclosure; disconnect the device from its power supply before opening or changing the jumper, as the vendor instructs. Use a qualified electrician for wiring and follow the exact model’s instructions. Changing operating mode can clear user settings.

Connecting DIY Mode devices to Home Assistant

The usual route into Home Assistant is SonoffLAN, a community-maintained custom integration (AlexxIT/SonoffLAN on GitHub). It handles both of Sonoff’s local paths, and the difference between them matters more than most write-ups admit.

DIY Mode is the unencrypted one. SonoffLAN’s documentation is explicit that DIY Mode devices can be used without eWeLink credentials precisely because their protocol is unencrypted. Standard eWeLink LAN mode is a different thing: it is encrypted, and the integration needs per-device encryption keys. SonoffLAN normally retrieves and caches them through an eWeLink account; it also documents supplying a device key manually. A manually supplied key still needs a legitimate source and does not turn standard LAN mode into account-free DIY commissioning. DIY Mode is the documented account-free local route, subject to the commissioning and firmware-update limits above.

Install it through HACS (or the project’s documented manual method), restart as instructed, and add Sonoff through Home Assistant’s integration UI. If adding a custom HACS repository, use:

HACS custom repository
Repository: AlexxIT/SonoffLAN
Category: Integration
Warning · the maintainer’s own advice

SonoffLAN’s documentation recommends running the integration in auto mode and specifically advises against local mode or DIY mode. The stated reasons: the local protocol isn’t always stable, devices can drop off or stop answering local requests, and some POW and TH models can’t update their sensor values without a cloud connection. Auto mode uses local and cloud paths for devices that support them. Its current README also warns that, starting in 2026, cloud updates for power, current and voltage sensors are blocked. Auto is therefore a connection preference, not a guarantee that cloud telemetry can rescue every sensor. These warnings cover the integration’s wider device set; they are not a claim that a BASICR3 has POW or TH sensors.

Start with the named project’s supported-device list, release notes and issue tracker when diagnosing a model. A fork’s existence alone does not establish that it fixes that device. Choosing between LocalTuya and tuya-local covers the same integration-choice problem on the Tuya side, and tinytuya covers local control without Home Assistant at all.

The security tradeoff of an unencrypted local API

This is the part that’s easy to skip past. DIY Mode’s local API is HTTP, not HTTPS. There’s no built-in encryption and, once enabled, no account credential gate on the LAN side either. That’s exactly what makes local control possible without eWeLink, and it’s exactly why the device shouldn’t sit on a flat network with everything else.

Anyone with LAN access to a DIY Mode device can, in principle, talk to its local API the same way Home Assistant or SonoffLAN does. That’s a reasonable tradeoff on a segmented IoT VLAN where only trusted hosts can reach the device in the first place. It’s a worse one on a flat home network where a compromised phone or a guest device shares the same broadcast domain. What Tuya’s app actually sends covers the opposite failure mode, cloud data collection, if that’s the tradeoff you’re weighing instead.

An officially documented local API gives integrators a useful alternative to replacing firmware. That doesn’t make the lack of transport encryption a non-issue. Treat DIY Mode devices the way you’d treat any other unauthenticated local service, on a network segment where reachability itself is the access control.

FAQ

Does Sonoff DIY Mode require flashing custom firmware? No. It is built into supported stock firmware. An older unit may still need an official update before it supports the documented setup flow.

Which Sonoff devices support DIY Mode? The current vendor page lists BASICR3, RFR3, MINIR2, MINIR3, D1, SPM-Main and B02-BL-A60/B05-BL-A19/B05-BL-A60. MINI is also covered in the setup example and archived protocol. The table above separates their firmware references; do not extend it to other models.

Is Sonoff DIY Mode’s local API secure, since it’s unencrypted? The account-free DIY path is plain HTTP, without the device-key protection used by standard eWeLink LAN mode. Restrict which hosts can reach it. Knowing the device ID is not equivalent to authentication.

Can I use SonoffLAN and the eWeLink cloud at the same time? SonoffLAN can combine normal local and cloud connections in auto mode, subject to model capabilities and current cloud restrictions. DIY Mode itself is documented as an alternative to eWeLink mode; auto mode does not turn an account-free DIY unit into a cloud-paired one.

How do I enable DIY Mode on a supported Sonoff device? Use the exact model/firmware instructions. The relay AP flow uses the ITEAD access point and local setup page; the legacy GPIO16-jumper flow is different, as are D1, SPM-Main and bulb commissioning. Official upgrades may require eWeLink before local setup.

What this piece verified

Checked against SONOFF’s current protocol and setup page, its archived DIY tools/protocol repository, the separate SPM API and SonoffLAN documentation on 24 October 2026. These sources establish supported model references, mDNS discovery, setup differences and the distinction between DIY HTTP and encrypted eWeLink LAN control. They do not establish compatibility for every later firmware release.

No hardware was commissioned or controlled for this article. Use the vendor instructions for physical installation and the integration’s device list for the features exposed in Home Assistant; vendor API support and complete integration support are separate checks.

local-firstHome Assistantno-cloud