Cheap & Easy DIY 433Mhz RF Light Switch to match existing switches/sockets

Like many other people I have a good Home Assistant based home automation system up and running but the missing link (for the lighting) has been some good looking physical switches. Like many people in the UK, all my light switches are wired to switch the live only with no neutral available. This rules out the use of things like the Sonoff WiFi switches. Recently Sonoff have started producing stick-on 433Mhz RF switches in single, dual and triple gang versions, and while they work, they look terrible. What I really wanted was a solution that looked exactly like my existing switches and didn’t require any rewiring of the existing electrics.

I think I have that solution.

Please Note: This is intended as an overview, not a detailed description of every single stage. You will need to do some additional reading to pull it all together. All the extra info you might need can be found easily on the web on YouTube, the Tasmota Wiki and the Home Assistant documentation.

What you will need:

A cheap programmable RF keyfob
A retractive switch of your choice
Smart bulbs that are already controlled by HA (I use Tradfri)
A Sonoff RF Bridge flashed with Tasmota (which I already had)
Some thin wire (I used a couple of breadboard jumper wires I had kicking about)
A soldering iron and solder.
A steady hand and about 5 minutes of your time.

The heart of this solution is based on these cheap programmable RF keyfobs you can pick up on Amazon,eBay, Banggood etc. For what they do, they are incredibly good value. If you buy them in packs of 10 they can come in at under £2.50 each.

here’s a link on Amazon UK for example:

https://www.amazon.co.uk/XCSOURCE-Electric-Cloning-Universal-Replacement/dp/B01KJRGP1Q

They provide all the functionality we need, are cheap, easy to take apart and most importantly small. Three screws on the back to undo and then you can pop out the small circuit board.

Note: before I dismantled the keyfob I programmed each button to the code I wanted. There are several videos on youtube on how to get the keyfob to learn new codes, and I used the Tasmota console on the RF Bridge to repeatedly send the code I wanted which the keyfob could learn. I did this using the “backlog” command so for example to repeatedly send hex AABBCC

backlog rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC; rfcode #AABBCC

For the purposes of this and to keep it short, I’ll assume you know how to flash the RF Bridge with Tasmota (the Portisch firmware is not required) and have a basic understanding of using Tasmota. There are multiple sources of info for this on the web.

Disconnect the battery. The next part is quite fiddly to do and that is to solder a couple of wires to either side of one of the surface mount buttons. I chose button D, but it doesn’t really matter which you choose.

Next all we need to do is connect the wires to the normally open contacts of the retractive switch. What is a retractive switch? It’s the name given (in the UK at least) to a momentary switch i.e. the contact is only made while you are pressing the switch – in other words it’s just a bigger version of the little surface mount button on the keyfob circuit board.

For the purposes of trying this out, I used a really cheap white plastic retractive switch plate with “PRESS” on the button

However, retractive switches are quite common and so can be found in many different styles. Some may have “PRESS” on the switch, some may not. You may find that you can get individual retractive switch modules that are part of a grid system of faceplates (google for “grid system switches”) and you can probably get a replacement rocker cover for the switch that does not have “PRESS” embossed on it.

Switch%20Plate
Grid%20Module

I have recently replaced all of our sockets and switches from the British General Nexus range which also has a very extensive grid system in addition to the normal switches.

Back to the build. With the wires connected, I mounted the circuit board on the plastic casing of the switch using double sided (non-conductive) tape as shown below

This is when I ran into a problem. I seems as if the metal in the switch was massively reducing the power of the transmitted signal. If I held the switch close to the Sonoff RF Bridge I got a signal, but anything more than a couple of feet away and no signal was received.

However, if I mounted the circuit board just a couple of cm away from the switch there was no problem, and the range was just as good as the original keyfob. So to simulate mounting in a wall I used a surface mount back box, and attached the circuit board to that instead. Everything worked exactly as expected.

So this proves that it can be made to work with very little effort and using off the shelf parts. All I did to integrate it into Home Assistant was to set up some rules on the Sonoff RF Bridge in Tasmota to send some custom MQTT messages:

Backlog rule1 on RfReceived#Data=2E1A11 do publish RFBridge/keyfob A endon on RfReceived#Data=2E1A12 do publish RFBridge/keyfob B endon on RfReceived#Data=2E1A14 do publish RFBridge/keyfob C endon on RfReceived#Data=2E1A18 do publish RFBridge/keyfob D endon; rule1 1

(a good video on Tasmota rules thanks to digiblurDIY can be found here: https://www.youtube.com/watch?v=w_CchtI-oK0)

…and then in HA set up an automation to toggle a light whenever the correct MQTT message is received.

Thoughts going forward:

When mounting this to the wall, it may be necessary to use a plastic back box instead of the usual metal back boxes as that may shield the RF signal. Care would also have to be taken with a metal back box to ensure nothing shorted out on the circuit board.

For my purposes, my intention is to leave the existing light switches intact and to add this extra switch next to it. I am doing this for safety reasons so that circuit board (and any potential short) is kept away from the mains voltage, and also to ensure there is a way of breaking the power to the light fitting other than the circuit switch on the consumer board. I strongly recommend if you are considering doing this, you do the same.

If using the grid system, up to four retractive switch modules could be connected to the same circuit board, all sending out a different code.

If I have a steady enough hand (and a magnifier) I may remove the surface mount LED and wire in a small 3mm LED mounted through a hole drilled on the face plate. That way you would know if the battery was still good as the LED would flash during transmission.

It may be possible to use other RF sensors such as door/window sensors with a little modification, however with four channels and programmability in such a small package, the keyfob is hard to beat.

I hope some of you find this useful!

3 Likes

Thank you for sharing your original solution with us. :+1: