node-red-contrib-mobius-flow-thingsboard
Version:
Node-RED nodes to work with MOBiUSFlow and ThingsBoard.io
144 lines (130 loc) • 6.16 kB
HTML
<!--
Copyright (c) 2017, IAconnects Technology Limited
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be
used to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<script type="text/x-red" data-template-name="mobius thingsboard manager">
<div class="form-row">
<label for="node-input-connection"><i class="fa fa-globe"></i> Thingsboard</label>
<input type="text" id="node-input-connection">
</div>
<hr>
<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/javascript">
RED.nodes.registerType('mobius thingsboard manager', {
category: 'thingsboard',
color: '#a1b0de',
defaults: {
connection: { type: 'mobius thingsboard connection', required: true },
name: { value: '' },
},
inputs: 1,
outputs: 1,
outputLabels: [],
icon: 'thingsboard.png',
align: 'right',
paletteLabel: 'thingsboard manager',
label: function () {
if (this.name) {
return this.name;
} else {
return 'thingsboard manager';
}
},
labelStyle: function () {
return this.name ? 'node_label_italic' : '';
},
});
</script>
<script type="text/x-red" data-help-name="mobius thingsboard manager">
<p>Manage registration and provisioning of Mobius Objects as Thingsboard devices.</p>
<h3>Configuration Page</h3>
<dl class="message-properties">
<dt>Thingsboard <span class="property-type">string</span></dt>
<dd>The Thingsboard connection manager configuration node.</dd>
</dl>
<h3>Inputs</h3>
<ol class="node-ports">
Provision devices
<dl class="message-properties">
<dt>topic <span class="property-type">string</span></dt>
<dd>provision-devices</dd>
<dt>payload <span class="property-type">array</span></dt>
<dd>An array of Mobius objects to provision.</dd>
</dl>
Provision assets
<dl class="message-properties">
<dt>topic <span class="property-type">string</span></dt>
<dd>provision-assets</dd>
<dt>payload <span class="property-type">array</span></dt>
<dd>An array of Mobius objects to provision.</dd>
</dl>
Register objects
<dl class="message-properties">
<dt>topic <span class="property-type">array</span></dt>
<dd>register-objects</dd>
<dt>payload <span class="property-type">object</span></dt>
<dd>An array of Mobius objects to register.</dd>
</dl>
Clear registered objects
<dl class="message-properties">
<dt>topic <span class="property-type">array</span></dt>
<dd>clear-registered-objects</dd>
</dl>
</ol>
<h3>Output</h3>
<ol class="node-ports">
<dl class="message-properties">
<dt>topic <span class="property-type">string</span></dt>
<dd>Input topic is passed through to output.</dd>
<dt>payload <span class="property-type">string</span></dt>
<dd>If the send was successful <code>OK</code>, else <code>Fault</code>.</dd>
</dl>
</ol>
<h3>Details</h3>
<p>
This node has two purposes, provisioning (creating) devices and assets in Thingsboard from Mobius Objects, and maintaining a list of registered
Mobius Objects that can update their attributes and telemetry in Thingsboard. The reason for maintaining a list of registered objects is
to prevent devices being created in Thingsboard automatically when sending telemetry data.
</p>
<p>
When devices or assets are provisioned in Thingsboard using this node that will have their device type set to the Mobius Object's profile name and
their client attributes and telemetry values set based on the Mobius Object's resources. It is recommended that you set the <b>name</b> resource
to something other than the default for all Mobius Objects prior to provisioning as this resource will be used as the device name in Thingsboard.
</p>
<p>
Provisioning devices will also register them so you do not need to register devices after provisioning them.
</p>
<p>
Registration of devices does not persist between restarts of the flows. You must send a <b>register-objects</b> message with an array
of all objects to be registered on every start of the flows.
</p>
<h3>Input Message Payload</h3>
<p>Both the <code>register-objects</code> and <code>provision-devices</code> messages require the message payload to be an array of Mobius Objects.</p>
<p>It is recommended that you preceed this node with a Mobius <code>discover object list</code> node with the output set to MOBiUS Objects as an array of items.
This will provide the input in the correct format.
</p>
<br>
<p align="center" style="color:#000080">mobiusflow 2024</p>
</script>