@vitormnm/node-red-simple-opcua 1.4.1 → 1.4.3

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 (32) hide show
  1. package/README.md +5 -0
  2. package/client/icons/opcua.svg +132 -132
  3. package/client/lib/opcua-client-browser.js +330 -330
  4. package/client/lib/opcua-client-method-service.js +88 -88
  5. package/client/lib/opcua-client-read-service.js +15 -15
  6. package/client/lib/opcua-client-subscription-id-service.js +24 -24
  7. package/client/lib/opcua-client-subscription-service.js +170 -170
  8. package/client/lib/opcua-client-write-service.js +146 -146
  9. package/client/opcua-client-config.html +80 -80
  10. package/client/opcua-client.html +140 -140
  11. package/client/opcua-client.js +1 -7
  12. package/client/view/opcua-client.js +1140 -1140
  13. package/icons/opcua.svg +132 -132
  14. package/icons/opcua2.svg +132 -132
  15. package/package.json +42 -42
  16. package/resources/bmc-button.svg +22 -0
  17. package/server/icons/opcua.svg +132 -132
  18. package/server/lib/opcua-address-space-alarm.js +341 -341
  19. package/server/lib/opcua-address-space-builder.js +1484 -1484
  20. package/server/lib/opcua-config.js +546 -546
  21. package/server/lib/opcua-constants.js +109 -109
  22. package/server/lib/opcua-server-events-child.js +139 -139
  23. package/server/lib/opcua-server-runtime-child.js +819 -819
  24. package/server/lib/opcua-server-runtime.js +311 -311
  25. package/server/lib/opcua-server-status-child.js +187 -187
  26. package/server/lib/server-node-utils.js +16 -16
  27. package/server/opcua-server-io.html +346 -346
  28. package/server/opcua-server-io.js +496 -496
  29. package/server/opcua-server-registry.js +270 -270
  30. package/server/opcua-server.css +265 -265
  31. package/server/opcua-server.html +1643 -1643
  32. package/client/testClient.json +0 -18
