Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click. iaconnects have created a selection of nodes to communicate and interact with Mobius objects. In addition to these MobiusFlow specific Node-RED nodes, the Node-RED community have published 100's of useful nodes that you can use in your projects. For more details on the full list of Node-RED nodes and examples, please have a look here.
Using Node-RED with MobiusFlow
In order for MobiusFlow to communicate with Node-RED, a connection needs to be setup between them. This connection requires some configuration both in Mobius and Node-RED. To make this easier, iaconnects have created a Node-RED Mobius connector service and a Mobius configuration Node-RED node.
Setting up the Mobius Node-RED connector service
- Add the Node-RED connector service to your Mobius configuration (see Configuring Services)
- Configure the Node-RED connector service (see Node-RED Connector Service Settings). When using the built-in Node-RED instance use the following settings:
- Host: localhost
- Port: 1890
- PSK: a secret phrase such as my-super-secret-secret
- Start the Node-RED connector service running (see Node Diagnostics and Service Control)
- The service status will show as In Fault, with the message "Waiting for Node-RED to connect"
Setting up Node-RED
- Open the Node-RED flows page
- Scroll down the Node-RED palette and find a Mobius Object COV node and drag it onto the flow
- Double click on the new Node-RED node to open the node's config page
- Click on the Pencil icon to add a new Mobius connection
- Enter the same details that you entered into the Node-RED connector service and click Done
- Enter a Mobius URI to subscribe to for change of value notifications (to subscribe to all objects just enter a # wildcard) and click Done
- Click on the Deploybutton to deploy the flow
- The Node-RED node should have a green status indicator and the Node-RED connector service status should turn green and update its status text to connected