Working Safely with Mains Voltage

What you need to know before installing a Shelly or opening a mains-powered device: the five safety rules, the right test equipment, typical traps in the wall box and when to call a qualified electrician.

Many of my videos and articles involve devices connected to the mains: Shellys in the wall box, a relay in a garage door opener, a repaired Wi-Fi plug. At 230 volts a single mistake is enough, and it can kill you. This page collects what I check before every one of these jobs. The articles link here instead of repeating the rules each time.

⚠️ This page is no substitute for training. If you are unsure about any step, have a qualified electrician do the work. My videos show how I did it in my home. They are not installation instructions for yours.

Who is allowed to work on the house wiring?

That depends on your country. In Germany, § 13 of the low-voltage connection ordinance (NAV) says that everything behind the main service fuse may only be installed, extended, modified and maintained by a company registered with the grid operator. A Shelly behind a light switch counts as a modification of the fixed installation. Austria, Switzerland, the UK and most other countries have their own rules, often just as strict. Check what applies where you live.

There is also insurance to consider: if there is a fire and amateur work was involved, your insurer may reduce the payout. If you rent, the wiring isn’t yours anyway, so ask your landlord first.

Plug-in devices are a different matter. Anyone may plug in a smart plug. Opening and repairing your own broken smart plug is work on your own device, not on the house wiring. The rules below still apply.

A pragmatic solution many people use: you plan, buy and configure the devices, and a qualified electrician wires them in.

The five safety rules

Electricians learn these first (in Germany they are part of DIN VDE 0105-100). The order matters.

  1. Disconnect. Switch off the right circuit breaker. Switching off the light switch is not enough, it often interrupts only one conductor.
  2. Secure against reconnection. A note on the breaker panel or a breaker lock. Tell everyone in the house. More than once someone has switched the “tripped breaker” back on.
  3. Verify the absence of voltage. Use a two-pole voltage tester on all poles: live to neutral, live to earth, neutral to earth. Test the tester on a live socket right before and after, so you know it works.
  4. Earth and short-circuit. In a low-voltage home installation this step usually doesn’t apply.
  5. Cover adjacent live parts. Important when other circuits in the same box or panel are still live.

Only then does the cover come off and the screwdriver go to the terminal.

The right tools

  • Two-pole voltage tester (EN 61243-3). A neon screwdriver tester is not suitable. With poor contact to you or the floor it shows nothing even though voltage is present.
  • Insulated (VDE) screwdrivers for the terminals. They don’t replace disconnecting, but they protect you if something was overlooked.
  • Wire ferrules and a crimping tool for stranded wire, so no single strands stick out.
  • Lever or push-in connectors of the right size.

Typical traps in the wall box

Most of my 230-volt smart home projects happen in a switch box or junction box. These are the points I have run into:

  • Several circuits in one box. Two-way switching and junction boxes often bring together wires from two breakers. One breaker off does not mean the box is dead. That’s why rule 3 applies to every conductor.
  • Neutral can be live. For example when it is broken or shared between circuits. Treat it like a live conductor until you have measured.
  • The RCD doesn’t protect against everything. It trips when current flows to earth through the protective conductor or through you. If you touch live and neutral at the same time, the current flows through you and back into the grid, and the RCD doesn’t notice.
  • Space and heat. A Shelly behind a switch needs a deep box. Squeezed wires and overheating relays are a fire hazard. Respect the load limits of the relay, especially with motors and LED drivers with high inrush current.
  • Check the terminals. Pull on each wire to make sure it is seated before the box is closed. A loose terminal gets hot and can stay unnoticed for years.
  • Missing neutral. Many old switch boxes only have live and switched live. Some relays need a neutral. Borrowing a neutral from elsewhere or using the protective earth as neutral is life-threatening.

Other mistakes I made while installing Shellys are in Shelly installation: 5 mistakes.

Opening and repairing mains devices

For repairs like replacing the capacitor in a Shelly 2.5 or a Sonoff S20, the circuit board is exposed. Additional rules apply:

  • Never run it open on mains. No “just a quick test” without the housing. On many of these devices the entire board sits at mains potential, including the parts that look like low voltage.
  • No USB adapter on a mains-powered device. If you flash a Shelly or Sonoff via the serial interface, power it only from the adapter. If it is connected to mains at the same time, your computer is at 230 volts.
  • Capacitors can stay charged. Wait a few minutes after unplugging, and measure on larger power supplies before touching the board.
  • Check after reassembly. Housing fully closed, no pinched wires, no solder residue on the board. Only then plug it back in.

When you should leave it alone

  • If you don’t know for sure which breaker belongs to which circuit.
  • If the box contains wires whose purpose you can’t identify.
  • In old installations without protective earth, with fabric insulation or brittle wires.
  • In the meter cabinet and the distribution board.
  • If you don’t have a voltage tester.

In all these cases a qualified electrician is the right choice. You can still do the setup in Home Assistant or the Shelly app yourself afterwards. That’s the part this channel is about anyway.

Articles on this blog that involve mains voltage

Licensed under CC BY-NC-SA 4.0
Built with Hugo
Theme Stack designed by Jimmy
Build: 2026-10-22 09:53 UTC