Putting a Sonoff in your wall switch box

go to youtube and look a “DrZzs” videos he put me stright and how o do it

The wires from GPIO/Gnd to the switch can be pretty small. It’s only 3v and low current. I just use Jumpers, which I think are 24g maybe.
The stranded wire I used was 16g I think. Even that was kinda tight. As long as the current draw from the lights stays low that shouldn’t be a problem. A problem would only arise if you had a short and the weakest link in the circuit was that bit of flexible wire. I did also just use the solid copper wires on some recent installs. That’s probably what I’ll do in the future too.

I was thinking last night about what modifications we’d have to make to the Sonoff Basic to make it pass the US electrical code and UL listing process. One of those changes would be a different kind of connection for the 120v terminals. I think we’d also have to case the whole thing in metal and add a ground connection.

Judging by what passes for US electrical code, they would more likely insist that the case be removed and the Sonoff held in a wet hand at all times :slight_smile:

Standing in a bucket of water holding a lightning rod. That’s about right!

Thanks. Yeah. I watched your video…and I remember you saying to use whatever gauge wire was already being used for the input and output voltage (makes sense)…but never heard you mention what size wire you used for the jumpers to the physical light switch. I also may just try to struggle with the more inflexible solid wire for the line voltage. I would like to use the thickest wire that I could fit through the GPIO14 and GND holes in the Sonoff for durability’s sake but wasn’t sure how to tell what that size was without good ole trial and error. Thanks again.

If you want to make it more secure but still use a big enough guage to fit the switch terminals nicely, solder headers into the gpio and then solder the wires to that.

I tried solid wire to the Sonoff basic but those connectors just really aren’t up to it from my experience at least. Nearly all aftermarket UL approved smart switches have stranded wire to wire nut into the solid house wire so I’m personally not that concerned about using stranded.

In regard to the GPIO14, 3v3, Gnd etc I like soldering in a header and then making up a connector for it but if you’re worried about the wire flexing and breaking loose soldered to the board a little bit of hot glue after soldering keeps things in place. If it’s good enough to be used inside commercial stuff for low volt wiring I figure it’s good enough for me. :slight_smile:

-Stephen

2 Likes

I was having same issue so I tried replacing Sonoff with another and that flickering went away. It’s been 2 days since new Sonoff and so far I have not noticed it.

1 Like

So it was hardware issue.
Glad you got it solved.

It worked fine for 2 or 3 days and now flickering started. It happens few times then goes away for few hours. So I ordered resistor and capacitors to do bypass solution and see how it works.

I saw on your YouTube channel u r running local broker. Is that on the Pi u have HA or completely different device. The question I have is that did you install MQTT addon on HA? Because I am not 100% sure if I setup the MQTT broker right? Because one of my Sonoff basic connected to rocker switch something turns off after few seconds. It would be a lot appreciated if you could do a video on proper way to setup MQTT broker.

I use hassio with the add-on and it works perfectly, setup is literally no more than it says in the docs and much simpler than the built in one from what I’ve seen.

Your issue sounds environmental assuming your soldering is ok :slight_smile:

I do have my MQTT broker on the same pi as HA.
When Hassio first came out I switched to it, but had problems with the MQTT component. Rather than figure it out I went back to hassbian.
I do need to try Hassio again. It’s been 6 months or so. I expect some of the early bugs are fixed.
I’ve got MQTT on my video to-do list. I’ll probably include a few different ways to set it up.
Bobby is probably right (he always is :wink:

Wish that was true, more like I always have an opinion :slight_smile:

Definitely recommend hassio to anyone, especially if coding isn’t a strong point, or even a point at all. HA on my Pi3 has been 100% rock solid since moving over to it when it was released to the animals. Everything I want has either become available as an add on or an easily added custom component and I genuinely haven’t had to reboot the Pi since installing as everything runs in containers you can turn things on and off as you see fit without affecting anything else.

Love it :+1:

I’ve gone off on a bit of a tangent from your three way switch (two way circuit) but inspired by the solution.

Essentially I’ve created a two way circuit where there wasn’t one using a Sonoff already controlling a different light. I’ve got one inside the house looking after the back door light and one in the garage opposite looking after a flood light, both with their own switches on GPIO14. What I’ve done is added a second physical switch to the GPIO of the back door one so i can now flick the garage flood light on and off from the back door.

Set up is as follows… in the web config set GPIO04 as Relay2, which gives me another toggle in the web ui home page, and set GPIO03 to Switch2.

Switch1 on GPIO14 still controls the Sonoff directly as before, so works if wifi is down, but the MQTT message the Sonoff generates has now gained a ‘1’ on the end, ie ‘stat/sonoff2/POWER1’, so have amended the switch in Home Assistant to reflect this. A second switch connected between GPIO03 and Gnd now gives ‘stat/sonoff2/POWER2’ so in Home Assistant I just use a change in that state to trigger another Sonoff although obviously it could be used to trigger anything.

Some have advised I should use SwitchTopic instead to do this but my issue with that is you then lose the direct control of the Sonoff from the wall switch as everything goes via MQTT, so no wifi, or Pi falls over, no switch!

Thanks for the confirmation. I believe you are right it does sound like interference issue. That’s why i ordered resistors and capacitors. I am planning to install that this weekend or so with help of DrZzs video channel on youtube and see how it goes.

These are the ones i ordered:

Good luck, be sure to let us know how you get on :+1:

I’m wondering if this should really be part of a recommended belt and braces solution anyway, ie just do it regardless when first installing, rather than an if it doesn’t work fix.

Alright, you talked me into it.

I can confirm that the capacitor and the resistor fixes the flickering issue. At least for the past 3 days I haven’t experience a single one.

1 Like

Is there a debounce option in Tasmota to help clear of this ghost presses?

When you had the flickering, I assume it was registering in the Sonoff’s console?