How to wire sonoff mini with light between power and switch

I have a light I want to control with sonoff mini but the L and N goes to the light box and a only a L leg goes to the switch box (see image). I have used the touch switch with this by using the bare ground as the N, the hot side of the L leg (black) as L IN and the cold side of the L leg (white) as the L OUT but the mini won’t stay on when I try this. The light flashes on but the immediately goes off and then the mini resets as if it lost power. I’m trying to avoid running a third wire from the attic to the switch box. I’m not sure why it works with my touch switch but not the mini.

Let me get this right?

You modified the wiring to make the ground wire the neutral?

If so, that’s really not advisable.

No I just used the ground as the neutral wire.

The way I see your drawing, it is strange your earth leakage circuit breaker did not trip (Maybe your light went off quick enough so the earth leakage circuit breaker had no time to trip). Using the ground for anything else but ground is bad practice.

You must have a really rubbish fuse/circuit breaker then!

I’m amazed that ever worked for you. You’re basically pumping live voltage down your earth (the earth is there as a safety measure).

I suggest you step away from the mains wiring and leave it to a professional since you clearly have no clue what you’re doing.


plus this:

is equal to:

Philip: “you said 1 + 3 = 4?”

Patrick: “no, I didn’t say that. I said 3+1=4”


I’ll try to explain why this is a bad idea…

The ground wire in most circuits is a bare copper wire (as it is in yours as you said so yourself). In a normal circuit both the ground and neutral wires are connected to ground inside the breaker box. HOWEVER, the ground should never carry any current while the neutral wire is designed to carry current.

If you use the bare copper ground wire as the neutral it will technically work just fine…UNTIL… the ground wire gets disconnected from the ground bar in the breaker box. At that moment in time you now have an uninsulated (i.e. bare) conductor that has mains voltage on it. You will then either kill yourself (which is bad enough but, hey, it’s your fault since you wired it like that…Darwin’s Law…) but what’s even worse is you could end up killing some other unsuspecting person who comes along later and has no idea that you effectively booby-trapped the ground wire in that circuit. Or, just as tragically but more personal to you, your dangerous re-wiring causes your house to catch on fire and you kill your family.

So…the moral of the story…DON’T DO IT!!

Do it right or don’t do it at all…

1 Like

What he said ^

The safe way to do this is to wire the Sonoff in the ceiling space (or similar) and use the existing switch wires as GPIO wires (having first fully disconnected them from the normal circuit) so that the switch wires are simply extending the GPIO down to the the light switch. You can then wire the Sonoff power connections to the existing incloming power and outgoing to the light. This can only be done if you have access to fully disconnect the existing light switch wires from the rest of the circuit in a suitable location to mount the Sonoff.

The beauty of wiring up the Sonoff (or any other smart switch device) in this manner is that you can easily create a smart switched light with single way, two way, three way etc, switching using only one Sonoff / smart switch.

Don’t go connecting an earth wire for anything other than an earthplease!

Whow ! Are there countries where it is still allowed to use bare copper wire in main electrical circuits ? Here it is forbidden already more then 50 years. It would never survive an electrical inspection. And a house must have an electrical inspection every 20 years, unless something is changed significantly, then immediately after the change.

Yep. In Australia once you install it then that’s usually it. No regular inspections. Some of the wiring in my house hasn’t been touched since the 60’s.

That said, if a sparky does a job and finds wiring as part of that job that doesn’t meet current standards - he is supposed to replace it (at your cost of course).

there may be but in this case the ground wire isn’t completely bare. it’s encased in an outer insulating sheath along with the two other actual current carrying conductors and those are not only encased in the outer sheath but are also individually insulated.

And that’s the point I was making above. the ground isn’t intended or designed to be continuously carrying load current like the insulated wires are. It should only ever carry fault current and only for a very short time - the time it takes the breaker to trip on a ground fault.