Putting a Sonoff in your wall switch box

I don’t have google home (yet), so I can’t say for sure. If you have google home communicating with Home Assistant then my guess would be that it would still work.
It won’t work through the native Sonoff app if you put Tasmota on it.

Thank you for the info. Can’t wait to order a few more switches to play with.

1 Like

Made a video about flashing with Tasmota OTA. It’ll be out in the morning.

1 Like

Is it possible you can share wiring diagram? I am not electrician so it’s hard for me to understand. If you provide wiring diagram then it will help a lot. Thanks in advance. I have proper 3way switch ( one light being controlled by 2 switches) installed correctly and trying trying to add sonoff to be controlled from HA and physical switch.

I tried so many different way to make 3 way switches to work with one basic sonoff but it’s not working. I am excited for you to make this video so I can make this work.

Here you go…

Number of switches is irrelevant.

Thank you for quick reply. I try to make sense out of the diagram you provide but it seems like its too complicated for me.

I have only 2 physical switches (3 way switches) and I see that it doesn’t make any difference based on your post but let me ask you following 3 questions:

  1. Does it matter if my wire to light fixture is located at one switch and main power located at second switch? And I have traveler wires (red, black and ground ) running between those 2 switche. Neutral is also running in that bundle but it’s not connected to switches instead it’s connected to bundle of other neutral wires.

  2. Is there harm connecting wire with power to Gpio14?

  3. Based on below diagram how and where does sonoff connects?

From the looks of it, that odd way of wiring means it’s a non-starter for you as the you have some points you need to connect to in one switch box and some in the other.

You need the feed from the mains and the feed to the lamp in one place which would normally be at the light fitting or at one of the switch boxes.

You definitely can’t put mains power onto the low voltage side of the Sonoff, best case scenario would be an instantly dead Sonoff but it could be far worse.

Guess what I end up burning my sonoff basic so it no longer works. lol. but now this is what i came up with to control USA typical 3-way switch configuration. And i wanted to get your opinion before i order new sonoff switches and start playing with them. I think this should work if i can automate if sonoff one status change it automatically changes second sonoff status. And when server down the physical switch should just work normal.

Also, another question if I use dual sonoff instead of two sonoff would it do same trick or not?

Again thanks a lot for helping me out here buddy.

I was playing with following Idea but it didn’t go any where

Hi there, I just registered a few minutes ago and I have the same problem as patelrahul30297. I have 2 switches switching the same lamp(s) from two locations. It’s called “alternative switch” here in Hungary. Anyway, I think that the right wiring would be:

Left: original alternative circuit, hot source comes from the wall at the first switch, neutral and two switched to the second and to the lamp.
Right: both switches used to control SONOFF, source goes (from somewhere) to the lamp, interrupted by the SONOFF (sorry I had a relay symbol only).

The reason is that you’ll need all 3 wires to keep the “alternative” way of working and controlling the GPIO14 on the SONOFF board. The problem here is that you still need the supply for the lamps, so if you cannot feed the lamp(s) locally, you cannot solve the problem. Correct me if I am wrong please :slight_smile:

As far as I can tell your first diagram should work, do be very careful though and probably a good idea to leave some sort of note as to what you’ve done in the wall box in case an unprepared third party goes in there at any point in the future :astonished:

Hi Bobby, I know, I am the new guy here, but I do not agree. :slight_smile:
I mean it should work physically IF the server runs. The two module do the trick. As soon as they go offline, the physical switch cannot close the circuit as it goes thru the modules on both sides (or I missed something here?).

On the other hand, you need to configure the modules carefully, because you do not know which side closed at a given moment. If you want to switch from WIFI, you have to switch on the upper sonoff. The problem here is that you cannot switch off by the physical switch, only if the sonoff pins configured as a button, not a switch. My point here is that I do not know what will happen if a button-mode input gets continuous short.

Mea Culpa. I was wrong. The sonoff should work without server of course. Sorry about that. Anyway, I had some time during my way home, is there additional options than button and switch to do the second part of my post? I mean a kind of transition-change mode? Thanks in advance!

thanks. I will give it a try once my new sonoff arrives. The only issue i see in my first diagram is how would home assistant know which stage is the light bulb in. ex. if light is turned on or off. is there a way some kind of sensor i can place between 3-Way switch and bulb to check if current is flowing? are there any wifi connected sensors like that?

Good info on the two and three way switches - am going to have to figure my wiring out and give some a try on a couple of hallway locations I have.

I’m using my own firmware version and Wemo libraries that emulates a WeMo, ties to my legacy home automation system updates and updates status in Hassio system via the REST api.

Seems to work well so far with Alexa support via the Wemo, Hassio via the interface, my legacy http requests, and local button press.

In regard to wall mounting, if you have a 3D printer there are some nice ways to handle the in the wall needs including my remix of a wall mount box by HotTabascoSauce for an easy, lighted push button option.

Files are here: https://www.thingiverse.com/thing:2703968 for mine

HotTabascoSauce’s normal flip version is here: https://www.thingiverse.com/thing:2625610

I have a handful of them deployed and have been overall happy with them.

Good info here for sure!
-Stephen

Bit late, but the Sonoff POW can do exactly that.

thank you.

Now I have everything lined up, I just need to find some one smart enough to help me to put all this into programming code.

  1. instead of using 2 sonoff I want to use 1 Duel sonoff to save some space in the switch box.
  2. program duel sonoff so that those 2 relay always stays in opposite mode by automation.when ever relay one closes the other one opens up. so that virtually change of state in relay one will also change state in second relay. When physical switch flipped at dual sonoff, the state in second relay (not connected) will automatically change due to how its wired.
  3. In home assistant switch would lit on if sonoff pow that is attached between light and 3-way switch detects power. if power running is not detected then in HA it show status as off. And when ever i flip virtual switch on or off it changes the state of the one of the relay, which will also cause the change in state of other relay because how automation is setup in step 2.

i know i am not able to configure this because i am civil engineer and not computer or software engineer. So i am asking for anyone who can help me out this one.

The code is about as basic as it comes, simple automation that uses the state of one sonoff as the trigger the change the state of the other.

If you’re using a Dual you wouldn’t use a POW too, that setup would be one POW and one Basic. There wasn’t any room in my wall boxes for a single Sonoff Basic so I just put another wall box next to it with a blankng plate on the front so it still looks like it’s meant to be there.

Great video! I already have 5 of this working at home but now i need to control two switches. Do you know if the Sonoff Dual R2 would fit in the 2 gangs switch box?