node-red-contrib-iiot-opcua
Version:
An Industrial IoT OPC UA toolbox contribution package for Node-RED based on node-opcua.
104 lines (103 loc) • 6.69 kB
HTML
<!--
The BSD 3-Clause License
Copyright 2022 - DATATRONiQ GmbH (https://datatroniq.com)
Copyright (c) 2018-2022 Klaus Landsdorf (http://node-red.plus/)
Copyright 2015,2016 - Mika Karaila, Valmet Automation Inc. (node-red-contrib-opcua)
All rights reserved.
node-red-contrib-iiot-opcua
--> <script type='text/javascript'> RED.nodes.registerType('OPCUA-IIoT-Listener', {
category: 'IIoT',
color: '#ABCDEF',
defaults: {
connector: {type: 'OPCUA-IIoT-Connector', required: true},
action: {value: 'subscribe', required: true},
queueSize: {value: 10, required: true, validate: RED.validators.number()},
name: {value: ''},
topic: {value: ''},
justValue: {value: true},
useGroupItems: {value: false},
showStatusActivities: {value: false},
showErrors: {value: false}
},
inputs: 1,
outputs: 1,
align: 'left',
icon: 'icon.png',
label: function () {
return this.name || 'Listener'
},
labelStyle: function () {
return this.name ? 'node_label_italic' : ''
}
}) </script> <script type='text/x-red' data-template-name='OPCUA-IIoT-Listener'>
<div class='form-row'> <label for='node-input-connector'><i class='icon-globe'></i> <span
data-i18n='opcua-iiot-contrib.label.connector'></span></label> <input type='text' id='node-input-connector'
placeholder='opc.tcp://localhost:4334'> </div> <div class='form-row'> <label for='node-input-action'><i
class='fa fa-list'></i> <span data-i18n='opcua-iiot-contrib.label.actiontype'></span></label> <select type='text'
id='node-input-action' style='width:72%'> <option value='subscribe' selected='selected'>Monitoring</option> <option
value='events'>Alarm&Events</option> </select> </div> <div class='form-row'> <label for='node-input-queueSize'><i
class='icon-list'></i> <span data-i18n='opcua-iiot-contrib.label.queueSize'></span></label> <input type='number'
id='node-input-queueSize' placeholder=''> </div> <div class='form-row'> <label for='node-input-name'><i
class='fa fa-tag'></i> <span data-i18n='node-red:common.label.name'></span></label> <input type='text'
id='node-input-name' placeholder=''> </div> <div class='form-row'> <label for='node-input-topic'><i class='fa fa-tag'>
</i> <span data-i18n='node-red:common.label.topic'></span></label> <input type='text' id='node-input-topic'> </div> <hr>
<div class='form-row'> <label style='min-width:160px' for='node-input-useGroupItems'><i class='fa fa-object-group'></i>
<span data-i18n='opcua-iiot-contrib.label.useGroupItems'></span></label> <input type='checkbox'
id='node-input-useGroupItems' style='max-width:30px'> </div> <div class='form-row'> <label style='min-width:160px'
for='node-input-justValue'><i class='fa fa-simplybuilt'></i> <span data-i18n='opcua-iiot-contrib.label.justValue'>
</span></label> <input type='checkbox' id='node-input-justValue' style='max-width:30px'> </div> <hr> <div
class='form-row'> <label style='min-width:160px' for='node-input-showStatusActivities'><i class='fa fa-bolt'></i> <span
data-i18n='opcua-iiot-contrib.label.showActivities'></span></label> <input type='checkbox'
id='node-input-showStatusActivities' style='max-width:30px'> </div> <div class='form-row'> <label
style='min-width:160px' for='node-input-showErrors'><i class='fa fa-exclamation-circle'></i> <span
data-i18n='opcua-iiot-contrib.label.showErrors'></span></label> <input type='checkbox' id='node-input-showErrors'
style='max-width:30px'> </div> </script> <script type='text/x-red' data-help-name='OPCUA-IIoT-Listener'>
<h2>OPC UA IIoT Listener</h2> <p>
The Listener node is to set up monitoring to the address space or Alarm&Events of your OPC UA server. It needs only one inject to set up start monitoring. For every inject, it works like flip-flop - subscribe-unsubscribe monitoring or Alarm&Events.
</p> <h3>Input</h3> <div> <strong>Input:</strong> <ul> <li>payload (number*/Object) <ul> <li>interval (number*) </li>
<li>queueSize (number) </li><li>options (Object) </li></ul> </li><li>topic </li><li>nodetype (inject) </li><li>
injectType (listen/browse*) </li><li>addressSpaceItems or addressItemsToRead* (Array of Objects) </li></ul> </div> <h4>
Inject payload JSON</h4> <p>There is an option to send a JSON payload inject into the Listener.</p> <p>Example:</p> <p>
<pre> {
"interval": 500,
"queueSize": 10,
"options": {
"requestedPublishingInterval": 5000,
"requestedLifetimeCount": 60,
"requestedMaxKeepAliveCount": 10,
"maxNotificationsPerPublish": 5,
"publishingEnabled": true,
"priority": 8
}
}
</pre></p> <p>
The option interval means the sampling interval. If you want to set the publishing interval you have to send a bit more options.
</p> <div> <h5>msg.payload.options<h5> <strong>event subscription parameters default: <pre>
msg.payload.options = {
requestedPublishingInterval: 100,
requestedLifetimeCount: 60,
requestedMaxKeepAliveCount: 10,
maxNotificationsPerPublish: 4,
publishingEnabled: true,
priority: 3
}
</pre> <strong>subscription parameters default: <pre>
msg.payload.options = {
requestedPublishingInterval: 100,
requestedLifetimeCount: 1000,
requestedMaxKeepAliveCount: 12,
maxNotificationsPerPublish: 100,
publishingEnabled: true,
priority: 6
}
</pre> </strong></strong></h5></h5></div> <p>
The sampling interval and the publishing interval is to tell you want to sample every n interval in msec. and it should publish every n msec.
</p> <p>
Example: interval: 200, queueSize: 5, and requestedPublishingInterval: 1000 samples every 200 msec. and publishing changes every second (1000 msec.) with max. 5 values
</p> <h3>Output 1</h3> <h4>All Mode</h4> <div> <strong>Result in message:</strong> <ul> <li>payload (object) </li><li>
topic </li><li>addressSpaceItems (Array) </li><li>nodetype </li><li>injectType </li><li>readtype </li><li>
result (origin from node-opcua) </li><li>mode (all/value) </li></ul> </div> <h4>Value Mode</h4> <div> <strong>
Result in subscribe message:</strong> <ul> <li>payload <ul> <li>name </li><li>nodeId </li><li>value </li></ul> </li><li>
topic </li><li>addressSpaceItems (Array) </li><li>injectType </li><li>readtype </li><li>mode (all/value) </li></ul>
</div> <h3>Output 2</h3> <p>That output provides the origin from node-opcua as JSON.</p> <strong>Name</strong> <p>
Name in the flow of Node-RED.</p> <p>Set showErrors to get errors from node-opcua on browse.</p> </script>