I was contacted by an representative from ITEAD about testing some new equipment and write an unbiased blog post about it. I usually reject all such offers, but this one worked for me. Why? Well, all the stuff they offered was on my shopping list anyway! And my home is quite literally chock full of Sonoff relays, lamps etc.
So the first thing I started to play with was the SONOFF RF BRIDGE 433. This makes it possible to control switches, door bells, curtain openers etc that uses 433MHz communication frequency. I’m not interested in using the original firmware because I prefer to do my home automation setup in Node-RED. Here’s how it works.
SONOFF RF BRIDGE 433 Upgrade Firmware
So I decided to try the ESPURNA firmware that works with the SONOFF RF BRIDGE 433. I’ve tried Tasmota and ESPEasy on other Sonoff devices, but thought that this could be an excellent excuse to try out ESPURNA. There’s a really great tutorial on how to flash the new firmware here. Here’s a picture on the guts of the unit. As per usual, you need a USB TTL to Serial Adapter that works with 3.3 volts. You can find them easily on eBay or Amazon.
There is already a soldered header with 3.3 volt, rx, tx and GND available, so they really are making it easy to install your own firmware instead of the factory one. Great stuff! There’s a switch close to the programming header that needs to be set to off position to disconnect the ESP8285 from the SiLabs 8-bit micro controller that does all de encoding/decoding of signals. Don’t forget to set it to on again after uploading the firmware!
Connecting Devices Via 433MHz
So I bought some extra 433 switches and a remote control. I also got a door sensor, but that one was dead as a doornail (no pun intended), so I have to get it replaced. But no problem getting the remote control to work inside Node-RED. All you have to do is to go to the web interface for the device, select “RFBRIDGE” and press “LEARN” for the on and off switches. The SONOFF RF BRIDGE 433 will beep and you can press the button and the hexadecimal code will show up and then you just press save. The firmware does have six switches, but it can be increased up to a hundred if you modify some settings in the ESPURNA firmware. But there is another way. A way to be able to both receive and send ANY code you want! Directly from Node-RED!
Adding SONOFF RF BRIDGE 433 To Node-RED
To add the switches to Node-RED is really easy. I’ve named my RF Bridge SONOFF_RFBRIDGE, you have to replace all the instances to the name you have given your RF Bridge. Add an MQTT node and set the topic to SONOFF_RFBRIDGE/relay/0 and you’ll get a payload of 1 or 0 depending on the switch state of switch 0. To activate a switch via the RF Bridge, just send a “1” or “0” to your MQTT node with the topic DEVICENAME/relay/0. The relays are numbered from 0-5.
I’ve put in SONOFF_RFBRIDGE/relay/# as my topic, because using a hash sign receives all codes. I use a Switch Node to get six different outputs to make it a bit tidier. Then it’s easy to add nodes to the switch I’m interested in.
But What If Six Switches Isn’t Enough?
Well, I’m glad you asked. Because there is a “raw” input and output of 433MHz messages that you can tap into. That means that you can receive and send any code you like! How cool is that!
To receive all the RF codes, just create an MQTT node with the topic SONOFF_RFBRIDGE/rfin which will give you all the decoded 433MHz messages in hexadecimal. If you want to send a specific code, create an MQTT Out node and set the topic to SONOFF_RFBRIDGE/rfout/set. Now you just have to send the code directly to that node. Quite interesting possibilities there.
Does It Work With All 433MHz Equipment?
I’ve only tried ITEAD’s remote control, an NEXA remote and a bunch of mains relays and everything works perfectly. I’ve already connected several mains power switches to it to control lighting and it works without a hitch. I will install door and window detectors later on and update the article.
So there you have it, an excellent bridge between WiFi and 433MHz controlled equipment, all inside the comfy Node-RED environment. Only your imagination is stopping you now.