NodeRed Introduction


Installation

  1. Update your system.
  2. 
    sudo apt-get update
    sudo apt-get upgrade -y
        
  3. Install Node.js and npm.
  4. 
    sudo apt-get install nodejs
    sudo apt install npm
        
  5. Install Node-RED.
  6. 
    sudo npm install -g --unsafe-perm node-red node-red-admin
        
  7. Test installation.
  8. 
    sudo ufw allow 1880
    node-red
    # In browser 127.0.0.1:1880
        
  9. Can install new nodes in folder ~/.node-red
  10. 
    npm i node-red-node-email
    npm i node-red-dashboard
        
  11. Or click the manage palette, go to Install.

Troubleshootings

  1. Require nodejs greater than 13. You can,
  2. 
    sudo apt update
    curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
    sudo apt install -y nodejs
    node -v
        

Basics

  1. Drag inject and debug to Flow.
  2. Link them together.
  3. Click Deploy.
  4. At right hand panel, under info (ctrl+g i), click Trigger action for timestamp.
  5. Under debug (ctrl+g d), you can see the message.
  6. Can use function in between.
  7. 
    var newString = msg.payload.replace("world", "From Node-Red");
    msg = {payload:newString};
    return msg;
        

References

  1. Step by step guide to install Node-RED on Ubuntu 18.04 LTS
  2. node-red-node-mysql
  3. Beginners Guide To The Paho MQTT Python Client
  4. Intro to Node-RED: Part 1 Fundamentals
  5. How to update Node.js to the long term support version on Ubuntu 20.04?