Changes

Jump to: navigation, search
no edit summary
After a while, Node-Red RED is ready to be started:
<pre class="board-terminal">
armbian@sbcspg:~$ node-red-start
==Implementing a simple application==
Many tutorials are available on the Internet showing how to develop, test, and deploy Node-RED based applications. Here, a simple example is shown. It consists of one flow that performs the following operations every 5 seconds(please note that the execution of the flow is triggered by a 5-second periodic timer):*It logs logging in the local debugger window a message containing the timestamp associated with the timer that reiggers the execution of the flow at regular intervals*It saves saving the timestamp on a local file*sending a message on a remote MQTT server.  Before creating this simple flow, the connection with the remote MQTT server can be tested (<code>test.mosquitto.org</code>):<pre class="board-terminal">root@sbcspg:~# apt install mosquitto-clients...armbian@sbcspg:~$ mosquitto_sub -h test.mosquitto.org -t "#" -v...</pre>   The test flow looks like this:[[File:SBCSPG-Node-RED-1.png|thumb|center|600px|caption]]   The following pictures show how the individual nodes were configured:[[File:SBCSPG-Node-RED-debug-logger.png|thumb|center|600px|''Debug'' node configuration]][[File:SBCSPG-Node-RED-MQTT-out.png|thumb|center|600px|''MQTT out'' node configuration]][[File:SBCSPG-Node-RED-file-out.png|thumb|center|600px|''File'' node configuration]][[File:TBD.png|thumb|center|600px|''Timer'' node configuration]]   Once deployed, to verify that the flow is working correctly, it is possible to read the local file where the timestamps are stored ...<pre class="board-terminal">armbian@sbcspg:~$ tail -f nr-flow1-test 157114596345715711459684611571145973478...</pre> and receive the test messages from the remote broker, by subrisbing to the test topic:<pre>armbian@sbcspg:~$ mosquitto_sub -h test.mosquitto.org -t "dave-am-test/#" -vdave-am-test 1571146144165dave-am-test 1571146149185dave-am-test 1571146154204...</pre>
4,650
edits

Navigation menu