node-red-contrib-proficloud
Version:
Proficloud - IIoT-Platform of Phoenix Contact
214 lines (201 loc) • 7.93 kB
HTML
<script type="text/javascript">
RED.nodes.registerType("ProficloudDevice", {
category: "Phoenix Contact",
color: "#93C005",
defaults: {
// uuid not required, because it can also be sent via payload
uuid: {value: ""},
env: {value: "Production", required: false},
autostart: {value: true},
autodelay: {value: 0, validate: RED.validators.number(), required: false},
metaByPayload: {value: true},
deviceType: {value: "NodeRED-Node", required: true},
serialNumber: {value: ""},
firmwareVersion: {value: ""},
hardwareVersion: {value: ""},
proficloud_api: {value: "env.kaa.proficloud-production.io"},
proficloud_mqtt: {value: "mqtts://mqtt.proficloud-production.io:8883"},
tsd_interval_activated: {value: false},
tsd_interval: {value: 10000},
tsd_timeunit: {value: "ms"},
uuid_payload: {value: false}
},
inputs: 1,
outputs: 1,
icon: "icon_proficloud_device.svg",
label: function () {
return "Device " + this.uuid;
},
oneditprepare: function () {
if (this.metaByPayload == true) {
$("#divMetaByPayload").show();
} else {
$("#divMetaByPayload").hide();
}
$("#node-input-metaByPayload").on("change", function () {
if (this.checked) {
$("#divMetaByPayload").show();
} else {
$("#divMetaByPayload").hide();
}
});
$("#node-input-uuid_payload").on("change", function () {
if (this.checked) {
$("#divUuid").hide();
} else {
$("#divUuid").show();
}
});
$("#node-input-tsd_interval_activated").on("change", function () {
if (this.checked) {
$("#divTsdInterval").show();
} else {
$("#divTsdInterval").hide();
}
});
$("#node-input-tsd_timeunit").typedInput({
type: "timeunit",
types: [
{
value: "timeunit",
options: [
{value: "ms", label: "Milliseconds"},
{value: "s", label: "Seconds"},
{value: "m", label: "Minutes"},
{value: "h", label: "Hours"}
]
}
]
});
}
});
</script>
<script type="text/html" data-template-name="ProficloudDevice">
<p>Insert the UUID that was provided to you by the PxC SmartBusiness Team or enable "UUID via payload" if you want to provide the UUID for your device only via a payload</p>
<div class="form-row">
<label for="node-input-uuid_payload"><i class="icon-tag"></i>UUID via payload</i></label>
<input type="checkbox" id="node-input-uuid_payload" style="display:inline-block; width:15px; vertical-align:baseline;">
</div>
<div id="divUuid">
<div class="form-row">
<label for="node-input-uuid"><i class="icon-tag"></i>UUID</label>
<input type="text" id="node-input-uuid">
</div>
</div>
<p>Enable 'AutoConnect' to connect automatically after start. Delay is time before connection initiation</p>
<div class="form-row">
<label for="node-input-autostart">AutoConnect</label>
<input type="checkbox" id="node-input-autostart" style="display:inline-block; width:15px; vertical-align:baseline;">
<span data-i18n="inject.autostart"></span>
</div>
<div class="form-row">
<label for="node-input-autodelay">Delay in s</label>
<input type="text" id="node-input-autodelay" placeholder="0.1" style="width:45px; height:28px;">
<span data-i18n="inject.onceautodely"></span>
</div>
<h3>Metadata (Proficloud Dashboard)</h3>
<p>Enable 'Custom Metadata' to set custom <i>Serial
Number</i>, <i>Firmware Version</i> and <i>Hardware Version</i> by hand.</p>
<p>Disable to use the Metadata included in your devices payload.</p>
<div class="form-row">
<label for="node-input-metaByPayload"><i class="icon-tag"></i>Custom Metadata</label>
<input type="checkbox" id="node-input-metaByPayload" style="display:inline-block; width:15px; vertical-align:baseline;">
</div>
<div id="divMetaByPayload">
<div class="form-row">
<label for="node-input-serialNumber"><i class="icon-tag"></i>Serial No.</label>
<input type="text" id="node-input-serialNumber">
</div>
<div class="form-row">
<label for="node-input-firmwareVersion"><i class="icon-tag"></i>FW Version</label>
<input type="text" id="node-input-firmwareVersion">
</div>
<div class="form-row">
<label for="node-input-hardwareVersion"><i class="icon-tag"></i>HW Version</label>
<input type="text" id="node-input-hardwareVersion">
</div>
</div>
<h3>Buffering</h3>
<p>Enable 'Buffering' and select a buffering intervall to collect your TimeSeriesData in this
interval and transmiss it to your Dashboard all at once</p>
<div class="form-row">
<label for="node-input-tsd_interval_activated"><i class="icon-tag"></i>Buffering</i></label>
<input type="checkbox" id="node-input-tsd_interval_activated" style="display:inline-block; width:15px; vertical-align:baseline;">
</div>
<div id="divTsdInterval">
<div class="form-row">
<label for="node-input-tsd_interval">alle</label>
<input type="text" id="node-input-tsd_interval" placeholder="1" style="width:50px; height:34px">
<input type="text" id="node-input-tsd_timeunit" style="width: 150px; height: 34px;">
</div>
</div>
</script>
<script type="text/html" data-help-name="ProficloudDevice">
<p>This Nodes represents a virtual device of the Proficloud.io of PhoenixContact</p>
For more information please visit <a href="https://proficloud.io">Proficloud.io</a> of PhoenixContact. The easy-to-use
IIoT-platform.
<h3>Metadata</h3>
The metadata is represented in the Proficloud.io Device Management Service and can be set in Node configuration.
<h3>Inputs</h3>
!! The following properties need to be inside the msg.payload object !!
<hr />
<p>Payload for Log messages:</p>
<dl class="message-properties">
<dt>
log.msg
<span class="property-type">string</span>
</dt>
<dd>The log message that should be published</dd>
<dt>
log.level
<span class="property-type">int</span>
</dt>
<dd>The level of the message</dd>
<dt>
log.tag
<span class="property-type">string</span>
</dt>
<dd>The tag of the log entry</dd>
</dl>
<hr />
<p>Payload for Health report</p>
<dl class="message-properties">
<dt>
trafficlight.color
<span class="property-type">int</span>
</dt>
<dd>color: 0 -> Green, 1 -> Orange, 2 -> Red</dd>
<dt>
trafficlight.msg
<span class="property-type">string</span>
</dt>
<dd>The message of the traffic light is displayed in the cloud and should give a quick reason for the problem.</dd>
</dl>
<hr />
<p>Payload for Time Series Data</p>
<dl class="message-properties">
<dt>
data
<span class="property-type">object</span>
</dt>
<dd>TimeSeriesData can be visualized in the TimeSeriesData Service</dd>
<dd>An external timestamp can be send for data by giving the UTC timestamp in milliseconds</dd>
</dl>
<h3>Outputs</h3>
!! The following properties will be inside the msg.payload object !!
<hr />
Remote commands from Proficloud.io will be provided through the output of the node. The object contains the following
informations
<dl class="message-properties">
<dt>
command.id
<span class="property-type">string</span>
</dt>
<dd>The command id from the cloud</dd>
<dt>
command.payload
<span class="property-type">int</span>
</dt>
<dd>The payload of the command</dd>
</dl>
</script>