Loading...
 

node-red notes

node-red

https://fontawesome.com/v4.7.0/icons/

npm install node-red-node-ping


npm install node-red-contrib-ui-led

npm install node-red-contrib-oracledb

npm install node-red-contrib-mssql

npm install node-red-contrib-salesforce

npm install node-red-contrib-facebook

npm config set ca ""

npm install -g --unsafe-perm node-red

npm install node-red-dashboard

npm install node-red-node-snmp

npm install node-red-node-mysql

npm install node-red-node-serial

npm install node-red-node-twitter

npm install node-red-node-email

npm install node-red-node-twillo

npm install node-red-node-ldap

npm install mathjs

npm install -g node-red-contrib-camerapi


Running on Raspberry Pi
https://nodered.org/docs/hardware/raspberrypi 

https://blog.opto22.com/optoblog/how-to-build-a-raspberry-pi-with-node-red-and-industrial-gpio

Step 3: Install Node.js, npm, and Node-RED
sudo su -
 
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
apt-get install nodejs -y
node -v (returns v6.11.0 or higher)
npm -v (returns 3.10.10 or higher)
npm cache clean
npm install -g --unsafe-perm node-red
exit
node-red
At this point, confirm Node-RED is running by navigating with your browser to your Pi and port 1880:
http://[hostname]:1880 (example: http://rpi-g4ph8h-benson:1880)

BONUS: Other nodes you may find useful
There are hundreds of Node-RED nodes available from npm and flows.nodered.org. Here are a few I’ve found useful for various tasks. There are two ways to install these nodes.
The preferred method is from within Node-RED. From the hamburger menu at the top right, select Manage Palette. Then click the Install tab in the left pane. You can search by the name of the node listed below, and click the small Install button.
If you prefer, you can also install from the command line. Use these steps:
* Establish an SSH session to your RPi.
* Navigate to your .node-red folder (usually found under /home/pi folder):cd .node-red 
Bigtimer - timer with dusk, dawn, months, days, manual override, schedule pause, and more
1. npm install node-red-contrib-bigtimer
Ping - for taking input and pinging devices on a network
1. npm install node-red-configurable-ping
MSSQL - for establishing a connection to a Microsoft SQL Server instance, locally or in the cloud.
* npm install node-red-contrib-mssql
MySQL - connect and exchange data with MySQL databases
* npm install node-red-node-mysql
M2X - for connecting to and interfacing with AT&T’s M2X IoT Platform
* npm install node-red-m2x
Bluemix - various nodes for interfacing with IBM Bluemix IoT platform
* npm install node-red-bluemix-nodes
Aggregator - for aggregating numeric values over a specific time span, including mean, median, min, max
* npm install node-red-contrib-aggregator
Moment - produces a nicely formatted Date/Time string
* npm install node-red-contrib-moment
SNMP - for fetching either individual oids, or a table oid from an SNMP-enabled host
* npm install node-red-node-snmp
Weather Underground - for getting the current weather conditions and forecast
* npm install node-red-node-weather-underground
Dropbox - to send and receive files from Dropbox cloud
* npm install node-red-node-dropbox
Modbus TCP - to communicate with Modbus/TCP devices over Ethernet.
* npm install node-red-contrib-modbus
Sparkplug - to communicate with Cirrus Link or Ignition MQTT servers with Sparkplug protocol
* npm install node-red-contrib-sparkplug
To install all nodes at once:
cd .node-red
node-red-stop
npm install node-red-contrib-bigtimer node-red-configurable-ping node-red-contrib-mssql node-red-node-mysql node-red-m2x node-red-bluemix-nodes node-red-contrib-moment node-red-node-snmp node-red-node-weather-underground node-red-node-dropbox node-red-contrib-modbus node-red-contrib-sparkplug
node-red-start


In the settings.js file (which will be in ~/.node-red) there is a setting called httpStatic you can use this to specify a directory that Node-RED will server up static content from.
...
// When httpAdminRoot is used to move the UI to a different root path, the
// following property can be used to identify a directory of static content
// that should be served at http://localhost:1880/.
//httpStatic: '/home/nol/node-red-static/',
...
If you set that to /home/pi/Destkop/WeatherImages as follows:
...
// When httpAdminRoot is used to move the UI to a different root path, the
// following property can be used to identify a directory of static content
// that should be served at http://localhost:1880/.
httpStatic: '/home/pi/Desktop/WeatherImages',
...
you can then set the image src as follows:
<img src="/sun.png">