@@ -1,141 +1,141 @@
1
- <link rel="stylesheet" type="text/css" href="opcua-client-resource/style.css">
2
-
3
- <script type="text/javascript" src="opcua-client-resource/script.js"></script>
4
-
5
- <script type="text/html" data-template-name="opcua-client">
6
- <div class="form-row">
7
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
8
- <input type="text" id="node-input-name" placeholder="opcua-client">
9
- </div>
10
- <div class="form-row">
11
- <label for="node-input-connection"><i class="fa fa-server"></i> Connection</label>
12
- <input type="text" id="node-input-connection">
13
- </div>
14
- <div class="form-row">
15
- <label for="node-input-mode"><i class="fa fa-exchange"></i> Mode</label>
16
- <select id="node-input-mode">
17
- <option value="read">Read</option>
18
- <option value="write">Write</option>
19
- <option value="browse">Browse</option>
20
- <option value="method">Method</option>
21
- <option value="getSubscriptionId">getSubscriptionId</option>
22
- <option value="subscription">Subscription</option>
23
- <option value="events">Events</option>
24
- </select>
25
- </div>
26
-
27
- <div class="form-row opcua-client-selection-row">
28
- <label for="node-input-selectedItems"><i class="fa fa-code"></i> JSON</label>
29
- <input type="text" id="node-input-selectedItems" class="opcua-client-json" style="width: 70%;">
30
- </div>
31
- <div id="node-input-browse-modal" class="opcua-tree-modal" style="display:none;">
32
- <div class="opcua-tree-modal__dialog">
33
- <div class="opcua-tree-modal__header">
34
- <div class="opcua-tree-modal__title"><i class="fa fa-sitemap"></i> OPC UA Browse Tree</div>
35
- <a href="#" id="node-input-close-browse-modal" class="editor-button editor-button-small"><i class="fa fa-times"></i> Close</a>
36
- </div>
37
- <div class="opcua-tree-modal__toolbar">
38
- <a href="#" id="node-input-browse-root" class="editor-button editor-button-small"><i class="fa fa-search"></i> Browse Root</a>
39
- <div class="opcua-tree-search">
40
- <i class="fa fa-search"></i>
41
- <input type="text" id="node-input-browse-search" placeholder="Search for items already explored">
42
- <a href="#" id="node-input-browse-search-clear" class="editor-button editor-button-small" style="display:none;"><i class="fa fa-times"></i></a>
43
- </div>
44
- </div>
45
- <div class="opcua-tree-modal__body">
46
- <div id="node-input-browse-tree" class="opcua-tree-editor"></div>
47
- </div>
48
- </div>
49
- <div id="node-input-browse-context-menu" class="opcua-tree-context-menu" style="display:none;">
50
- <a href="#" id="node-input-browse-context-refresh"><i class="fa fa-refresh"></i> Refresh node</a>
51
- <a href="#" id="node-input-browse-context-copy-nodeid"><i class="fa fa-copy"></i> Copy NodeID</a>
52
- </div>
53
- </div>
54
-
55
- <div class="form-row opcua-client-selection-row">
56
- <label style="width:auto;"><i class="fa fa-sitemap"></i> Browse Tree</label>
57
- <a href="#" id="node-input-open-browse-modal" class="editor-button">
58
- <i class="fa fa-expand"></i> Open browse tree
59
- </a>
60
- </div>
61
-
62
- <div class="form-row opcua-client-subscription-row">
63
- <label for="node-input-samplingInterval"><i class="fa fa-clock-o"></i> Sampling</label>
64
- <input type="text" id="node-input-samplingInterval" placeholder="250">
65
- </div>
66
- <div class="form-row opcua-client-subscription-row">
67
- <label for="node-input-publishingInterval"><i class="fa fa-clock-o"></i> Publishing</label>
68
- <input type="text" id="node-input-publishingInterval" placeholder="250">
69
- </div>
70
-
71
- <div class="form-row opcua-client-selection-row" style="margin-bottom:0;">
72
- <label style="width:auto;"><i class="fa fa-tags"></i> Selected items</label>
73
- </div>
74
- <div class="form-row opcua-client-selection-row">
75
- <label style="width:auto;"></label>
76
- <div id="node-input-selected-tags" class="opcua-client-tag-box"></div>
77
- </div>
78
-
79
- </script>
80
-
81
- <script type="text/html" data-help-name="opcua-client">
82
- <p>Unified OPC UA client node for read, write, browse and subscription using a shared client configuration node.</p>
83
-
84
- <h3>Modes</h3>
85
- <p><b>Read</b>: reads one or more variable values.</p>
86
- <p><b>Write</b>: writes one or more variable values.</p>
87
- <p><b>Browse</b>: browses one or more OPC UA nodes and returns their children.</p>
88
- <p><b>Method</b>: calls one or more OPC UA methods.</p>
89
- <p><b>Subscription</b>: subscribes to one or more variable values and emits one message per change.</p>
90
-
91
- <h3>Read</h3>
92
- <p><b>Input</b> <code>msg.payload</code>:</p>
93
- <pre><code>[
94
- {
95
- "name": "status",
96
- "nodeID": "ns=2;s=Factory.Line1.Motor1.status"
97
- }
98
- ]</code></pre>
99
- <p>If <code>msg.payload</code> is not an array and <code>NodeId</code> is configured, the node reads that configured node.</p>
100
-
101
- <h3>Write</h3>
102
- <p><b>Input</b> <code>msg.payload</code>:</p>
103
- <pre><code>[
104
- {
105
- "name": "speed",
106
- "nodeID": "ns=2;s=Factory.Line1.Motor1.speed",
107
- "value": 25.5,
108
- "type": "Float"
109
- }
110
- ]</code></pre>
111
-
112
- <h3>Browse</h3>
113
- <p>If <code>msg.payload</code> is not an array and <code>NodeId</code> is configured, the node browses that configured node.</p>
114
- <p>If <code>msg.payload = []</code>, the node browses the OPC UA <code>RootFolder</code>.</p>
115
-
116
- <h3>Method</h3>
117
- <p><code>nodeID</code> and <code>objectId</code> are accepted explicitly. For backward compatibility, <code>nodeID</code> is also accepted as the method id.</p>
118
- <p><b>Input</b> <code>msg.payload</code>:</p>
119
- <pre><code>[
120
- {
121
- "name": "method1",
122
- "nodeID": "ns=2;s=motor.method1",
123
- "inputs": [
124
- {
125
- "name": "input1",
126
- "type": "Int32",
127
- "value": 1
128
- },
129
- {
130
- "name": "input2",
131
- "type": "Int32",
132
- "value": 1
133
- }
134
- ]
135
- },
136
-
137
-
138
- ]</code></pre>
139
- <h3>Subscription</h3>
140
- <p>In subscription mode the node emits one message per value change.</p>
1
+ <link rel="stylesheet" type="text/css" href="opcua-client-resource/style.css">
2
+
3
+ <script type="text/javascript" src="opcua-client-resource/script.js"></script>
4
+
5
+ <script type="text/html" data-template-name="opcua-client">
6
+ <div class="form-row">
7
+ <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
8
+ <input type="text" id="node-input-name" placeholder="opcua-client">
9
+ </div>
10
+ <div class="form-row">
11
+ <label for="node-input-connection"><i class="fa fa-server"></i> Connection</label>
12
+ <input type="text" id="node-input-connection">
13
+ </div>
14
+ <div class="form-row">
15
+ <label for="node-input-mode"><i class="fa fa-exchange"></i> Mode</label>
16
+ <select id="node-input-mode">
17
+ <option value="read">Read</option>
18
+ <option value="write">Write</option>
19
+ <option value="browse">Browse</option>
20
+ <option value="method">Method</option>
21
+ <option value="getSubscriptionId">getSubscriptionId</option>
22
+ <option value="subscription">Subscription</option>
23
+ <option value="events">Events</option>
24
+ </select>
25
+ </div>
26
+
27
+ <div class="form-row opcua-client-selection-row">
28
+ <label for="node-input-selectedItems"><i class="fa fa-code"></i> JSON</label>
29
+ <input type="text" id="node-input-selectedItems" class="opcua-client-json" style="width: 70%;">
30
+ </div>
31
+ <div id="node-input-browse-modal" class="opcua-tree-modal" style="display:none;">
32
+ <div class="opcua-tree-modal__dialog">
33
+ <div class="opcua-tree-modal__header">
34
+ <div class="opcua-tree-modal__title"><i class="fa fa-sitemap"></i> OPC UA Browse Tree</div>
35
+ <a href="#" id="node-input-close-browse-modal" class="editor-button editor-button-small"><i class="fa fa-times"></i> Close</a>
36
+ </div>
37
+ <div class="opcua-tree-modal__toolbar">
38
+ <a href="#" id="node-input-browse-root" class="editor-button editor-button-small"><i class="fa fa-search"></i> Browse Root</a>
39
+ <div class="opcua-tree-search">
40
+ <i class="fa fa-search"></i>
41
+ <input type="text" id="node-input-browse-search" placeholder="Search for items already explored">
42
+ <a href="#" id="node-input-browse-search-clear" class="editor-button editor-button-small" style="display:none;"><i class="fa fa-times"></i></a>
43
+ </div>
44
+ </div>
45
+ <div class="opcua-tree-modal__body">
46
+ <div id="node-input-browse-tree" class="opcua-tree-editor"></div>
47
+ </div>
48
+ </div>
49
+ <div id="node-input-browse-context-menu" class="opcua-tree-context-menu" style="display:none;">
50
+ <a href="#" id="node-input-browse-context-refresh"><i class="fa fa-refresh"></i> Refresh node</a>
51
+ <a href="#" id="node-input-browse-context-copy-nodeid"><i class="fa fa-copy"></i> Copy NodeID</a>
52
+ </div>
53
+ </div>
54
+
55
+ <div class="form-row opcua-client-selection-row">
56
+ <label style="width:auto;"><i class="fa fa-sitemap"></i> Browse Tree</label>
57
+ <a href="#" id="node-input-open-browse-modal" class="editor-button">
58
+ <i class="fa fa-expand"></i> Open browse tree
59
+ </a>
60
+ </div>
61
+
62
+ <div class="form-row opcua-client-subscription-row">
63
+ <label for="node-input-samplingInterval"><i class="fa fa-clock-o"></i> Sampling</label>
64
+ <input type="text" id="node-input-samplingInterval" placeholder="250">
65
+ </div>
66
+ <div class="form-row opcua-client-subscription-row">
67
+ <label for="node-input-publishingInterval"><i class="fa fa-clock-o"></i> Publishing</label>
68
+ <input type="text" id="node-input-publishingInterval" placeholder="250">
69
+ </div>
70
+
71
+ <div class="form-row opcua-client-selection-row" style="margin-bottom:0;">
72
+ <label style="width:auto;"><i class="fa fa-tags"></i> Selected items</label>
73
+ </div>
74
+ <div class="form-row opcua-client-selection-row">
75
+ <label style="width:auto;"></label>
76
+ <div id="node-input-selected-tags" class="opcua-client-tag-box"></div>
77
+ </div>
78
+
79
+ </script>
80
+
81
+ <script type="text/html" data-help-name="opcua-client">
82
+ <p>Unified OPC UA client node for read, write, browse and subscription using a shared client configuration node.</p>
83
+
84
+ <h3>Modes</h3>
85
+ <p><b>Read</b>: reads one or more variable values.</p>
86
+ <p><b>Write</b>: writes one or more variable values.</p>
87
+ <p><b>Browse</b>: browses one or more OPC UA nodes and returns their children.</p>
88
+ <p><b>Method</b>: calls one or more OPC UA methods.</p>
89
+ <p><b>Subscription</b>: subscribes to one or more variable values and emits one message per change.</p>
90
+
91
+ <h3>Read</h3>
92
+ <p><b>Input</b> <code>msg.payload</code>:</p>
93
+ <pre><code>[
94
+ {
95
+ "name": "status",
96
+ "nodeID": "ns=2;s=Factory.Line1.Motor1.status"
97
+ }
98
+ ]</code></pre>
99
+ <p>If <code>msg.payload</code> is not an array and <code>NodeId</code> is configured, the node reads that configured node.</p>
100
+
101
+ <h3>Write</h3>
102
+ <p><b>Input</b> <code>msg.payload</code>:</p>
103
+ <pre><code>[
104
+ {
105
+ "name": "speed",
106
+ "nodeID": "ns=2;s=Factory.Line1.Motor1.speed",
107
+ "value": 25.5,
108
+ "type": "Float"
109
+ }
110
+ ]</code></pre>
111
+
112
+ <h3>Browse</h3>
113
+ <p>If <code>msg.payload</code> is not an array and <code>NodeId</code> is configured, the node browses that configured node.</p>
114
+ <p>If <code>msg.payload = []</code>, the node browses the OPC UA <code>RootFolder</code>.</p>
115
+
116
+ <h3>Method</h3>
117
+ <p><code>nodeID</code> and <code>objectId</code> are accepted explicitly. For backward compatibility, <code>nodeID</code> is also accepted as the method id.</p>
118
+ <p><b>Input</b> <code>msg.payload</code>:</p>
119
+ <pre><code>[
120
+ {
121
+ "name": "method1",
122
+ "nodeID": "ns=2;s=motor.method1",
123
+ "inputs": [
124
+ {
125
+ "name": "input1",
126
+ "type": "Int32",
127
+ "value": 1
128
+ },
129
+ {
130
+ "name": "input2",
131
+ "type": "Int32",
132
+ "value": 1
133
+ }
134
+ ]
135
+ },
136
+
137
+
138
+ ]</code></pre>
139
+ <h3>Subscription</h3>
140
+ <p>In subscription mode the node emits one message per value change.</p>
141
141
  </script>
@@ -26,19 +26,13 @@ const { OpcUaClientSubscriptionIdService } = require("./lib/opcua-client-subscri
26
26
  const path = require("path");
27
27
 
28
28
 
29
- const fs = require("fs");
30
- const arquivo = path.join(__dirname, "testClient.json");
31
29
 
32
30
  module.exports = function (RED) {
33
31
  function OpcUaClientNode(config) {
34
32
  RED.nodes.createNode(this, config);
35
33
  const node = this;
36
34
 
37
- fs.writeFileSync(
38
- arquivo,
39
- JSON.stringify(config, null, 2),
40
- "utf8"
41
- );
35
+
42
36
 
43
37
  node.name = (config.name || "").trim();
44
38
  node.connection = RED.nodes.getNode(config.connection);