Putting a Sonoff in your wall switch box

I don’t think it’s possible with only one sonoff in your situation. You need to have power source and wires running to the light, all in one wall box, like in my diagram above to get away with using a single sonoff.

In your wiring situation you’d need 2 sonoffs, and automation setup to make both switches work.

Hi.

Is it possible to use the sonoff dual behind two light switches off the rocker/toggle type. I read that the switch on gpio0 will end up putting it into programming mode, so the only option is momentary switches on the dual? Is that correct?

Seems like you could do single device automated multi-switch circuits like he’s asking in a single box using a Shelly2.

You’d install it in the first (powered) box:

  1. Tie the neutral bundle and incoming powered hot to the Shelly 2’s N and L terminals. Now it has power. Tie it as well the upper left of the switch, as before.
  2. Using short pigtails, connect the lower left and right terminals of the switch to the Shelly 2 S1 and S2 switch inputs.
  3. Connect the traveler’s Red and Black wires to the O1 and O2 output terminals of the Shelly 2.

Then you’d just need to implement a bit of logic inside of Shelly 2/Tasmota so that it behaves like a cross-over “4-way” switch in the middle of a normal multi-switch circuit. I.e. toggle it between two states:

State 1: Straight: Pass state of S1 (powered or not) on to O1 and S2 state on to O2.
State 2: Crossed: Pass S1 state on to O2 and S2 state onto O1.

So something like this:

Note that only one of S1 or S2 will ever be powered through the first switch, so only one of O1 or O2 will ever be powered. Just like in a normal multi-switch circuit, there is no “on and off”, simply “up or down”. In fact this makes the Shelly2 function exactly like a “4 way” switch that sits in the middle of a 3-way circuit and criss-crosses power down the Red/Black travelers.

This isn’t any cheaper than two SONOFFs where a broker and automatic rule enforces the XOR state over WIFI. But it requires modifying only one switch box (with a smaller device to fit), it doesn’t require a functioning network, and if the Shelly 2 logic stops toggling, both physical switches would still work (similar as a 4-way switch getting “stuck” in one position).

One disadvantage with this setup is that although Shelly 2 would know the state of the first switch (“up or down”), it wouldn’t know the state of the 2nd switch close to the load, so it couldn’t tell you if the load/light is on or off. For that reason it would be far preferable to put a wifi switch in the box closest to the load (e.g. Box #2 above). But the big problem then is there is no consistent source of power in the box for it to operate with. If however, your box closest to the load has power entering from another circuit, this could be borrowed to power the wifi device. With a Shelly device, the input and output are connected by a relay, and there are separate L (line) and N (neutral) inputs to power the device. So instead of borrowing from another circuit to power the entire load, with a Shelly you’d be borrowing only to power the (sub-watt) device itself.

2 Likes

Quick question for anybody that knows, I’m running HassOs do I need to purchase anything else to get these to work on my pi3? Or do I just flash them and I’m good to go?

Thanks!

Just flash using OTA and you good to go.

1 Like

Thanks bro! Awesome to know!

Can I add a LED status light to the switch?
Have been trying to find a good solution for combining manual & smart switches.
Touch switches aren’t very responsive so figured will need to solder a manual switch to GPIO14 & GND but really looking for a solution where somehow I can add LED status light to the manual switch.

Thanks again!

Two light switches have been Tasmotized so far - I’m waiting for the next shipping. :hugs:

Here in Hungary and generally in a big part of Europe the main wires coming from the top to the switches without the neutral wire, and moreover the boxes are too small to hide a Sonoff in them.
The solution is using the electrical box near the ceiling where the switch wires and the input voltage meet with the wires going to the light. The wires between the two poles of the switch are hooked up between GPIO14 and GND, and done.

Hi,

I have multiple (I guess 8-10) Sonoff T1s (2-3 switch) and Sonoff Touchs. However we did not like the touch panel of the sonoffs and it is too late to buy Shellys. I’d like to mount them so that I will have a regular switch and wire that to the sonoff touch or T1 removing the touch panel section and the glass cover. Then fit them all in the hole where original switch was mounted.I know how to do it on Sonoff Basic but I already have the Touchs and T1s and also they are nice and round and fit easily to the space where European switches were. Does anybody know how to do that?

You can try cutting off the entire front plate and buy an EU blank plate and glue them together

But we need to use them as touch switches with EU blank plate right? What I was hoping to do was remove the actual touch surfaces from the front board and solder small cables to connect to the normal switch and see if I can use them as GPIO ports (detect status change) like when you connect a regular switch to a sonoff basic.

that can also work if you want to make it a physical switch

Yup I want a disigtal switch but don’t know the GPIO# for the touch surfaces. Also can you use them under Tasmota?

http://philipp.stiller.cc/blog/hacking-a-sonoff-touch has all the pin info

Thanks a lot @blakadder thanks for the link. I will try tonight.

  1. Can I just cut off the touch surfaces’ connection and solder two wires instead?
  2. Do you know the other GPIO# if I have a 2 gang Sonoff T1?
  3. Can I change the behaviour from instantaneous to change state in Tasmota?

Thanks for your guidance.

  1. yes, its a switch
  2. no idea, i never dealt with T1’s
  3. not sure what exactly you’re looking for but i’ll leave this here

I am not sure I understood the switch mode and switch topic in the link. What I mean by 3:
Since Regular EU Light Switches are on/off switches and not momentary switches. I have to change the relay on/off with every change in switch position. e.g. I may turn on the lights by turning the switch on and turn off the lights from Home Assistant app or through automation. When I change the switch position to off (essentially turn off the lights if there was no sonoff behind it) lights should turn back on since the switch position has changed. What should I use for switchMode and switchTopic for that behaviour? I believe I once saw a video for Sonoff Basic that did that.

the touch switch is a toggle switch, whatever you connect to its wires will behave the same

Above is what I have in my home. This is Ireland so similar to how UK homes would be wired. House was built around 2006.

I have flashed my Sonoff Basic with Tasmota, no problems, but I am trying to wrap my head around exactly how to wire it in here.

Apologies, I am a software engineer but my electrical knowledge is limited-ish… :wink:

You can see I have marked what I think will be in the output N and output L but I need to figure out the input N and input L

I’ve been following along with the great videos by @DrZzs but I guess his wiring is very US-centric, so doesn’t look to line up exactly like my own.

Any help is appreciated! Thanks.

For us UK based guys it’s easiest for us to connect the Sonoff up at the light rose in the ceiling, and connect the light “switch” wires to GPIO14.

It’s my job over Christmas if I get chance with the baby…