(UK) Light Switch

here are two different drawings for using the shelly in either a one way or two way switch (3 way switch in US) that will hopefully explain how it works:

It would work essentially the same with a Sonoff Basic except how things are wired to the Sonoff itself.

Sonoff won’t work this way, it only has one input that can accept high voltage.

That’s not entirely true.

Yes, as the device is configured out of the box there is no ability to use a switch but as soon as you put third party software on it (Tasmota/ESPHome) that also gives you the ability to utilize the GPIO pins with a header soldered on to allow a wall switch to toggle the relay.

True, but your schematic shows multiple high voltage connections to different pins - that’s a no no on Sonos and that’s what I was talking about.

Those diagrams were for the Shelly.

I also stated:

I can provide drawings for the Sonoff if you need me to.

I’ve ordered the shelly, however i’ve got 6 sonoff’s in the meantime. If you can show me the diagram your mentioning above i’ll give it a go.

From what i have read online in the past two days of my research is that sonoff apparently won’t work because it does not accept high voltage and that i would require a Shelly instead. It’s all going beyond my knowledge :sweat_smile:

You’ll have to program whatever firmware you load onto it to use GPIO14 as a switch input and decide what mode you want it to use (momentary toggle, edge toggle or follow).

As someone who is yet to flash their sonoffs to be used this way… what are the differences?
I thought there would just be an “on”,“off” or “toggle” option, not additional toggle options?

a momentary switch (pushbutton) has two states but the “on” state is only a temporary state while the button is being held down. to use that as a toggle the firmware should only use the change from either ‘off’ to ‘on’ (positive edge trigger) or ‘on’ to ‘off’ (negative edge trigger) but it should completely ignore the other. Otherwise as soon as you push the button it would toggle and when you release the button it would toggle back. So, when you push the button the relay switches to the opposite state and when you release the button nothing happens (if you use a positive edge trigger).

a normal light switch has two maintained positions (‘on’ & ‘off’) and can be used in two different modes.

the first mode is the ‘edge detection’ mode in which the firmware looks at ever change in state of the switch (‘on’ to ‘off’ or ‘off’ to ‘on’) and toggles the relay to the opposite state for every change in the switch. so in the end the device doesn’t care what the current state of the switch is compared to the state of the output just that there was change and the output was reversed in response to that change.

the other mode is a ‘follow’ mode in which the state of the output is always the same as the state of the switch (but only when the switch controls the relay but not when HA controls the relay). So if the switch is turned ‘on’ the relay will also turn ‘on’ (unless it was already ‘on’ then nothing would change…I think…I never use that mode). If the relay is ‘on’ and the switch turned to ‘off’ then relay will turn ‘off’ but if the relay is already ‘off’ then nothing happens when you turn the switch to ‘off’.

I hope that’s clear :wink:

If not I can try again. :slightly_smiling_face:

1 Like

What sonoff is this? Model?

Sonoff basic.

It’s a Sonoff Basic but you know i’m honestly not sure of the different versions.

It is the original version with the solder traces before they modified it with the wires. I’ve used a similar set up with the new version too but you need to use a different GPIO since GPIO14 isn’t broken out and accessible any longer. The new GPIO to use is GPIO3 which the Sonoff also uses as the RX pin. But since the only time that RX is active is in program mode that’s not an issue.

I’ll see if I can find a good image of the newer version that I can doctor up to show the connections or I may have to wait till I get home and take a spare one that I have apart to get a good image.

1 Like

Here is a pic showing the two versions side by side so you can get a good idea of the difterences. It’s literally just connecting one leg of your switch to RX instead of the missing GPIO14.

2 Likes

You can also consider something like these to install behind the switch:


its supported by zigbee2mqtt or philips hue hub for dimming.
The only thing is that it needs a momentary switch (aka Retractive swich in UK).

I am considering retrofiltting some switches I have using grid switches
(where the face place of the switch and the switch itself are separate)

e.g. these:

https://www.cef.co.uk/catalogue/products/32593-1-gang-flush-moulded-grid-switch-plate
and
https://www.cef.co.uk/catalogue/products/32214-10a-retractive-rockergrid-moulded-grid-switch

(because I have crabtree for all my other fixtures)

Shame on sonoff locking down their devices :frowning:
They did a big disservice to the DIY community.

I can very highly recommend the ESPHome addon for HA for sonoffs.
I have used ESPeasy, tasmota and ESPhome.
They all have pros and cons, but ESPhome is superb!

And I guess for completeness I should add that depending which firmware you flash and/or your end use set up you may have to add a filtering circuit to the switch circuit if you see “ghost” switching.

But I haven’t had any issues with mine since I switched first to Tasmota then on to ESPHome. Prior to that I needed a 10k pull down resistor in the circuit.

Very jealous that you have neutrals at your light switches in the UK! That’s pretty rare!

Means you have loads of choices available to you, shelly (which is personally what I would use) and also things like aeotec nano switch/dimmer as well (zwave). Versternet have some great wiring diagrams like this for a one way circuit (i.e. one switch controlling one light) and this for two way or more (two or more switches controlling one light, like in a hallway). The wiring for the shelly may be pretty similar.

I already posted the wiring for the shelly up around post 12

Fair enough! I didn’t read through the whole post, just stumbled across it whilst browsing the forum. I wish I had neutrals at my switches, would give me loads more choice! I can’t be bothered faffing with trying to install a shelly in each ceiling rose.