Dual Sonoff Basics - Overcome Neutral Wire Missing - Possible?

We’ve recently moved house, and I’ve set about getting Philips Hue installed everywhere. It’s great! But, we now have the same old problem where the mains power switches will kill the power completely.

I’ve been looking into ways to replace the standard switches with analogue-style dimmer switches (not real dimmers), referencing this project. The problem I’ve got is that the light switches in my house don’t have a neutral.

So, I’ve followed the link in that project to this one, which suggests using the sonoff in the ceiling rose where there will be neutral + live. But, this then doesn’t give me enough control wires back down to the rotary encoder, which will be where the old switch was.

My current idea combines these two ideas, and uses two Sonoffs:

  • Place the first Sonoff in the ceiling rose connected directly to L + N for the bulb.
  • Swap the switched live in the ceiling to the neutral terminal. This now gives me L + N at the switch.
  • Place the second Sonoff in place of the switch, using hijinx’s project as a guide to get the rotary encoder up and running.

This will allow me to control:

  • The relay (in the ceiling) by app and the physical reset button. I may also add an external physical push button that I’ll wire into Sonoff 1’s GPIO and place it discretely by the ceiling rose.
  • The brightness of the bulb using the rotary encoder. This will be powered by incoming L + N, but there’d no output from the relay in Sonoff 2
  • Soft turning the light on/off by clicking the wall switch.

Does this sound feasible? I’m a n00b to HASS and electrician stuff, but I’m technical enough to give it a go!

1 Like

Personally, since you are using Philips Hue, I’d go with their dimmers and simply install them over your existing in-wall switches. There are TONS of 3d printed projects out there to allow for the Hue dimmer to sit above (and hide and/or protect) the mains switch. If you don’t have a 3d printer, you should be able to find a 3d printer online that will print and ship them to you.

This will allow you to not have to deal with the electrical part of the project and gain more control over the lights. Plus, a single Hue dimmer costs just a little more than as 2 Sonoffs (at least here in the US).

I know what you mean, but… I really like doing this kind of stuff! Also, I’m not a fan of the way the Hue dimmers work. You don’t seem to be able to use them to control single lights, only whole rooms, though I may be wrong on that so feel free to correct me!

I also want to keep the system as visibly old-fashioned as possible, so as not to upset the lady :slight_smile:

1 Like

Honestly, no idea on that as I use my remotes directly paired to HA. :smiley: MUCH more control.

I totally get that! So, for the original idea, it sounds like you have it worked out. Depending on the size of your gangbox, you may have to cut out a deeper section in the back for the second Sonoff (or go with something like a Wemos D1 Mini or other small to mini ESP8266 board). KeyYees has some really nice 1MB/ESP-12e boards that are TINY (https://www.amazon.com/gp/product/B07HF44GBT/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1).

For syncing (and this is where you are going to pull your hair out; Ask me how I know lol), I’d recommend going with MQTT to keep everything in sync and have HA read from there. You’ll want to flash the Sonoffs with either Tasmota or ESPHome (I’d go with the latter, personally) and then point them to the same topic on MQTT. This way, no matter where you control the light from, it’ll always have a single master record.

But bearing in mind that a smaller esp device will need a power supply.

1 Like

My house has the same issue although I could have easily run a neutral wire it seem more work than I needed to do.
All my house uses Shelly1 or Shelly2
All my switches are still all dumb with no neutral or earth.
As I have a 78 year old mother in law that would have difficulties using anything other than a normal switch.

+1 for the shelly’s. I added my first shelly with esphome not long ago, and I’m excited to use more going forward. They are small (seriously, ridiculously small), work with all existing switches (single, 3way, 4way), have thermistors for thermal protection, many models have current sense, and a few come in a ul listed flavor. All that for not much more imho than sonoff. Talk about a bullseye for old school light switches! I still like my sonoff for most stuff where size doesn’t matter, but for me only shelly’s go in a j-box.

Can you please dumb this down for me, like in a diagram? thank you

please come up with a schematic of how you intend to do all of that and post it. it’s hard to picture it in words.

1 Like

I searched thingiverse for you.

Thanks for the tips, people! I’m loving this community!

Here’s a diagram for what I currently have:

And here’s what I’m proposing in order to gain maximum functionality using only existing wiring:

In my proposed solution, Sonoff 1 will be used solely as a relay for the actual mains. This can be controlled remotely using HA, app, or physically, using the button on the Sonoff itself. I may also add some sort of button to the GPIOs so I can have a small externally-available button to save opening up the light fitting if everything else is down.

Sonoff 2 would then not be used as a relay at all. Instead, I’ll use a rotary encoder (KY-040) wired into the GPIOs to allow changing the brightness by turning, soft on/off by short-pressing the button, and cycling through predefined colours by long-press.

I know I don’t really need a Sonoff in position 2 - I could use a D1 mini or similar - but I like the fact that the Sonoff is mains powered, and by the time I’ve sorted out power for one of the other boards, I may as well have just got a Sonoff anyway.

The theory of this solution makes sense to me, but feedback would be much appreciated!

I did very similar to this and it works great.
Did you get it done after?

it looks OK to me.

The beauty of the sonoff is that it has a built in power supply :slight_smile:

This is great, it’s actually making me so happy inside!!

I am also looking at doing this (inspired by this thread of course) and @hijinx post which is genius! Just ordered two Sonoff Basics! I’ve got a bunch of parts like the rotary encoder etc. laying around. Been using HA for a few months now and I am loving it.

I’ve got 3 Sonoff Minis currently hooked up to my office, guest room, and the hallway upstairs. The hallway wiring was a bit of a headache to do but it worked the first time! My intention is to get the whole house eventually running off Sonoff Minis and Sonoff Basics. I’ve got the Sonoff D1 but it’s not as great as I’d hoped for it to be. Sorry, I digress…

Did you manage to make any progress on this @Rob_Methven ? Would be interesting to see how you got on. Hope it did go well!


TL;DR - Just use Shelly (or similar)!

3 years after my first flirtation with HomeAssistant, I’m back!

Just wanted to add a final comment here. I never got round to using the dual Sonoff setup I suggest above. As others have said, it should work.

However, since I’ve gotten back into HomeAssistant, I’ve also properly discovered Shelly devices. They’re great! Here’s what I did:

  • Fit Shelly in ceiling rose
  • Connect N & L to incoming mains (Wago connectors are a godsend)
  • Connect light to terminals according to instructions for the specific Shelly device (I’m using Shelly Plus 1PM)
  • Connect the wiring for the light switch to the Shelly, again according to the instructions for detached switch wiring
  • Configure Shelly to be in “Detached” mode
  • Create automation in HA to (soft) turn on/off the lights according to the detached Shelly input

This works great for me. I can kill the power to the light fitting completely using either HA or the Shelly app to turn off the relay, and I can soft turn on/off the lights with the light switch.

Hope this helps someone!