How To: Node Red – Integrate 433Mhz Mini Push Button

On my (almost daily) wanderings through the wonders of the electronic product world I recently came across this little guy:

An approximately two-euro piece large 433Mhz wireless pushbutton powered by a CR2024 battery that can be discretely placed in just about any place. He has only one button and a signal LED and thus reminds me of the Amazon Dash buttons.

Thanks to NodeRed and the Sonoff RF Bridge, it can easily be integrated into your SmartHome. This way, smart lights or sockets can finally switch directly “on site”.

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.


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.

The mini button

The key consists of three housing parts and a PCB with a CR2024 button cell mounted on it.

Here is a size comparison with a one-euro coin.
Good to see is the big button and the underlying LED. The LED confirms a key press by a red light when the button is pressed.
The case can be opened – for example, to change the battery – by loosening the two Phillips screws on the bottom.
On the front side of the board, the button (in the middle) and the previously mentioned red LED (in the upper area of the board) can be seen.
On the back you can see the holder of the CR2024 battery. According to experience, these last quite a long time, because the button consumes energy only in the short moment in which it is pressed.
Close-up of the electronics. Unfortunately, the names of the ICs – as so often in products from the Asian region – removed or not visible.

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 or wall 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.

How to import your NodeCode is described in the article NodeRed – Importing and Exporting Node Code.

Overview of the Node Code
[{"id":"63d46c34.db4434","type":"function","z":"169c0bb.fea38f4","name":"Button-Press detected","func":"if (msg.payload.RfReceived!==undefined)\n{\n    if (msg.payload.RfReceived.Data===\"RfCode\")\n    {\n        msg.payload=1;\n        return msg;\n    } \n}","outputs":1,"noerr":0,"x":840,"y":3240,"wires":[["699ae5dd.9440cc"]]},{"id":"699ae5dd.9440cc","type":"debug","z":"169c0bb.fea38f4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1070,"y":3240,"wires":[]},{"id":"47af449c.7be14c","type":"comment","z":"169c0bb.fea38f4","name":"433Mhz-Mini-Switch","info":"","x":430,"y":3160,"wires":[]},{"id":"21d35009.da61c","type":"mqtt in","z":"169c0bb.fea38f4","name":"","topic":"tele/RfBridge/RESULT","qos":"2","broker":"c94e86db.dfcde8","x":440,"y":3240,"wires":[["7bef088d.ab9cb8"]]},{"id":"7bef088d.ab9cb8","type":"json","z":"169c0bb.fea38f4","name":"","property":"payload","action":"","pretty":false,"x":640,"y":3240,"wires":[["63d46c34.db4434"]]},{"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 your SOS button, the radio message sent by this, 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 *