How To: NodeRed – Integrate 433 Mhz Window Contact

In the article about the 433Mhz mini push-button, I had already reported on my wanderings through the wonders of the electronic product world. Not only did I notice the 433Mhz wireless wall button, 433Mhz mini push button and 433Mhz SOS button, but also a 433Mhz window contact.

With this I supervise for several months now successfully the status of my windows.

This is especially useful with skylights, because it is very annoying if you leave them open for the full duration of a grown up rain-day.

So here is a small article describing how to integrate this 433Mhz window contact into your NodeRed configuration using the RF bridge.

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/sicherheitshinweise/


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 window contact

The window contact consists essentially of two parts: A main housing including the entire electronics and battery and a smaller housing in which a magent is included. The electronics in the main housing detect via this magnet whether the window is currently closed or opened.
The scope of supply also includes matching adhesive strips to easily adhere the housing.

Overview of the delivered parts of the window contact. The main housing (including battery), the sub-housing with the magnet contained therein two matching adhesive strips and – as usual – a little difficult to impossible (because in Chichesian) to be understood operating instructions.
The main case has on the back …
… also has a signaling contact. So the window contact also detects a possible sabotage attempt (ie removing the window contact) and notifies this by a radio message.
Closeup of the “feeler” of the window contact. This is really very sensitive and triggers a sabotage alarm even with small touches/changes.
The main and magnet housing again in size comparison.
The included adhesive strip fits …
… perfectly on the base plate of the main body. Opening the case – to change the battery, for example – is still possible in the “glued” position.
The sensor could look like this in place. The magnet housing can be positioned almost everywhere around the main housing. Important is that the longitudinal axis of the two housings must be parallel.

However, before you install the sensor, you should first configure it for your NodeRed configuration. Because in order to get to the RF codes of your window contact, you must be able to operate both the sensor contact and the sabotage contact.


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 wall push button 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.

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 *