HowTo: Node Red – Import and Export Node Code / Flows

Another great feature of NodeRed is that the entire configuration - or even individual parts of it - can be exported formatted as a JSON string.

JSON strings are character strings that contain configurations formatted according to a specific pattern. But what makes it so easy to use is that they are simple text characters that you just have to copy and paste to transfer them from one system to the other.
So if you have put together a cool configuration and want to share it with your buddy, you can send him the configuration in a simple email.

I call this configuration “node code” in this and other articles. Usually (on other sites and also on the NodeRed site itself) this is called “Flow”, but I think the distinction from many other functions in NodeRed is not so clear. For example, the tabs in the NodeRed configuration interface are also called “flows”.
Plus, node code sounds kind of cool too. 🙂

Well, long story short: How to export and import node configurations is described in the following article.


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.
https://www.nerdiy.de/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 make a purchase via this link, Nerdiy.de 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 Nerdiy.de in being able to offer other useful projects in the future. 🙂 


Requirements

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

Required tool:
-no-

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.

Import node code

The following describes how to import an existing node code.

First click on the three gray bars in the top right corner.
…Then go to Import->Clipboard.
In the window that now opens you can insert the desired node code.
In the “Import to” area you can then choose whether you insert the nodes into the current flow or into a new flow. After clicking on “Import” the node code is converted into graphic nodes...
...and can be freely positioned in the desired flow with the mouse.

Export node code

The following describes how to export an existing NodeCode.

In order to export the NodeCode of a specific configuration, you must first select the relevant nodes.
These are then surrounded by a yellow/orange frame, which signals that these nodes are selected.
Now click on the three gray bars in the top right corner.
And then go to Export->Clipboard.
In the window that now appears, you first have the option of whether you want to export the selected nodes (selected nodes), all nodes of the current flow (i.e. the current page you are on) or all flows that you have configured . Since you have just selected nodes that you want to export, select “selected nodes” here. In the text field below you can already see the JSON string, which contains the configuration of the nodes. Below the text field you can use the “compact” and “formatted” buttons to choose whether you want to export the code in a legible format or in a more compact format. If you just want to transfer the code, “compact” is the right choice. To actually export, click on “Export to Clipboard”. You can then insert this exported NodeCode into other NodeRed configurations.

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 ko-fi.com       

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.