node-red-contrib-kolibri
Version:
Node-RED nodes for connecting to a Kolibri Broker (e.g. HMS Hub)
89 lines (83 loc) • 3.36 kB
HTML
<script type="text/javascript">
(function () {
'use strict';
/*
* Copyright 2021 HMS Industrial Networks AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http: //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
RED.nodes.registerType('kolibri-in', {
category: 'network',
defaults: {
name: { value: '' },
path: { value: '', required: true },
broker: { value: '', type: 'kolibri-broker', required: true },
resume: { value: false, required: false }
},
inputs: 0,
outputs: 1,
color: '#ffaaaa',
icon: 'bridge.png',
label: function () {
return this.name || this.path || 'kolibri';
},
labelStyle: function () {
return this.name ? 'node_label_italic' : '';
}
});
})();
</script>
<script type="text/html" data-template-name="kolibri-in">
<div class="form-row">
<label for="node-input-broker"><i class="fa fa-globe"></i> Kolibri broker</span></label>
<input type="text" id="node-input-broker">
</div>
<div class="form-row">
<label for="node-input-path"><i class="fa fa-tasks"></i> Data point path</label>
<input type="text" id="node-input-path" placeholder="Path">
</div>
<div class="form-row">
<label for="node-input-resume"><i class="fa fa-tasks"></i> Resume</label>
<input class="input-append-left" type="checkbox" id="node-input-resume" placeholder="false" style="width:auto">
</div>
<br/>
<!-- By convention, most nodes have a 'name' property. The following div -->
<!-- provides the necessary field. Should always be the last option -->
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/html" data-help-name="kolibri-in">
<p>Connects to the specified Kolibri broker and subscribes the specified data point.</p>
<p>Outputs a message with the properties:</p>
<ul>
<li><code>msg.payload</code>
<p>Is the value of the variables to transmit itself</p></li>
<li><code>msg.quality</code>
<p>Indicates the reliability of the current value as number. Possible qualities are:
0: Unknown -- Default
1: Valid
2: Simulated -- The value is not a real field, but a simulated value
3: Forced -- The value is not a real field, but a forced value
4: Invalid
5-99: Reserved for future use
100ff: User-definable
</p>
</li>
<li><code>msg.timestamp</code>
<p>The current unix timestamp in seconds</p></li></li>
<li><code>msg.path</code>
<p>The data point path to subscribe to</p></li></li>
</ul>
</script>