Node-RED

Start Node-RED on OS X login

Start Node-RED on OS X login
Node-RED flow for controlling a Blink(1) USB indicator light

Node-RED is a truly awesome framework for visually building data flows. There is a lot of focus on wiring together hardware devices and Internet of Things, but there are also plenty of modules for connecting to email, social media, various online services etc.

After using it during some months I can confirm that stability is absolutely fine, don’t think I have had a single issue with the setup due to Node-RED itself.

Version 0.10.1 came out a week or so ago (early Feb 2015) and brought things like better partitioning of flows in the form of subflows, improved Raspberry Pi support, binary MQTT payloads to name just a few of the improvements.

I am running Node-RED on an always-on Mac, running latest OS X. This machine is very stable but for various reasons I do need to restart it every now and then. It would then be very nice to have Node-RED start automatically at boot. That’s somewhat complex to do, but having an app starting at login is trivial – let’s do that instead. I am always logged into this computer anyway, so it won’t be a problem.

In my case I am using forever to ensure that Node-RED always is running and that it is restarted if it for some reason fails. It adds a nice safety net around Node-RED. In other words – it is forever that should be started at boot, forever will then start Node-RED for us.

Thus, as a first step ensure that forever is installed. Instructions are found at the link above.

Then start Automator and create a new application. Add a new “Run Shell Script” action to the Automator app, and enter the commands to the right. Customise as needed for the paths on your own system:

OSX Automator used to create a shell script, packaged as an executable application
  1. The “usr/local/bin” should point to the path where the forever command lives. Run “which forever” from a OS X command line (using iTerm2, maybe? Outstanding terminal program!) to find the path on your system
  2. Change “/Users/goran/code/node-red” to match the path of your node-red installation
Launch forever node.js app from Automator app

Save the Automator app in a suitable location, for example in an “Automator apps” directory under your home directory.

Configure what apps are started at login

Finally, create a new login item for your user. This is done from the “Users & Groups” section of the OS X “Systems Preferences” app. Click the plus sign to add a new entry, point it to the newly created Automator app, and make sure the new entry is enabled.

Done – forever will now start Node-RED automatically when I log into the computer.

Göran Sander Stockholm, Sweden

Qlik Sense consultant and toolmaker at Ptarmigan Labs. Ten years at Spotify, Qlik Luminary and Partner Ambassador, author of the open source Butler tools.

All posts by Göran Sander
Keep reading

More about

Butler

Butler-MQTT and a realtime reload dashboard for Sense

Teaser video: Realtime reload dashboard Just to get your interest – this video shows what Butler-MQTT can be used for. All the pieces are included in the Github repo. The concept of a reload dashboard can be very useful if you have long running (hours!) reloads. Instead of relying on

4 min read
Node-RED

Listing all Telldus Live devices in Node-RED

Continuing from the previous post about publishing data from Telldus Live to MQTT, here is small piece of related Node-RED code. It outputs a list of all (wirelessly controlled) 220V/mains switches I have linked to Telldus Live, using a Tellstick Net. The background of the code was simply

1 min read
Home automation

Using Node-RED for publishing Telldus Live data to MQTT

Telldus has a set of nice little gadgets (“Tellstick”, for short) that both allow you to control remote switches over radio (433.92 MHz), and to read sensors transmitting on that same frequency. Telldus also has a backend service, Telldus Live, which offer Tellstick users scheduling features (turning lamps on/

2 min read