HowTo: Node Red – Execute Action at ServerStart

Je nachdem wie Ihr Eure Node-Red-Installation konfiguriert kann es praktisch sein, dass diese Euch bescheid sagt, sobald Node-Red neu gestartet wird.
So werdet Ihr zum Beispiel über Abstürze und damit verbundene Fehler in Eurer Node-Red Konfiguration informiert.

Wie Ihr so eine Status-Meldung einrichtet ist im folgenden Artikel erklärt.

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:
So that you can install new nodes, NodeRed should of course already be installed.
How to prepare a RaspberryPi and then install NodeRed on it is described in the following articles.

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

NodeRed – Installing NodeRed on the RaspberryPi

Required material:

Required material:

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

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.

Node-Code Beispiel

Im Prinzip besteht die Server-Start-Meldung “nur” aus einer Inject-Node mit einem gesetzten Haken bei “Inject once after … seconds then…”. Dies bewirkt – wie beschrieben, dass diese Inject-Node nach einem Neustart ausgeführt wird.

Hier kann man die Konfiguration der Inject-Node sehen. Durch den Haken bei “Inject after…” wird die Node nach dem Neustart von Node-Red ausgeführt. In dem Eingabefeld lässt sich auch eine verzögerte Ausführung einstellen.

Der folgende Node-Code gibt nach dem Neustart eine Nachricht über die Debug-Node aus. Im Node-Code ist die komplette Konfiguration enthalten.

Folgender Code

[{"id":"5c21935a.39e70c","type":"inject","z":"8c9f8f17.13eb78","name":"","topic":"","payload":"NodeRed just started!","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":3530,"y" :240,"wires":[["b3fff434.c1a8c8"]]},{"id":"b3fff434.c1a8c8","type":"debug","z":"8c9f8f17.13eb78","name" :"","active":true,"console":"false","complete":"false","x":3710,"y":240,"wires":[]}]

Node-Code Beispiel mit Pushbullet Nachricht

Eine sinnvolle Kombination ist es die Inject-Node mit einer Pushbullet-Node zu kombinieren. So wird nach einem neustart von Node-Red eine Pushbullet-Nachricht abgesetzt.
So wisst Ihr auch unterwegs bescheid, ob Eure Node-Red-Installation eventuell neu gestartet wurde.

Den Node-Code dazu findet Ihr in diesem Beispiel.

[{"id":"a604fa0e.8c5138","type":"pushbullet","z":"8c9f8f17.13eb78","config":"5ab02a71.121594","pushtype":"note","title ":"","chan":"","name":"","x":3470,"y":380,"wires":[]},{"id":"3017f8fc.bcd818", "type":"inject","z":"8c9f8f17.13eb78","name":"","topic":"","payload":"NodeRed has just been started!","payloadType":"str ","repeat":"","crontab":"","once":true,"onceDelay":"","x":3270,"y":380,"wires":[["a604fa0e. 8c5138"]]},{"id":"5ab02a71.121594","type":"pushbullet-config","z":"","name":""}]

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

The reCAPTCHA verification period has expired. Please reload the page.