UNPKG

node-red-contrib-mobius-flow-thingsboard

Version:

Node-RED nodes to work with MOBiUSFlow and ThingsBoard.io

121 lines (107 loc) 5.17 kB
<!-- 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 publish"> <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> <div class="form-row"> <label for="node-input-publishAs"><i class="fa fa-bars"></i> Publish As</label> <select type="text" id="node-input-publishAs" style="display: inline-block; width: auto; vertical-align: center;"> <option value="device">Thingsboard Device</option> <option value="asset">Thingsboard Asset</option> </select> </div> <div class="form-row"> <label for="node-input-publish"><i class="fa fa-bars"></i> Publish</label> <select type="text" id="node-input-publish" style="display: inline-block; width: auto; vertical-align: center;"> <option value="telemetry">Telemetry Only</option> <option value="attributes">Attributes Only</option> <option value="both">Telemetry and Attributes</option> </select> </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 publish', { category: 'thingsboard', color: '#c6d0eb', defaults: { connection: { type: 'mobius thingsboard connection v2', required: true }, publishAs: { required: true, value: 'device' }, publish: { required: true, value: 'telemetry' }, name: { value: '' }, }, inputs: 1, outputs: 1, outputLabels: ['Store and Forward Control'], icon: 'thingsboard.png', align: 'right', paletteLabel: 'thingsboard publish', label: function () { if (this.name) { return this.name; } else { return `thingsboard publish ${this.publishAs} - ${this.publish}`; } }, labelStyle: function () { return this.name ? 'node_label_italic' : ''; }, }); </script> <script type="text/x-red" data-help-name="mobius thingsboard publish"> <p>Update attributes and/or telemetry data of Thingsboard devices or assets.</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> <dt>Publish As <span class="property-type">option</span></dt> <dd>Select whether to publish MOBiUS objects as Thingsboard devices or assets.</dd> <dt>Publish <span class="property-type">option</span></dt> <dd>Select what to publish to Thingsboard - Telemetry Only, Attributes Only, or both Attributes and Telemetry.</dd> </dl> <h3>Inputs</h3> <ol class="node-ports"> <dl class="message-properties"> <dt>topic <span class="property-type">string</span></dt> <dd>The URI of the object.</dd> <dt>payload <span class="property-type">object</span></dt> <dd>The object COV in the standard format output from a <code>mobius flow inject</code> node. If using a mobius cloud format node set verbosity to verbose.</dd> </dl> </ol> <h3>Outputs</h3> <ol class="node-ports"> <dl class="message-properties"> <dt>storeFwdControl <span class="property-type">string</span></dt> <dd><code>store</code> or <code>forward</code> depending on if the node is connected to Thingsboard. Feed this back into the input of a <code>mobius store fwd</code> node.</dd> </dl> </ol> <br> <p align="center" style="color:#000080">mobiusflow 2024</p> </script>