HowTo: Node Red – Integrate 433Mhz window contact

In the article about the 433Mhz mini push-button, I already reported on my forays into the wonders of the electronic product world. It was not only the 433Mhz radio wall switch, 433Mhz mini push-button and 433Mhz SOS button but also a 433Mhz window contact.

I have been using it to successfully monitor the status of my windows for several months now.

This is particularly practical for roof windows, as it can be quite annoying if you leave them open for an entire rain shower.

Therefore, here is a short article describing how to integrate this 433Mhz window contact into your NodeRed configuration using the RF-Bridge.

Safety instructions

I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.

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 make a purchase via this link, will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support in being able to offer other useful projects in the future. 🙂 


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

The following articles describe what has to be done to prepare the RaspberryPi so far:
RaspberryPi – setup for nerdiys!
RaspberryPi – The first configuration!
RaspberryPi – Control the RaspberryPi via SSH

NodeRed – Installing NodeRed on the RaspberryPi
NodeRed – Install new nodes
Flash Sonoff 433Mhz Rf Bridge with Tasmota firmware

Required tool:

Required material:

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

The window contact

The window contact essentially consists of two parts: A main housing containing the complete electronics including battery and a smaller housing containing a magnet. The electronics in the main housing use this magnet to detect whether the window is open or closed.
The scope of delivery also includes matching adhesive strips for easy attachment of the housings.

Overview of the parts supplied with the window contact. Included are the main housing (incl. battery), the secondary housing with the magnet it contains, two matching adhesive strips and - as usual - an instruction manual that is somewhat difficult or impossible to understand (because it is in Chichesian).
The back of the main housing has a...
...also a signaling contact with which the window contact also detects a possible sabotage attempt (i.e. removal of the window contact) and reports it by radio message.
Close-up of the "sensor" of the window contact. This is really very sensitive and triggers a sabotage alarm even with small touches/changes.
The main and magnet housing compared in size.
The supplied adhesive strip fits...
...perfectly onto the base plate of the main housing. It is still possible to open the housing - to change the battery, for example - even when it is "glued on".
Installed on site, the sensor could look like this, for example. The magnet housing can be positioned almost anywhere around the main housing. The main thing is that the longitudinal axis of the two housings is parallel.

However, before you install the sensor, you should first configure your NodeRed configuration. This is because in order to access the RF codes of your window contact, you must be able to activate both the sensor contact and the tamper contact.

Log into the NodeRed configuration interface

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

View of the login dialog. Here you have to enter the login data that you specified during the configuration of the login. You can find information about this in the article NodeRed - set up user login.

Import node code

The following node code is similar to the code used for the wall button, mini button or SOS button. It triggers an action as soon as a radio message with the appropriate data field is received via the Sonoff RF Bridge flashed with the Tasmota firmware. You can accept the code in this way, but you still need to set the RF code of your wireless pushbutton. This is described in the next step.

Of course you also have to update the configuration for your MQTT server and if necessary 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 described.

[{"id":"63d46c34.db4434","type":"function","z":"169c0bb.fea38f4","name":"Button-Press detected","func":"if (msg.payload.RfReceived!==undefined)
    if (msg.payload.RfReceived.Data==="RfCode")
        return msg;
}","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 out and setting the correct RF code

In order for the above-mentioned node code to work, you must set the RF code of your wireless push-button. This RF code is a unique ID for each push-button and is also different for each push-button.

Open the console of your RF-Bridge. Here 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 bring the magnetic housing close (<2cm) to your window contact or press the tamper contact, the radio message sent, including the RF code, is displayed in the console of your RF-Bridge. You must now copy/remember this RF code (marked in blue in the screenshot), as you must now enter it in one of the imported nodes. There are different RF codes for the tamper contact and window contact in order to be able to differentiate between these events.
To do this, switch to the NodeRed configuration view and open the menu of the "Button-Press detected" function node. There you replace the part RfCode by your previously memorized RF code.

After that click on Done, sends the changes to the NodeRed server and from now on you should receive a notification via the debug node every time the window contact or the sabotage contact is changed.

If you don't receive any, please check if you need to update the topic under which you receive the RESULTS of your RF bridge.

Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂

PS 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 think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂

Buy Me a Coffee at       

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.