Node-red experiments

I've been looking at the tech.scargill.net website, which is a fount of all ESP8266 knowledge. His recommendation is to use Node-red to setup IoT networks based on MQTT, so I've installed it on my Mac, using the instructions at this location. Seems to work ok - I went to nodejs.org and installed 8.9.1 LTS, then did sudo npm install -g --unsafe-perm node-red. 

There were some deprecated warnings on the install, about versions being out of date, but I have to assume that node-red uses those, so little chance to modify/alter.

npm WARN deprecated i18next-client@1.10.3: you can use npm install i18next from version 2.0.0
npm WARN deprecated nodemailer@1.11.0: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
/usr/local/bin/node-red-pi -> /usr/local/lib/node_modules/node-red/bin/node-red-pi
/usr/local/bin/node-red -> /usr/local/lib/node_modules/node-red/red.js

> bcrypt@1.0.3 install /usr/local/lib/node_modules/node-red/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

[bcrypt] Success: "/usr/local/lib/node_modules/node-red/node_modules/bcrypt/lib/binding/bcrypt_lib.node" is installed via remote
+ node-red@0.17.5

added 367 packages in 30.862s

I haven't set node-red up to start on Mac boot yet - I can always run it when I want.

Screen shot from node-red web page

For future reference, use pm2 to run it on startup:

If you no longer know the Node-RED path, run this command
On macOS, it should be in /usr/local/bin/node-red .
To run NodeRED, run this command PM2
The configuration is saved and automatic start is activated

Now all I need is some devices to control!! Obviously, I'd run the server on a RPi3 were I to be doing this for real, right now I'm just seeing how it all works.

Update

I have installed Node-Red on the RPi3 using the instructions on this page. Output from this, for future reference...:

pi@server:~ $ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at http://192.168.1.4: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 Nov 17:43:50 - [info]
Welcome to Node-RED
===================
29 Nov 17:43:50 - [info] Node-RED version: v0.17.5
29 Nov 17:43:50 - [info] Node.js  version: v6.12.0
29 Nov 17:43:50 - [info] Linux 4.9.35-v7+ arm LE
29 Nov 17:43:51 - [info] Loading palette nodes
29 Nov 17:43:55 - [info] Settings file  : /home/pi/.node-red/settings.js
29 Nov 17:43:55 - [info] User directory : /home/pi/.node-red
29 Nov 17:43:55 - [info] Flows file     : /home/pi/.node-red/flows_server.json
29 Nov 17:43:55 - [info] Creating new flow file
29 Nov 17:43:55 - [info] Server now running at http://127.0.0.1:1880/
29 Nov 17:43:55 - [info] Starting flows
29 Nov 17:43:55 - [info] Started flows
pi@server:~ $ node-red-stop

Stop Node-RED

Use   node-red-start   to start Node-RED again

pi@server:~ $ sudo systemctl enable nodered.service
Created symlink from /etc/systemd/system/multi-user.target.wants/nodered.service to /lib/systemd/system/nodered.service.
pi@server:~ $ sudo systemctl start nodered
pi@server:~ $ ps -ef | grep node
pi        2884     1 62 17:44 ?        00:00:06 node-red                                                                  

Comments

  1. Get controlling those Sonoff smart switches! :-)

    ReplyDelete
  2. Grrr!! I need to
    - adapt a FTDI chip to do USB-Serial - hard, boring! I do have a cable somewhere...
    - install an MQTT Broker (currently installing mosquitto)

    ReplyDelete

Post a Comment

Popular posts from this blog

Replacing Coffee Machine Pump (Dualit Espressivo)

Multiple SHT30 sensors on a single I2C bus with Sonoff-Tasmota

NodeMCU + Tasmota code + SHT30