(public documentation)

The Thingbox contains a dialog to allow Node-RED nodes to be easily installed by non programmers.

This page is dedicated to programmers and describes how to build the NPM package to achieve that.

The Read.me file

The file should tell if the package is compatible with stock Node-RED or not.

The package.json file

Here is the npm documentation.

  • Add all dependencies, even if they are already globally available in NodeRED.
  • No capital letters for name field.
  • Do NOT use “node-red” keyword if the package is not compatible with stock Node-RED.
  • despite the example below, the version should start at 1.0.0 if the package can be used.

Below is an example:

{
  "name": "ttb-ibeacon",
  "version": "1.0.3",
  "description": "This node allow the user to use iBeacon compatible device",
  "node-red": {
    "nodes": {
      "ibeacon": "12-iBeacon.js"
    }
  },
  "installation-duration":180,
  "dependencies": {
    "gyp": "^0.5.0",
    "bleacon": "",
    "node-pre-gyp": "^0.6.13"
  },
  "scripts":{
    "preinstall":"sudo apt-get install --fix-missing -y bluetooth bluez libbluetooth-dev libudev-dev"
  },
  "keywords": [
    "ttb",
    "thethingbox",
    "timesquair",
    "ibeacon",
    "bleacon",
    "estimote"
  ],
  "author": "http://www.digitalairways.com/",
  "license": "http://www.wtfpl.net"
}

“installation-duration”

Important value in seconds that helps the user to wait for the install. This point is important because it may be long (5 minutes for this example).

“scripts”

Put here all low level installations. Keep in mind that the typical Thingbox user usually knows nothing about SSH and even Linux. Thus the only thing that should be done is a “npm install” of the libray name.

Demo flow

There often is one or more demo flow provided with nodes. To date there are copy-pasted into the page. The result is an ugly non-understandable block of flow difficult to use because it should be copy pasted in a Node-RED dialog box.

If you want to provide demo flow (you should!), create flow libs (with the menu Export / lib) and put them into a lib/flows folder at the first level of the npm package. These libs will be available in the import / lib menu after the install.

How to write Node-RED nodes for the Thingbox?

Look here: How to write a Node-RED node for the Thingbox

Back to top