@iotflows/mtconnect 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +19 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -47,6 +47,25 @@ agent.start();
47
47
 
48
48
  It reads `/current` once, then every change through `/sample`, so brief states between polls (like a 0.25 s `PROGRAM_COMPLETED`) aren't missed. Only the five data items it uses are requested.
49
49
 
50
+ ## Send to IoTFlows
51
+
52
+ With [`@iotflows/device`](https://www.npmjs.com/package/@iotflows/device):
53
+
54
+ ```js
55
+ const { IoTFlowsDevice } = require('@iotflows/device');
56
+ const { MTConnectAgent } = require('@iotflows/mtconnect');
57
+
58
+ const iotflows = new IoTFlowsDevice({ username: 'dev_xxxxxxxx', password: 'xxxxxxxx' });
59
+ await iotflows.connect();
60
+
61
+ const agent = new MTConnectAgent('http://192.168.1.50:5000');
62
+ agent.on('execution', (e) => iotflows.asset(e.device).execution(e.state));
63
+ agent.on('parts', (e) => iotflows.asset(e.device).count(e.count, e.program ? { part_name: e.program } : {}));
64
+ agent.start();
65
+ ```
66
+
67
+ This assumes each IoTFlows asset has the same name as its MTConnect device. For a ready-to-run version with a config file, name mapping and logging, see [iotflows-mtconnect-gateway](https://github.com/iotflows/iotflows-mtconnect-gateway).
68
+
50
69
  ## Options
51
70
 
52
71
  ```js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iotflows/mtconnect",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Simple MTConnect client: watch an agent for machine execution state and parts made.",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",