iot.schema.org interactions implemented as Node-RED Nodes.
The Node-RED nodes can be installed in one of several ways:
- Installing via Docker (recommended)
- Building the Docker image manually and installing
- Installing via npm to a preexisting Node-RED instance
- Manual install (advanced)
The latest iot.schema.org Node-RED nodes as well as the associated Ubuntu Docker instance can be issued from the Docker hub with the following command:
docker pull iotschema/iotschema-node-red
You can also elect to manually build the Docker image and install from there rather than using the Docker hub. To do this, follow the steps below:
- Check out the current Github repo
- Navigate to /src/Docker
- Issue the
docker build
command with your desired arguments
docker build --tag iotschema-node-red:1.0 .
- Run the image with your desired arguments
docker run --publish 1880:1880 --publish 8080:8080 --detach --name iotschema-node-red iotschema-node-red:1.0
If you already have a running Node-RED instance (or if you do not wish to use Docker), The nodes can also be separately installed from npm.
- To install all available iot.schema.org nodes, use
npm install @iotschema/iotschema-capability
- The install the utility nodes for TD generation, TD configuration/persistence and match making, use
npm install @iotschema/iotschema-utilitynodes
- Individual nodes can also be installed rather than installing the umbrella packages, for example:
npm install @iotschema/binaryswitch
- Install Node-RED:
sudo npm install -g --unsafe-perm node-red
- Install iot.schema.org Node-RED Nodes:
cd $NODE_RED_HOME
- Install adaptor Node-RED Nodes:
npm install iotschema-node-red/nodes/adaptors/*
- Install Node-RED Nodes to run the Temperature Control example (Running Example 1):
npm install iotschema-node-red/nodes/examples/*
npm install node-red-contrib-coap
- Install Node-RED Node to generate a W3C Web of Things (WoT) Thing Description:
npm install iotschema-node-red/nodes/TDGenerator
- Install Node-RED Node for W3C Web of Things (WoT) Thing Directory to store Thing Description:
npm install iotschema-node-red/nodes/TDConfigureNode
See Running Example 2 to learn more about how to use "TDGenerator" and "TDconfigureNode" Nodes to generate and store a Thing Description.
This flow (Recipe) controls ambient air temperature, by using iot.schema.org TemperatureSensing and Thermostat Capabilities.
- Start Node-RED:
node-red
- Copy the content of TemperatureControl.json from:
cd iotschema-node-red/lib/examples/
to your clipboard
- Open Node-RED in Browser and import the flow:
Open <http://localhost:1880>
Menu > Import > Clipboard
- Deploy the flow, and see the result in system console.
For details about the running example, see the documentation.
This flow (Thing Description Generation) generates a W3C WoT Thing Description for the Temperature device by using iot.schema.org TemperatureSensing Capability and TDGenerator node. Then it stores the generated TD in Thing Directory using Thing Directory config node in Node-RED.
- Start Node-RED:
node-red
- Copy the content of TemperatureTDGeneration.json from:
cd iotschema-node-red/lib/examples/
to your clipboard
- Open Node-RED in Browser and import the flow:
Open <http://localhost:1880>
Menu > Import > Clipboard
-
Deploy the flow. "TDGenerator" node generates semantically enriched Thing Description for Temperature device using iotschema TemperatureSensing capability.
-
Open the Thing Directory configuration node (as shown in the Figure:https://github.com/iot-schema-collab/iotschema-node-red/blob/master/images/TemperatureTDGeneration.PNG)
-
Start Thing Directory (by clicking "Start" button), store Thing Description by selecting (Store TD/ Recipe option)
-
Click on "Store/Retrieve" button to store the Thing Description in Thing Directory.