---
title: "How to make ordinary lamps smart and keep the wall switches"
description: "A relay behind the wall switch makes an ordinary lamp smart and leaves the switch on the wall. You learn when you need a relay with a neutral, when one without, and what you lose with Detached mode."
canonical: "https://realhomeautomations.com/en/projects/make-ordinary-lamps-smart-keep-wall-switches/"
language: en-US
updated: 2026-11-23T16:24:04+00:00
---

# How to make ordinary lamps smart and keep the wall switches

A relay behind the wall switch makes an ordinary lamp smart and leaves the switch on the wall. You learn when you need a relay with a neutral, when one without, and what you lose with Detached mode.

> Canonical HTML page: https://realhomeautomations.com/en/projects/make-ordinary-lamps-smart-keep-wall-switches/

- **Difficulty:** Intermediate
- **Build time:** 30–60 minutes
- **Reading time:** 6 minutes

## Tools required

- Circuit breaker in front of the relay (6 A for ZBMINIL2, 10 A for MINIR4)
- Zigbee coordinator with ZHA or Zigbee2MQTT (for ZBMINIL2 and ZBMINIR2)
- 2.4 GHz Wi-Fi and an eWeLink account (for MINIR4)


## What readers will learn

- Tell a switch with a neutral from one without and choose a suitable relay
- Understand what Detached mode does and why the switch stops turning the lamp on
- Add the relay to Home Assistant and show it as a light
- Check the switch, the lamp and the behaviour after a power cut


## Skill requirements

- Add a device in Home Assistant through ZHA, Zigbee2MQTT or Sonoff
- Read states in Developer tools → States
- Describe the type of switch and lamp

## Project kit

