@pilot-things/node-red-contrib-pilot-things
Version:
Provides Node-RED nodes for Pilot Things interoperability
82 lines (78 loc) • 3.56 kB
HTML
<script type="text/javascript" src="/pilot-things.js"></script>
<script type="text/javascript">
var pilotThingsDecodeDataLibrary = "decode library";
RED.nodes.registerType("pilot-things-decode-data-library", {
category: pilotThingsNodeCategory,
color: pilotThingsNodeColor,
defaults: {
format: { value: "hex" },
name: { value: "" }
},
credentials: {
apikey: { type: "text" }
},
inputs: 1,
outputs: 1,
icon: pilotThingsIcon,
paletteLabel: pilotThingsDecodeDataLibrary,
label: pilotThingsNameOr(pilotThingsDecodeDataLibrary),
labelStyle: pilotThingsItalicIfName
});
</script>
<script type="text/html" data-template-name="pilot-things-decode-data-library">
<style>
.pilot-things-label {
width: 166px ;
}
.pilot-things-input {
width: 50% ;
}
</style>
<div class="form-row">
<label for="node-input-apikey" class="pilot-things-label"><i class="fa fa-lock"></i> Sensor Library API key</label>
<input type="text" id="node-input-apikey" class="pilot-things-input" required>
</div>
<div class="form-row">
<label for="node-input-format" class="pilot-things-label"><i class="fa fa-file"></i> Data string format</label>
<select type="text" id="node-input-format" class="pilot-things-input">
<option value="hex">Hexadecimal</option>
<option value="base64">Base64</option>
<option value="ascii">ASCII</option>
</select>
</div>
<div class="form-row">
<label for="node-input-name" class="pilot-things-label"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name" class="pilot-things-input">
</div>
</script>
<script type="text/html" data-help-name="pilot-things-decode-data-library">
<p>Decode the payload using the cloud Pilot Things Sensor Library.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">{ data?: string | Buffer, productId: string }</span>
<dd>
The data to decode and the ID of the source product (<a href="https://www.pilot-things.com/smart-platform/sensor-library" target="_blank">list here</a>).<br>
<b>Note:</b> Omitting <code>data</code> will result in an empty payload being sent.
</dd>
</dt>
</dl>
<h3>Properties</h3>
<dl class="message-properties">
<dt>Sensor Library API key
<span class="property-type">string</span>
<dd>The token used for authentication. You received this when subscribing to the service.</dd>
</dt>
<dt>Data string format
<span class="property-type">enum</span>
<dd>
The format in which the data is, if it's a string (ignored if the data is a <code>Buffer</code>).<br>
<b>Note:</b> See the <a href="https://github.com/PilotThings/node-red-contrib-pilot-things#my-data-is-in-a-non-supported-data-format-how-do-i-submit-it-to-the-pilot-things-nodes">FAQ</a> if your data is not in a supported format.
</dd>
</dt>
<dt>Name
<span class="property-type">string</span>
<dd>The name used by the node in Node-RED flow editor.</dd>
</dt>
</dl>
</script>