NodeRed Introduction
Installation
- Update your system.
sudo apt-get update
sudo apt-get upgrade -y
- Install Node.js and npm.
sudo apt-get install nodejs
sudo apt install npm
- Install Node-RED.
sudo npm install -g --unsafe-perm node-red node-red-admin
- Test installation.
sudo ufw allow 1880
node-red
# In browser 127.0.0.1:1880
- Can install new nodes in folder
~/.node-red
npm i node-red-node-email
npm i node-red-dashboard
- Or click the manage palette, go to Install.
Troubleshootings
- Require nodejs greater than 13. You can,
sudo apt update
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
sudo apt install -y nodejs
node -v
Basics
- Drag inject and debug to Flow.
- Link them together.
- Click Deploy.
- At right hand panel, under info (ctrl+g i), click Trigger action for timestamp.
- Under debug (ctrl+g d), you can see the message.
- Can use function in between.
var newString = msg.payload.replace("world", "From Node-Red");
msg = {payload:newString};
return msg;
References
- Step by step guide to install Node-RED on Ubuntu 18.04 LTS
- node-red-node-mysql
- Beginners Guide To The Paho MQTT Python Client
- Intro to Node-RED: Part 1 Fundamentals
- How to update Node.js to the long term support version on Ubuntu 20.04?