Node-RED Tutorial - Part 1: Unterschied zwischen den Versionen

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen
Markierung: Geleert
Zeile 1: Zeile 1:
= Node-RED Tutorial - Part 1 =
The following tutorial shows how to import nodes of Node-RED
into expecco and how to use them.

== Specify necessary paths ==

* Open a new testsuite in expecco


[[Datei:New Testsuite in expecco.png|800px]]


* Now you should have the following view in front of you


[[Datei:Opened Testsuite.png|800px]]


* Click the undo-button to remove the existing demos


[[Datei:Click undo-button.png|500px]]
[[Datei:Blank Testsuite.png|500px]]


* Click on ''Extras'' → ''Settings''

[[Datei:Navigate to Settings.png|800px]]


* Click on ''Execution'' → ''External Script Interpreters'' → ''Node''


[[Datei:Node Settings.png|800px]]


* Specify at ''Node.js Path'' the path to the Node.js interpreter


[[Datei:NodeJS.png|800px]]


* 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


[[Datei:Verify path.png|800px]]


* Specify at ''Node-RED'' → ''Module Path'' the path to the ''node_modules'' folder
** Click on the three points next to the field


[[Datei:Specify Module.png|800px]]


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



[[Datei:Browse to node_modules.png|800px]]


* Specify at ''Node-RED'' → ''Execution Directory'' the path to the ''.node-red'' folder
** Click on the three points next to the field


[[Datei:Execution Directory Path.png|800px]]


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


[[Datei:Execution Directory.png|800px]]


*Click on ''Apply'' and then on ''Close''


[[Datei:Confirming module and execution path.png|800px]]


*Click ''YES'' to save the entered paths


[[Datei:Save paths.png|800px]]

==Importing a Node ==
*Click on ''Operations'' → ''Node-RED'' → ''Importing Nodes''


[[Datei:Importing a Node.png|800px]]


* 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


[[Datei:Select node to import.png|800px]]


* 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


[[Datei:Imported node.png|800px]]

== Using a Node in expecco ==

*Click on the tab ''Test/Demo''


[[Datei:Tab Test-Demo.png|800px]]


* Click on the elementary block keep the left mouse button pressed and drag the block a little further to the middle of the editor


[[Datei:pull block to mid.png|800px]]


* Double click on input pin ''url''
** Enter http://exept.de and click on OK


[[Datei:click url.png|500px]]
[[Datei:enter url.png|500px]]


* Click on the green arrow to execute the block


[[Datei:execute block.png|800px]]


* After you have executed the block, it takes a few seconds until you see a result
** When you see a result click on ''Run''


[[Datei:click on run.png|800px]]


* Click on ''Pins'' → ''msgOut''


[[Datei:click on pins.png|800px]]


* 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


[[Datei:view status code.png|800px]]


'''Hint:''' Keep this testsuite open if you want to continue with the second part of the tutorial

Version vom 10. Februar 2020, 09:17 Uhr

Node-RED Tutorial - Part 1[Bearbeiten]

The following tutorial shows how to import nodes of Node-RED into expecco and how to use them.

Specify necessary paths[Bearbeiten]

  • Open a new testsuite in expecco


New Testsuite in expecco.png


  • Now you should have the following view in front of you


Opened Testsuite.png


  • Click the undo-button to remove the existing demos


Click undo-button.png Blank Testsuite.png


  • Click on ExtrasSettings


Navigate to Settings.png


  • Click on ExecutionExternal Script InterpretersNode


Node Settings.png


  • Specify at Node.js Path the path to the Node.js interpreter


NodeJS.png


  • 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


Verify path.png


  • Specify at Node-REDModule Path the path to the node_modules folder
    • Click on the three points next to the field


Specify Module.png


  • 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


Browse to node modules.png


  • Specify at Node-REDExecution Directory the path to the .node-red folder
    • Click on the three points next to the field


Execution Directory Path.png


  • 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


Execution Directory.png


  • Click on Apply and then on Close


Confirming module and execution path.png


  • Click YES to save the entered paths


Save paths.png

Importing a Node[Bearbeiten]

  • Click on OperationsNode-REDImporting Nodes


Importing a Node.png


  • 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


Select node to import.png


  • 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


Imported node.png

Using a Node in expecco[Bearbeiten]

  • Click on the tab Test/Demo


Tab Test-Demo.png


  • Click on the elementary block keep the left mouse button pressed and drag the block a little further to the middle of the editor


Pull block to mid.png



Click url.png Enter url.png


  • Click on the green arrow to execute the block


Execute block.png


  • 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 run.png


  • Click on PinsmsgOut


Click on pins.png


  • 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


View status code.png


Hint: Keep this testsuite open if you want to continue with the second part of the tutorial



Copyright © 2014-2024 eXept Software AG