@t0a5tbr0t/node-red-contrib-opcua 0.1.0
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.
- package/CHANGELOG.md +6 -0
- package/LICENSE +20 -0
- package/Readme.md +239 -0
- package/images/PROSYS-OPC-UA-EXAMPLE2.png +0 -0
- package/images/nodeopcua64.png +0 -0
- package/images/opcuanode.png +0 -0
- package/images/opcuanodeLogo64.png +0 -0
- package/opcua/101-opcuaitem.html +106 -0
- package/opcua/101-opcuaitem.js +82 -0
- package/opcua/102-opcuaclient.html +274 -0
- package/opcua/102-opcuaclient.js +2741 -0
- package/opcua/103-opcuabrowser.html +71 -0
- package/opcua/103-opcuabrowser.js +230 -0
- package/opcua/104-opcuaserver.html +261 -0
- package/opcua/104-opcuaserver.js +1844 -0
- package/opcua/105-opcuaendpoint.html +224 -0
- package/opcua/105-opcuaendpoint.js +64 -0
- package/opcua/106-opcuaevent.html +110 -0
- package/opcua/106-opcuaevent.js +50 -0
- package/opcua/107-opcuamethod.html +244 -0
- package/opcua/107-opcuamethod.js +521 -0
- package/opcua/108-opcuarights.html +223 -0
- package/opcua/108-opcuarights.js +156 -0
- package/opcua/109-opcuadiscovery.html +51 -0
- package/opcua/109-opcuadiscovery.js +180 -0
- package/opcua/dump_certificates.js +55 -0
- package/opcua/icons/opcuanode.png +0 -0
- package/opcua/icons/opcuanodeLogo.png +0 -0
- package/opcua/opcua-basics.js +1061 -0
- package/opcua/public/vendor/opc-foundation/binary/OPC.ISA95.Types.bsd.xml +141 -0
- package/opcua/public/vendor/opc-foundation/binary/Opc.Ua.Adi.Types.bsd.xml +76 -0
- package/opcua/public/vendor/opc-foundation/binary/Opc.Ua.Di.Types.bsd.xml +11 -0
- package/opcua/public/vendor/opc-foundation/binary/Opc.Ua.Gds.Types.bsd.xml +25 -0
- package/opcua/public/vendor/opc-foundation/binary/Opc.Ua.Types.bsd.xml +2391 -0
- package/opcua/public/vendor/opc-foundation/csv/AttributeIds.csv +22 -0
- package/opcua/public/vendor/opc-foundation/csv/NodeIds.csv +5746 -0
- package/opcua/public/vendor/opc-foundation/csv/Opc.Ua.StatusCodes.csv +227 -0
- package/opcua/public/vendor/opc-foundation/csv/OpcUaDiModel.csv +1523 -0
- package/opcua/public/vendor/opc-foundation/csv/OpcUaGdsModel.csv +400 -0
- package/opcua/public/vendor/opc-foundation/csv/ServerCapabilities.csv +13 -0
- package/opcua/public/vendor/opc-foundation/csv/ServerCapabilityIdentifiers.csv +13 -0
- package/opcua/public/vendor/opc-foundation/csv/StatusCode.csv +227 -0
- package/opcua/public/vendor/opc-foundation/csv/StatusCodes.csv +227 -0
- package/opcua/public/vendor/opc-foundation/schema/OPC.ISA95.Types.xsd +163 -0
- package/opcua/public/vendor/opc-foundation/schema/OPCBinarySchema.xsd +119 -0
- package/opcua/public/vendor/opc-foundation/schema/Opc.Ua.Types.xsd +3938 -0
- package/opcua/public/vendor/opc-foundation/schema/SecuredApplication.xsd +106 -0
- package/opcua/public/vendor/opc-foundation/schema/UANodeSet.xsd +420 -0
- package/opcua/public/vendor/opc-foundation/xml/OPC.ISA95.NodeSet2.Nov52013.xml +3293 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.ISA95.NodeSet2.xml +3589 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.Adi.NodeSet2.xml +8301 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.Adi.Types.bsd.xml +76 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.Adi.Types.xsd +157 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.AutoID.NodeSet2.xml +6062 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.Di.NodeSet2.xml +5066 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.Di.PredefinedNodes.xml +11495 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.Di.Types.bsd +86 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.Di.Types.bsd.xml +11 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.Di.Types.xsd +155 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.Gds.NodeSet.xml +15226 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.Gds.NodeSet2.xml +6214 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.Gds.Types.bsd.xml +25 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.Gds.Types.xsd +30 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet-2.xml +134881 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet-3.xml +134881 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet.xml +134881 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet2.Part10.xml +832 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet2.Part11.xml +793 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet2.Part12.xml +3877 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet2.Part13.xml +344 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet2.Part3.xml +1103 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet2.Part4.xml +3091 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet2.Part5.xml +17092 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet2.Part8.xml +525 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet2.Part9.xml +2049 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet2.Part999.xml +134 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.NodeSet2.xml +67169 -0
- package/opcua/public/vendor/opc-foundation/xml/Opc.Ua.PredefinedNodes.xml +64500 -0
- package/opcua/public/vendor/opc-foundation/xml/OpcUaDiModel.xml +1239 -0
- package/opcua/utils.js +55 -0
- package/package.json +68 -0
- package/users.json +22 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
Copyright 2015 Valmet Automation Inc.
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
Developer List:
|
|
18
|
+
|
|
19
|
+
since 2015 - Mika Karaila - mika.karaila@valmet.com - Valmet Automation Inc.
|
|
20
|
+
since 2016 - Klaus Landsdorf - klaus.landsdorf@bianco-royal.de - Bianco Royal
|
package/Readme.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
[](http://www.npm-stats.com/~packages/node-red-contrib-opcua)
|
|
2
|
+
[](http://badge.fury.io/js/node-red-contrib-opcua)
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
node-red-contrib-opcua
|
|
7
|
+
========================
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
A [Node-RED][1] nodes to communicate or serve via [OPC UA](https://www.npmjs.com/package/node-opcua).
|
|
12
|
+
|
|
13
|
+
based on [node-opcua](http://node-opcua.github.io/)
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
Install
|
|
18
|
+
-------
|
|
19
|
+
|
|
20
|
+
Run command on Node-RED installation directory.
|
|
21
|
+
|
|
22
|
+
npm install node-red-contrib-opcua
|
|
23
|
+
|
|
24
|
+
or run command for global installation.
|
|
25
|
+
|
|
26
|
+
npm install -g node-red-contrib-opcua
|
|
27
|
+
|
|
28
|
+
Usage
|
|
29
|
+
-----
|
|
30
|
+
|
|
31
|
+
Use OpcUa-Item to define variables.
|
|
32
|
+
Use OpcUa-Client to read / write / subscribe / browse OPC UA server.
|
|
33
|
+
|
|
34
|
+
See some flows under folder ![examples].
|
|
35
|
+
Updated server sub-flow example OPCUA-TEST-NODES.json look commands: addFolder, addVariable, addMethod, setFolder.
|
|
36
|
+
Added new opcua-rights node to set folder/variable access level and role & permissions.
|
|
37
|
+
|
|
38
|
+
Here you got some ready to use examples.
|
|
39
|
+
You can use the Import in Node-RED in the right upper corner menu.
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
Examples are available for Schneider IGSS and Prosys Simulation Server as Node-RED flow.
|
|
44
|
+
Search for OPC UA on: http://flows.nodered.org/
|
|
45
|
+
|
|
46
|
+

|
|
47
|
+
|
|
48
|
+

|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
Message parameters
|
|
53
|
+
------------------
|
|
54
|
+
|
|
55
|
+
Input message
|
|
56
|
+
----
|
|
57
|
+
|
|
58
|
+
| __**Property**__ | __**Function/Value**__ | __**Notes**__ |
|
|
59
|
+
|--------------------|---------------------------|---------------------------|
|
|
60
|
+
| payload | set interval for subscription or monitorItem
|
|
61
|
+
| interval | Subscription interval |
|
|
62
|
+
| queueSize | Subscription queue size |
|
|
63
|
+
| deadbandType | "a" abs. or "p" percent | Action monitor
|
|
64
|
+
| deadbandValue | integer for deadband | Action monitor
|
|
65
|
+
| topic | NodeId and DataType in format ns=3;s=Counter;datatype=Int32
|
|
66
|
+
| action | subscribe | nodeId / variable
|
|
67
|
+
| | unsubscribe | nodeId / variable
|
|
68
|
+
| | deletesubscription | subscription
|
|
69
|
+
| | browse | nodeId / folder
|
|
70
|
+
| | info | nodeId
|
|
71
|
+
| | read | nodeId
|
|
72
|
+
| | write | nodeId & value
|
|
73
|
+
| | monitor | deadbandtype abs/pro
|
|
74
|
+
| | events | nodeId
|
|
75
|
+
| | readmultiple | [nodeId + datatype]
|
|
76
|
+
| | writemultiple | [nodeId + datatype + value]
|
|
77
|
+
|
|
78
|
+
readmultiple to readmultiple items
|
|
79
|
+
writemultiple to write multiple items
|
|
80
|
+
clearitems to empty multiple items (readmultiple / writemultiple)
|
|
81
|
+
|
|
82
|
+
NOTE: With datatype=xxxArray msg.payload.range = "2:4" can used as indexRange to read/write partial array
|
|
83
|
+
|
|
84
|
+
Output message
|
|
85
|
+
----
|
|
86
|
+
|
|
87
|
+
| __**Property**__ | __**Function/Value**__ | __**Notes**__ |
|
|
88
|
+
|--------------------|---------------------------|---------------------------|
|
|
89
|
+
| payload | dataValue.value.value | |
|
|
90
|
+
| statusCode | OPC UA StatusCode | |
|
|
91
|
+
| sourceTimestamp | Source timestamp | |
|
|
92
|
+
| serverTimestamp | Server´s timestamp | |
|
|
93
|
+
|
|
94
|
+
Release history (only couple of older releases):
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
**v0.2.223**
|
|
98
|
+
<p>
|
|
99
|
+
Fixed: Namespace index used with variables (set value).<br/>
|
|
100
|
+
Enhancements: Initial value can be set to server variable, server returns nodeId as variable created. Added support for StringArray.
|
|
101
|
+
</p>
|
|
102
|
+
|
|
103
|
+
**v0.2.117**
|
|
104
|
+
<p>
|
|
105
|
+
Enhancement: Added users to server. Users.json contains username, password and role for each user.<br/>
|
|
106
|
+
</p>
|
|
107
|
+
|
|
108
|
+
**v0.2.116**
|
|
109
|
+
<p>
|
|
110
|
+
Enhancement: server allow anonymous, added verbose to show trusted/rejected folders.<br/>
|
|
111
|
+
</p>
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
**v0.2.115**
|
|
115
|
+
<p>
|
|
116
|
+
Enhancement: server node security settings; mode and policy<br/>
|
|
117
|
+
</p>
|
|
118
|
+
|
|
119
|
+
**v0.2.114**
|
|
120
|
+
<p>
|
|
121
|
+
Fix: added to client certificate manager<br/>
|
|
122
|
+
</p>
|
|
123
|
+
|
|
124
|
+
**v0.2.113**
|
|
125
|
+
<p>
|
|
126
|
+
Enhancement: server commands: registerNamespace and getNamespaceIndex, user can addVariables with registered namespaces like ns=5.<br/>
|
|
127
|
+
Enhancement: msg.topic = readmultiple AND msg.payload = ALL then msg.payload = values<br/>
|
|
128
|
+
</p>
|
|
129
|
+
|
|
130
|
+
**v0.2.112**
|
|
131
|
+
<p>
|
|
132
|
+
Added DateTime to server.<br/>
|
|
133
|
+
</p>
|
|
134
|
+
|
|
135
|
+
**v0.2.111**
|
|
136
|
+
<p>
|
|
137
|
+
Fixed DateTime conversion (write).<br/>
|
|
138
|
+
</p>
|
|
139
|
+
|
|
140
|
+
**v0.2.110**
|
|
141
|
+
<p>
|
|
142
|
+
Added 2D and 3D array support. Examples:<br/>
|
|
143
|
+
ns=1;s=Float2D;datatype=FloatArray[5,5]<br/>
|
|
144
|
+
ns=1;s=Float3D;datatype=FloatArray[5,5,5]<br/>
|
|
145
|
+
NOTE: Write range uses msg.range<br/>
|
|
146
|
+
New feature msg.payload.range can be used to read part of Array<br/>
|
|
147
|
+
New feature msg.range can be used to write part of Array<br/>
|
|
148
|
+
Updated example OPCUA-TEST-NODES.json<br/>
|
|
149
|
+
|
|
150
|
+
</p>
|
|
151
|
+
|
|
152
|
+
**v0.2.109**
|
|
153
|
+
<p>
|
|
154
|
+
Added array range examples (examples/OPCUA-TEST-NODES.json).<br/>
|
|
155
|
+
Send only if payload contains something.<br/>
|
|
156
|
+
Added msg.payload.range usage<br/>
|
|
157
|
+
New feature msg.payload.range can be used to read/write part of Array<br/>
|
|
158
|
+
Fix: FQDN -> hostname in makeAplicationUri<br/>
|
|
159
|
+
EventId and statustext as clear string<br/>
|
|
160
|
+
EventId as hex string<br/>
|
|
161
|
+
</p>
|
|
162
|
+
|
|
163
|
+
**v0.2.108 and older**
|
|
164
|
+
<p>
|
|
165
|
+
Fixed support for server Array variables<br/>
|
|
166
|
+
Browse will create topic and datatype thus output can be connected. Next node can progress output msg.<br/>
|
|
167
|
+
Refactored browse action fast and simple<br/>
|
|
168
|
+
Merged event payload fix. Merge pull request #265 from list3f/master<br/>
|
|
169
|
+
Put OPC UA event data in msg.payload<br/>
|
|
170
|
+
</p>
|
|
171
|
+
# Advanced examples
|
|
172
|
+
- needed from users (add links to examples folder)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
# Authors
|
|
177
|
+
|
|
178
|
+
* since 2015 [Mika Karaila][2]
|
|
179
|
+
* since 2016 [Klaus Landsdorf][3]
|
|
180
|
+
|
|
181
|
+
Testing
|
|
182
|
+
------
|
|
183
|
+
|
|
184
|
+
karma start opcua.conf.js --log-level debug --single-run
|
|
185
|
+
|
|
186
|
+
TBD List
|
|
187
|
+
-----
|
|
188
|
+
|
|
189
|
+
| __**Nodes**__ | __**Function**__ | __**Done**__ |
|
|
190
|
+
|--------------------|---------------------------|---------------------------|
|
|
191
|
+
| All | | |
|
|
192
|
+
| | Project structure | :white_check_mark: |
|
|
193
|
+
| | Async calls | :waxing_crescent_moon: |
|
|
194
|
+
| | UnitTesting | :new_moon: |
|
|
195
|
+
| | Documentation | :first_quarter_moon: |
|
|
196
|
+
| Item | | :white_check_mark: |
|
|
197
|
+
| Browser | | |
|
|
198
|
+
| | Browse | :white_check_mark: |
|
|
199
|
+
| | Simple UI interface | :first_quarter_moon: |
|
|
200
|
+
| Client | | |
|
|
201
|
+
| | Read | :white_check_mark: |
|
|
202
|
+
| | Read Multiple | :white_check_mark: |
|
|
203
|
+
| | Write | :white_check_mark: |
|
|
204
|
+
| | Write Multiple | :white_check_mark: |
|
|
205
|
+
| | Subscribe | :white_check_mark: |
|
|
206
|
+
| | Unsubscribe | :white_check_mark: |
|
|
207
|
+
| | DeleteSubscription | :white_check_mark: |
|
|
208
|
+
| | Info | :white_check_mark: |
|
|
209
|
+
| | Browse | :white_check_mark: |
|
|
210
|
+
| | AE | :new_moon: |
|
|
211
|
+
| | reconnect on error | :waxing_crescent_moon: |
|
|
212
|
+
| Server | | |
|
|
213
|
+
| Commands | | |
|
|
214
|
+
| | Restart | :white_check_mark: |
|
|
215
|
+
| | Add Folder | :white_check_mark: |
|
|
216
|
+
| | Set Folder | :white_check_mark: |
|
|
217
|
+
| | Add Variable | :white_check_mark: |
|
|
218
|
+
| | Add Object | :new_moon: |
|
|
219
|
+
| | Add Method | :new_moon: |
|
|
220
|
+
| | Add Equipment | :first_quarter_moon: |
|
|
221
|
+
| | Add PhysicalAssets | :first_quarter_moon: |
|
|
222
|
+
| | | |
|
|
223
|
+
| | Delete by NodeId | :white_check_mark: |
|
|
224
|
+
| Examples | | |
|
|
225
|
+
| | Methods | |
|
|
226
|
+
| | Structures | |
|
|
227
|
+
| | Variables | |
|
|
228
|
+
| | Objects | |
|
|
229
|
+
| | AE | |
|
|
230
|
+
| | | |
|
|
231
|
+
| Alarm and Events | | |
|
|
232
|
+
| | Subscribe | :white_check_mark: |
|
|
233
|
+
| | | |
|
|
234
|
+
|
|
235
|
+
[EMOJI CHEAT SHEET](http://www.emoji-cheat-sheet.com/)
|
|
236
|
+
|
|
237
|
+
[1]:http://nodered.org
|
|
238
|
+
[2]:https://github.com/mikakaraila
|
|
239
|
+
[3]:https://github.com/biancode
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
Copyright 2015 Valmet Automation Inc.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
|
|
17
|
+
-->
|
|
18
|
+
|
|
19
|
+
<script type="text/javascript">
|
|
20
|
+
RED.nodes.registerType('OpcUa-Item',{
|
|
21
|
+
category: 'opcua',
|
|
22
|
+
color:"#3FADB5",
|
|
23
|
+
defaults: {
|
|
24
|
+
item: {value: "", required: true},
|
|
25
|
+
datatype: {value: "", required: true},
|
|
26
|
+
value: {value: null},
|
|
27
|
+
name: {value: ""}
|
|
28
|
+
},
|
|
29
|
+
inputs:1,
|
|
30
|
+
outputs:1,
|
|
31
|
+
align: "right",
|
|
32
|
+
icon: "opcuanodeLogo.png",
|
|
33
|
+
label: function() {
|
|
34
|
+
return this.name || "OPC UA Item";
|
|
35
|
+
},
|
|
36
|
+
labelStyle: function() {
|
|
37
|
+
return this.name?"node_label_italic":"";
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
<script type="text/x-red" data-template-name="OpcUa-Item">
|
|
45
|
+
<div class="form-row">
|
|
46
|
+
<label for="node-input-item"><i class="icon-tasks"></i> Item</label>
|
|
47
|
+
<input type="text" id="node-input-item" placeholder="ns=2;s=MySwitch or ns=2;i=1234 or br=/objects/3:Simulation/3:Counter">
|
|
48
|
+
</div>
|
|
49
|
+
<div class="form-row">
|
|
50
|
+
<label for="node-input-datatype"><i class="icon-tasks"></i> Type</label>
|
|
51
|
+
<select type="text" id="node-input-datatype">
|
|
52
|
+
<option value="Int8">Int8</option>
|
|
53
|
+
<option value="Int16">Int16</option>
|
|
54
|
+
<option value="Int32">Int32</option>
|
|
55
|
+
<option value="Int64">Int64</option>
|
|
56
|
+
<option value="UInt8">UInt8</option>
|
|
57
|
+
<option value="UInt16">UInt16</option>
|
|
58
|
+
<option value="UInt32">UInt32</option>
|
|
59
|
+
<option value="UInt64">UInt64</option>
|
|
60
|
+
<option value="Byte">Byte</option>
|
|
61
|
+
<option value="SByte">SByte</option>
|
|
62
|
+
<option value="Float">Float</option>
|
|
63
|
+
<option value="Double">Double</option>
|
|
64
|
+
<option value="Boolean">Boolean</option>
|
|
65
|
+
<option value="String">String</option>
|
|
66
|
+
<option value="LocalizedText">LocalizedText</option>
|
|
67
|
+
<option value="DateTime">DateTime</option>
|
|
68
|
+
<option value="Int8 Array">Int8 Array</option>
|
|
69
|
+
<option value="Int16 Array">Int16 Array</option>
|
|
70
|
+
<option value="Int32 Array">Int32 Array</option>
|
|
71
|
+
<option value="UInt8 Array">UInt8 Array</option>
|
|
72
|
+
<option value="UInt16 Array">UInt16 Array</option>
|
|
73
|
+
<option value="UInt32 Array">UInt32 Array</option>
|
|
74
|
+
<option value="Byte Array">Byte Array</option>
|
|
75
|
+
<option value="SByte Array">SByte Array</option>
|
|
76
|
+
<option value="String Array">String Array</option>
|
|
77
|
+
<option value="Float Array">Float Array</option>
|
|
78
|
+
<option value="Double Array">Double Array</option>
|
|
79
|
+
<option value="Boolean Array">Boolean Array</option>
|
|
80
|
+
<option value="Extension Object">ExtensionObject</option>
|
|
81
|
+
<option value="Extension Object Array">ExtensionObject Array</option>
|
|
82
|
+
</select>
|
|
83
|
+
</div>
|
|
84
|
+
<div class="form-row">
|
|
85
|
+
<label for="node-input-value"><i class="icon-tag"></i> Value</label>
|
|
86
|
+
<input type="text" id="node-input-value" placeholder="">
|
|
87
|
+
</div>
|
|
88
|
+
<div class="form-row">
|
|
89
|
+
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
90
|
+
<input type="text" id="node-input-name" placeholder="">
|
|
91
|
+
</div>
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
<script type="text/x-red" data-help-name="OpcUa-Item">
|
|
97
|
+
<p>Defines OPC UA item, type and value.</p>
|
|
98
|
+
<p>Item contains valid OPC UA address like ns=2;i=4 OR ns=3;s=MyVariable</p>
|
|
99
|
+
<p>There are not all Types possible for now, but you can select some.</p>
|
|
100
|
+
<p>Value is needed only if item will be written to OPC UA server.</p>
|
|
101
|
+
<p>If value isn't filled, OpcUa-Item sends input <strong>msg.payload</strong>.</p>
|
|
102
|
+
<p>Array values are delimited by , and must be given in following syntax:</p>
|
|
103
|
+
<p>5,4,3,2,1</p>
|
|
104
|
+
<p><strong>NOTE:</strong> Item value can be used as initial value when msg.payload is empty.</p>
|
|
105
|
+
<p> Otherwise msg.payload is used to set value.</p>
|
|
106
|
+
</script>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
|
|
3
|
+
Copyright 2015 Valmet Automation Inc.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
|
|
17
|
+
**/
|
|
18
|
+
|
|
19
|
+
module.exports = function (RED) {
|
|
20
|
+
"use strict";
|
|
21
|
+
var opcua = require('node-opcua');
|
|
22
|
+
var opcuaBasics = require('./opcua-basics');
|
|
23
|
+
const {parse, stringify} = require('flatted');
|
|
24
|
+
|
|
25
|
+
function OpcUaItemNode(n) {
|
|
26
|
+
|
|
27
|
+
RED.nodes.createNode(this, n);
|
|
28
|
+
|
|
29
|
+
this.item = n.item; // OPC UA address: ns=2;i=4 OR ns=3;s=MyVariable
|
|
30
|
+
this.datatype = n.datatype.replace(/\s/g, ""); // String; need to remove white space from node datatype to be consistent with inputs, i.e. ExtensionObject
|
|
31
|
+
this.value = n.value; // 66.6
|
|
32
|
+
this.name = n.name; // browseName shall be put here
|
|
33
|
+
|
|
34
|
+
var node = this;
|
|
35
|
+
|
|
36
|
+
function verbose_warn(logMessage) {
|
|
37
|
+
//if (RED.settings.verbose) {
|
|
38
|
+
node.warn((node.name) ? node.name + ': ' + logMessage : 'OpcUaClientNode: ' + logMessage);
|
|
39
|
+
//}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function verbose_log(logMessage) {
|
|
43
|
+
//if (RED.settings.verbose) {
|
|
44
|
+
// node.log(logMessage);
|
|
45
|
+
node.debug(logMessage);
|
|
46
|
+
//}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
node.on("input", function (msg) {
|
|
50
|
+
|
|
51
|
+
msg.topic = node.item;
|
|
52
|
+
msg.datatype = node.datatype;
|
|
53
|
+
msg.browseName = node.name;
|
|
54
|
+
|
|
55
|
+
// Node contains static value, inject with empty string as payload
|
|
56
|
+
if (node.value && msg.payload.length === 0) {
|
|
57
|
+
verbose_log('First set value by node value:' + node.value);
|
|
58
|
+
if (node.datatype) {
|
|
59
|
+
msg.payload = opcuaBasics.build_new_value_by_datatype(node.datatype, node.value);
|
|
60
|
+
}
|
|
61
|
+
if (msg.datatype) {
|
|
62
|
+
msg.payload = opcuaBasics.build_new_value_by_datatype(msg.datatype, node.value);
|
|
63
|
+
}
|
|
64
|
+
verbose_warn("NODE value, setting value to " + stringify(msg));
|
|
65
|
+
}
|
|
66
|
+
// Input msg is dynamic and will overwrite node.value
|
|
67
|
+
if (msg.payload && msg.payload.length > 0) {
|
|
68
|
+
// verbose_warn("Second set value by Input " + msg.payload);
|
|
69
|
+
if (node.datatype) {
|
|
70
|
+
msg.payload = opcuaBasics.build_new_value_by_datatype(node.datatype, msg.payload);
|
|
71
|
+
}
|
|
72
|
+
if (msg.datatype) {
|
|
73
|
+
msg.payload = opcuaBasics.build_new_value_by_datatype(msg.datatype, msg.payload);
|
|
74
|
+
}
|
|
75
|
+
// verbose_warn("Payload value, setting value to " + stringify(msg));
|
|
76
|
+
}
|
|
77
|
+
node.send(msg);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
RED.nodes.registerType("OpcUa-Item", OpcUaItemNode);
|
|
82
|
+
};
|