- [Smart WiFi relay Sonoff MINIR4, 10A, 1 channel](https://realhomeautomations.com/en/product/smart-wifi-relay-sonoff-minir4-10a-1-channel/index.md)

A smart bulb stops being smart as soon as someone turns off the wall switch: the bulb is left without power and the app has nothing to control. A relay behind the switch solves this. It powers the lamp instead of the switch, and the switch only tells it "turn on" or "turn off".

 ## How it works

 The relay is installed in the switch box, on the path of the live wire to the lamp. The wall switch is connected to its inputs (S1 and S2 in the Sonoff documentation) and no longer breaks the power to the lamp. The relay reads the switch and changes its state. Home Assistant can change the same state over Zigbee or Wi-Fi.

 The lamp stays ordinary, the switch stays on the wall. The switch and Home Assistant talk to the same relay, so whoever gave the last command wins. The automation and the switch do not "know" about each other.

 ## Neutral or no neutral: choosing a relay

 The neutral wire is the second wire the current returns through. In many switch boxes it does not reach, because the switch is placed only on the live wire to the lamp. The relay has its own electronics and must be powered all the time. If there is a neutral, it takes power from there. If there is none, it passes a very small current through the lamp itself.

 More than one switch, or the circuit of another lamp in the same box, can make the wiring different from what you expect.

 RelayNeutralConnectionMaximum load (per the manufacturer)Detach mode[Sonoff ZBMINIL2](https://realhomeautomations.com/bg/produkt/sonoff-zbminil2-extreme-no-neutral-relay/)not neededZigbee, end device (does not relay the signal)6 A; LED up to 300 W at 230 V; inductive loads such as fans are not supportednot described in the documentation[Sonoff ZBMINIR2](https://realhomeautomations.com/bg/produkt/sonoff-zbminir2-zigbee-smart-relay/)requiredZigbee, can relay the signal10 A resistive, up to 2400 W at 240 Vyes[Sonoff MINIR4](https://realhomeautomations.com/bg/produkt/smart-wifi-relay-sonoff-minir4-10a-1-channel/)requiredWi-Fi 2,4 GHz, eWeLink10 A resistive, up to 2400 W at 240 V; not for inductive loads above their rated poweryes The relay without a neutral has a price. The manufacturer states a minimum supported load of 3 W LED and says an anti-flicker module is not needed. Below 3 W the relay is not guaranteed. Some LED lamps also react to the small current through them: they glow faintly when off or flicker. So try the relay with the lamp that will stay in place.

 ## Detached mode: what it does and what it costs

 Normally pressing the switch changes the relay's state. In Detach Relay (Detached) mode the switch and the relay are separated: pressing does not change the relay, it only sends a signal. The relay is controlled only by an app, a scene or an automation. Sonoff describes it for MINIR4 and ZBMINIR2. For ZBMINIL2 there is no such mode in the documentation.

 Separation makes sense when the switch has to trigger a scene and not turn on its own lamp. The price is high: **the wall switch no longer turns the lamp on.** If Wi-Fi, the coordinator, Home Assistant or the relay itself stops, nobody can turn on the lamp from the wall. A guest or a child presses the switch and nothing happens.

 So for a room where there must always be light, leave the relay in ordinary mode. If you want a scene button, it is safer to add it separately, for example with the wireless button [Sonoff SNZB-01P](https://realhomeautomations.com/bg/produkt/sonoff-snzb-01p-smart-wireless-button-zigbee-3-0-multi-action-control-and-compact-design/), and not to take the lamp's switch for a button.

 ## Installing the relay

 The relay must be fully enclosed in the box, and neither neutral nor earth is ever connected to S1 and S2.

 ## Adding it to Home Assistant

 **Zigbee relay (ZBMINIL2, ZBMINIR2).** You need a Zigbee coordinator with ZHA or Zigbee2MQTT. In **Settings → Devices & services** open ZHA and choose **Add device**. Put the relay in pairing mode: hold its button for 5 seconds. If the button is not accessible, Zigbee2MQTT describes an alternative for ZBMINIL2: ten consecutive toggles of the external switch. The green indicator shows whether the relay is in pairing mode.

 **Wi-Fi relay (MINIR4).** It is added first in the eWeLink app, because the Sonoff integration takes the device list from your account there. After that the relay is visible in Home Assistant. The integration prefers the local network when the relay is reachable, and goes through the cloud otherwise. Local mode needs working mDNS between Home Assistant and the relay.

 After adding, the relay appears as `switch.*` with the device's name. If it is a lamp, turn it into a light: **Settings → Devices & services → Helpers → Create helper → Switch as X**, choose the relay and the type **Light**. This way it behaves as a light in dashboards and voice assistants, not as a plug.

 Also set what the relay does when power comes back. ZHA shows `select.*_start_up_behavior` for ZBMINIL2, and the Sonoff integration shows `select.*` with a choice between `off`, `on` and `stay`. For a lamp you usually choose `off` or the last state. Choosing "on" means the lamp lights up after every power cut, even when you are on holiday.

 ## Check

- Press the wall switch. The lamp should light up, and the state of `switch.*` in **Developer tools → States** should change.
 - Turn the lamp on and off from Home Assistant. Then press the switch. If the switch has a fixed position, you will sometimes have to press it twice, because its position no longer matches the state of the lamp. This is normal for a relay without Detached.
 - Turn off the circuit breaker and put it back. The lamp should become what is chosen in `start_up_behavior`.
 - Stop the Zigbee coordinator or the Wi-Fi router for a while. The wall switch must turn the lamp on and off even without them.

 ## If it does not work

- **The relay does not pair.** Check that it is wired and powered correctly, especially the L In input, and that the coordinator is close during the first pairing. If the coordinator is far away, add a Zigbee router: ZBMINIL2 itself does not relay the signal.
 - **The switch does the opposite of what you expect.** ZBMINIL2 is set for a switch with a fixed position. If you have a push button, press the relay's button three times until the green indicator blinks three times. This changes the type of the external switch.
 - **The lamp glows faintly or flickers when off.** Stop. This is a sign of too small a load for the relay without a neutral. Change the lamp.
 - **The device is unavailable.** With a Wi-Fi relay this is most often the network or range. With Zigbee: the coordinator or a missing router on the path.

 ## Limitations

- The relay is an on/off switch, not a dimmer. It does not adjust brightness, even if it controls a dimmable lamp.
 - Do not use it on motors and fans, unless the manufacturer of the specific relay allows them. For ZBMINIL2 inductive loads are not supported.
 - Sonoff describes that in eWeLink the click of the external switch becomes a scene condition on MINIR4. Check it yourself in **Developer tools → States**, watching the `sensor.*_action` of the relay when pressed.
 - If you stop Home Assistant, the relay in ordinary mode is still controlled by the switch (according to the manufacturer, the switch controls it locally). In Detached the switch does not control the lamp.

 ## Sources

 The models, their number and their state are from Marto's Home Assistant as of 19.10.2026. The description of the modes, loads and installation follows the manufacturer's documentation.

- [Sonoff ZBMINIL2: specification, limitations and wiring](https://help.sonoff.tech/docs/zbminil2)
 - [Sonoff ZBMINIR2: neutral, Detach Relay and Zigbee router](https://help.sonoff.tech/docs/zbminir2)
 - [Sonoff MINIR4: Detach Relay, load and protection](https://help.sonoff.tech/docs/minir4)
 - [Zigbee2MQTT: ZBMINIL2, pairing and switch type](https://www.zigbee2mqtt.io/devices/ZBMINIL2.html)
 - [Home Assistant: ZHA integration](https://www.home-assistant.io/integrations/zha/)
 - [Home Assistant: helper Switch as X](https://www.home-assistant.io/integrations/switch_as_x/)
 - [SonoffLAN: Sonoff integration for Home Assistant, local mode](https://github.com/AlexxIT/SonoffLAN)