How To: Node Red – Integrate 433Mhz Wireless Wall Switch

Another handy find during my wanderings through the electronic product world is the 433Mhz wireless wall button. It can be easily integrated into NodeRed or any other SmartHome system using the RF bridge.

How to do this and what you have to pay attention to is explained in the following article.

Hints for our lovely english readers: Basically, many of the articles on Nerdiy.de are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section. 
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂


Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/en/sicherheitshinweise/

Affiliate links / advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and shop via this link, Nerdiy.de receives a commission from the online shop or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support Nerdiy.de in being able to offer further useful projects in the future. 🙂


Requirements

Helpful Articles:
Of course NodeRed should already be installed so that you can take over this configuration. In addition, the Sonoff RF Bridge should already be prepared.
How to prepare this and a RaspberryPi and then install NodeRed on it is described in the following articles.

RaspberryPi – Setting up for Nerdiys!
RaspberryPi – The first configuration
RaspberryPi – Controlling the RaspberryPi via SSH
NodeRed – Installing NodeRed on the RaspberryPi
NodeRed – Install New Nodes
NodeRed – Import and Export Node Code

Sonoff – 433Mhz RF Bridge flashing Tasmota firmware

Required tools:
-none-

Required material:

In the following list you will find all the parts you need to implement this article.


The wall button

The wireless wall button essentially consists of a flat housing including three easily accessible tactile surfaces.

Top view of the wall button including the supplied adhesive strips.
Back view of the wall button. The wall button can also be fastened with screws through the slots on the back.
View of the wall button with open housing. The opening of the housing is necessary to change the battery. But it is also accessible when the wall button is already attached to a wall.
For the operation of the wall switches, a L828 12V battery is required. This type of battery is also known as MN27, A27, V27GA, L828 and GP27A.
Close-up of the circuit board.
Closeup of electronic components.
Mounting example for the wall button. I stuck the wall buttons on the inside of the door frames because I did not want to stick them on the wallpaper. Thus, the buttons can be removed without removing the entire wallpaper with it. 🙂

Log in to the NodeRed configuration interface

Before you can edit your NodeRed configuration you must - if activated - first log in to the NodeRed configuration interface.

View of the login screen. Here you have to enter the login details that you entered during the configuration of the login. Information about this can be found in the article NodeRed - User Login Setup.

Import Node Code

The following NodeCode resembles the code that is also used for the window contact, SOS push buttton or mini push button. It triggers an action as soon as a Sonoff RF Bridge flashed with the Tasmota firmware receives a radio message with the appropriate data field. You can take over the code but still have to set the RF code of your radio button. This is described in the next step.

Of course, you also need to update the configuration for your MQTT server and possibly the topic under which you receive the RESULTS of your RF bridge.

Overview of the Node Code
[{"id":"31d6699d.0dce56","type":"function","z":"169c0bb.fea38f4","name":"Button-Press left detected","func":"if (msg.payload.RfReceived!==undefined)\n{\n    if (msg.payload.RfReceived.Data===\"RfData\")\n    {\n        msg.payload=1;\n        return msg;\n    } \n}","outputs":1,"noerr":0,"x":850,"y":3460,"wires":[["257f3901.e15e46"]]},{"id":"257f3901.e15e46","type":"debug","z":"169c0bb.fea38f4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1090,"y":3460,"wires":[]},{"id":"bb0242e1.88c8c","type":"comment","z":"169c0bb.fea38f4","name":"Wall Switch","info":"","x":390,"y":3420,"wires":[]},{"id":"57e050ec.b8da4","type":"function","z":"169c0bb.fea38f4","name":"Button-Press middle detected","func":"if (msg.payload.RfReceived!==undefined)\n{\n    if (msg.payload.RfReceived.Data===\"RfData\")\n    {\n        msg.payload=1;\n        return msg;\n    } \n}","outputs":1,"noerr":0,"x":860,"y":3540,"wires":[["80d70cd8.e9fa5"]]},{"id":"80d70cd8.e9fa5","type":"debug","z":"169c0bb.fea38f4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1090,"y":3540,"wires":[]},{"id":"dbc8c01a.24266","type":"function","z":"169c0bb.fea38f4","name":"Button-Press left detected","func":"if (msg.payload.RfReceived!==undefined)\n{\n    if (msg.payload.RfReceived.Data===\"RfData\")\n    {\n        msg.payload=1;\n        return msg;\n    } \n}","outputs":1,"noerr":0,"x":850,"y":3620,"wires":[["67d1b87a.34e048"]]},{"id":"67d1b87a.34e048","type":"debug","z":"169c0bb.fea38f4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1090,"y":3620,"wires":[]},{"id":"34c8a696.75339a","type":"mqtt in","z":"169c0bb.fea38f4","name":"","topic":"tele/RfBridge/RESULT","qos":"2","broker":"c94e86db.dfcde8","x":440,"y":3540,"wires":[["cf0b5a42.f4e4e8"]]},{"id":"cf0b5a42.f4e4e8","type":"json","z":"169c0bb.fea38f4","name":"","property":"payload","action":"","pretty":false,"x":640,"y":3540,"wires":[["57e050ec.b8da4","31d6699d.0dce56","dbc8c01a.24266"]]},{"id":"c94e86db.dfcde8","type":"mqtt-broker","z":"","name":"Server-Mqtt","broker":"server","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Reading and setting the correct RF code

In order for the above-mentioned Node code to work, you still need to set the RF code of your radio button in it. This RF code is a unique ID for each button and also different for each button.

Open the console of your RF-Bridge. In this you will be informed about current events on your RF-Bridge. Among other things, received RF codes are also displayed there.
As soon as you press one of the buttons on your wall button, the radio message sent by it, including the RF code, will be displayed in the console of your RF bridge. Now you have to copy/remember this RF code (indicated by the blue dot in the screenshot), because you have to enter it into one of the imported nodes.
Switch to the NodeRed configuration view and open the menu of the function node “Button-Press detected”. There you replace the part “RfCode” with your previously noted RF-Code.

Then you click on Done, send the changes to the NodeRed server and from now on you should receive a notification via the debug node each time you press the button.

If you do not receive it please check if you have to update the topic under which you receive the RESULTS of your RF-Bridge.


I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂

Fab

P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at ko-fi.com

Leave a Reply

Your email address will not be published. Required fields are marked *