node-red-contrib-iotflows 2.0.0
Node-RED nodes for IoTFlows: publish machine execution state, production counts and metrics, and read MTConnect agents.
node-red-contrib-iotflows
Node-RED nodes for IoTFlows: publish each machine's execution state, production counts and metrics, and read them from MTConnect agents.
cd ~/.node-red
npm install node-red-contrib-iotflows
Or search for node-red-contrib-iotflows in Manage palette. Requires Node.js 20+ and Node-RED 3+.
Nodes
| Node | Does |
|---|---|
| execution | Publishes an asset's state: RUNNING, STOPPED or UNKNOWN. true / false also work, for a running signal from a PLC or sensor. |
| count | Adds to an asset's production count, optionally with a part and operation name. |
| metric | Publishes metrics, e.g. { "temperature": 72.5, "rpm": 1200 }. |
| mtconnect in | Watches an MTConnect agent. Output 1: each machine's execution state. Output 2: parts made. |
The IoTFlows nodes share one IoTFlows device connection, set up with the device's username and password from the IoTFlows console. It stays connected and reconnects on its own. After a reconnect, it re-sends each asset's last execution state, because IoTFlows resets the assets to STOPPED when a device connects. If IoTFlows can't be reached at startup, it retries every 10 seconds, and messages wait until it connects.
Each IoTFlows node publishes to the asset set on the node, or else msg.asset, or else msg.topic. Assets are found by name, custom identifier or asset_uuid, ignoring case and extra spaces. Once the device is deployed, the Asset field suggests its assets.
Every node's help (in the editor's sidebar) lists the message properties it uses.
MTConnect to IoTFlows
- Add an mtconnect in node with your agent's URL, e.g.
http://192.168.1.50:5000. - Wire output 1 to an execution node and output 2 to a count node, both with Asset empty.
- In IoTFlows, give each asset the MTConnect device name as its custom identifier (e.g.
OKUMA). The nodes then find the right asset frommsg.topic. To find the device names, open<agent>/probein a browser and look for<Device name="...">.
Or import Examples > node-red-contrib-iotflows > MTConnect to IoTFlows.
Parts are published with the program name (plus program comment, if any) as the part name. The rules for states and parts are described in the mtconnect in help and in @iotflows/mtconnect.
Upgrading from 1.x
Version 2 is a rewrite for the current IoTFlows platform, built on @iotflows/device and @iotflows/mtconnect. The 1.x nodes (datastream in, datastream out, alert channel out, action start, action finish) and device clients are no longer supported. Flows that use them will show those nodes as unknown; replace them with the nodes above.
Development
npm install
npm test # runs the nodes in Node-RED, with a fake IoTFlows connection and a fake MTConnect agent
To try your changes in Node-RED: cd ~/.node-red && npm install /path/to/iotflows-nodered-nodes, then restart Node-RED.
License
Apache-2.0