UNPKG

node-red-contrib-mobius-flow-thingsboard

Version:

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

121 lines (107 loc) 5.13 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 device 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" id="enableMqttCheckbox"> <label style="width:auto" for="node-input-useMQTT"><i class="fa fa-cloud-upload"></i> Use MQTT </label> <input type="checkbox" checked id="node-input-useMQTT" style="display:inline-block; width:auto; vertical-align:top;"> </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 device publish', { category: 'thingsboard', color: '#a1b0de', defaults: { connection: { type: 'mobius thingsboard connection', required: true }, useMQTT: { value: true }, publish: { required: true, value: 'telemetry' }, name: { value: '' }, }, inputs: 1, outputs: 1, outputLabels: ['Store and Forward Control'], icon: 'thingsboard.png', align: 'right', paletteLabel: 'thingsboard device publish', label: function () { if (this.name) { return this.name; } else { return `thingsboard device publish ${this.publish}`; } }, labelStyle: function () { return this.name ? 'node_label_italic' : ''; }, oneditprepare: function () { $('#enableMqttCheckbox').hide(); }, }); </script> <script type="text/x-red" data-help-name="mobius thingsboard device publish"> <p>Update attributes and/or telemetry data of 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> <dt>Use MQTT <span class="property-type">checkbox</span></dt> <dd>Select whether to use MQTT or HTTPS to publish data.</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>