Node Red Part II

Structure


http://drsol.com/~deid/pi/Node-RED/index.html

    
                             Ok Here is the Obligatory Pond Part

Installation

Website

Install Script

$ bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

This script will remove versions of Node.js prior to version 7.x, and Node-RED and
if necessary replace them with Node.js 10.x LTS (dubnium) and the latest Node-RED from Npm.
 
It also moves any Node-RED nodes that are globally installed into your user
~/.node-red/node_modules directory, and adds them to your package.json, so that
you can manage them with the palette manager.
 
It also tries to run 'npm rebuild' to refresh any extra nodes you have installed
that may have a native binary component. While this normally works ok, you need
to check that it succeeds for your combination of installed nodes.
 
To do all this it runs commands as root - please satisfy yourself that this will
not damage your Pi, or otherwise compromise your configuration.
If in doubt please backup your SD card first.
 
Are you really sure you want to do this ? [y/N] ? y

Would you like to install the Pi-specific nodes ? [y/N] ? y

Running Node-RED install for user pi at /home/pi

This can take 20-30 minutes on the slower Pi versions - please wait.

  Stop Node-RED                       ✔
  Remove old version of Node-RED      ✔
  Remove old version of Node.js       ✔
  Install Node.js LTS                 ✔   Node v10.16.0   Npm 6.9.0
  Clean npm cache                     ✔
  Install Node-RED core               ✔   0.20.5
  Move global nodes to local          -
  Install extra Pi nodes              ✔
  Npm rebuild existing nodes          -
  Add shortcut commands               ✔
  Update systemd script               ✔
                                          

Any errors will be logged to   /var/log/nodered-install.log

All done.
  You can now start Node-RED with the command  node-red-start
  or using the icon under   Menu / Programming / Node-RED
  Then point your browser to localhost:1880 or http://{your_pi_ip-address}:1880

Started  Wed May 29 11:03:28 PDT 2019  -  Finished  Wed May 29 11:06:59 PDT 2019



Start Node-RED

pi@rasport4:~/NodeRed $ node-red-start  &

Start Node-RED
 
Once Node-RED has started, point a browser at http://192.168.78.200:1880
On Pi Node-RED works better with the Firefox or Chrome browser
 
Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   node-red-log                           to view the recent log output
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot
 
To find more nodes and example flows - go to http://flows.nodered.org
 
Starting as a systemd service.
Started Node-RED graphical event wiring tool.
29 May 11:12:35 - [info]
Welcome to Node-RED
===================
29 May 11:12:35 - [info] Node-RED version: v0.20.5
29 May 11:12:35 - [info] Node.js  version: v10.16.0
29 May 11:12:35 - [info] Linux 4.14.70-v7+ arm LE
29 May 11:12:36 - [info] Loading palette nodes
29 May 11:12:39 - [info] Settings file  : /home/pi/.node-red/settings.js
29 May 11:12:39 - [info] Context store  : 'default' [module=memory]
29 May 11:12:39 - [info] User directory : /home/pi/.node-red
29 May 11:12:39 - [warn] Projects disabled : editorTheme.projects.enabled=false
29 May 11:12:39 - [info] Flows file     : /home/pi/.node-red/flows_rasport4.json
29 May 11:12:39 - [info] Creating new flow file
29 May 11:12:39 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
29 May 11:12:39 - [info] Starting flows
29 May 11:12:39 - [info] Started flows
29 May 11:12:39 - [info] Server now running at http://127.0.0.1:1880/

====================
Autostart on boot

If you want Node-RED to run when the Pi boots up you can use

sudo systemctl enable nodered.service

and likewise sudo systemctl disable nodered.service to disable autostart on boot.

Installing Dashboard

  1. node-red-stop
  2. cd ~/.node-red
  3. npm install node-red-dashboard
  4. node-red-start

Data

Control

Documentation

Multiple Chains

There can be more than one chain of nodes in a flow.  See Text above.

Nomenclature ???

Navigation




Note:

Several questions were asked during the presentation about the defaults for node-red.  E.G.  the http port it listens on, the default nodes file etc.  All these questions and more will be answered by taking a look at the config file.

E.G.

~/.node-red/settings.js  For example:

   // the tcp port that the Node-RED web server is listening on
  uiPort: process.env.PORT || 1880,

 // The file containing the flows. If not set, it defaults to flows_<hostname>.json
 //flowFile: 'flows.json',