Node-RED Tutorial - Part 1
Zur Navigation springen
Zur Suche springen
Inhaltsverzeichnis
Introduction[Bearbeiten]
The following tutorial shows how to import nodes of Node-RED into expecco and how to use them.
Preconditions[Bearbeiten]
- Make sure you did the steps from Preperations and Installing Node-RED from NodeRED/en
Specify necessary paths[Bearbeiten]
- Open a new testsuite in expecco
- Now you should have the following view in front of you
- Click the undo-button to remove the existing demos
- Click on Extras → Settings
- Click on Execution → External Script Interpreters → Node
- Specify at Node.js Path the path to the Node.js interpreter
- Click on the question mark next to Node.js Path to verify the node path
- If the path is correct you will see the version of Node.js in the lower field
- Specify at Node-RED → Module Path the path to the node_modules folder
- Click on the three points next to the field
- A small window opens
- Click on the little house icon
- Click on the user directory of the current user
- Navigate in the user directory to the .node-red folder
- Navigate to the node_modules folder
- Select this folder and click OK
- Your path in the field of Filename should look like C:\Users\YOUR_USERNAME\.node-red\node_modules
- Specify at Node-RED → Execution Directory the path to the .node-red folder
- Click on the three points next to the field
- A small window opens
- Click on the little house icon
- Click on the user directory of the current user
- Navigate to the .node-red folder
- Select this folder and click OK
- Your path in the field of Filename should look like C:\Users\YOUR_USERNAME\.node-red
- Click on Apply and then on Close
- Click YES to save the entered paths
Importing a Node[Bearbeiten]
- Click on Operations → Node-RED → Importing Nodes
- A small window opens
- Click on the little house icon
- Click on the user directory of the current user
- Navigate to .node-red → node_modules → @node-red → nodes → core → network
- In this folder is a file called 21-httprequest.html
- Select this file and click on OK
- A new folder should have been created
- Open this folder and click on the elementary block to get the view which is shown in the picture
Using a Node in expecco[Bearbeiten]
- Click on the tab Test/Demo
- Click on the elementary block keep the left mouse button pressed and drag the block a little further to the middle of the editor
- Double click on input pin url
- Enter http://exept.de and click on OK
- Click on the green arrow to execute the block
- After you have executed the block, it takes a few seconds until you see a result
- When you see a result click on Run
- Click on Pins → msgOut
- Scroll in the field Keys to statusCode
- Click on statusCode
- If the HTTP request were successful the number 200 should be in the field next to it
Hint: Keep this testsuite open if you want to continue with the second part of the tutorial Node-RED Tutorial - Part 2