node-red-contrib-digital-factory
Version:
Node-Red nodes for Supply Chain Wizard's Digital Factory Platform
64 lines (54 loc) • 3.65 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('digitalfactory',{
category: 'Digital Factory',
color: '#D3D3D3',
inputs:1,
outputs:1,
icon: "digital-factory-logo.png",
label: function() {
return this.name||"My Digital Factory";
},
paletteLabel: "Digital Factory",
outputLabel: "Receive Data",
inputLabel: "Send Data",
defaults: {
name: {value:""},
hub: {value:"", type:"DF Device Hub"},
portal: {value:"", type:"DF Portal"},
},
});
</script>
<script type="text/x-red" data-template-name="digitalfactory">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>Company Name</label>
<input type="text" id="node-input-name" placeholder="Company Name">
</div>
<div class="form-row">
<label for="node-input-hub"><i class="icon-tag"></i>Device Hub</label>
<input type="text" id="node-input-hub" placeholder="Device Hub">
</div>
<div class="form-row">
<label for="node-input-portal"><i class="icon-tag"></i>Portal</label>
<input type="text" id="node-input-portal" placeholder="Portal">
</div>
</script>
<script type="text/x-red" data-help-name="digitalfactory">
<p>This node provides connectivity to your Digital Factory Instance<br>
Please note that an active SCW Digital Factory subscription is needed.<br>
Please contact www.supplychainwizard.com for details.</p>
<p>This node has a single input and a single output. Intentions of the messages are managed by "<b>msg.topic</b>".<br>
<br>
Options for input : <br>
set msg.topic to : <br>
<b>"telemetry"</b> to send sensor data<br>
<b>"twinUpdate"</b> to send reported properties information that can be read by Digital Factory. An example use may be current ip address of the device. For such information, only the latest value is interesting so we do not send that as a telemetry message every x minutes but we update a twin on the cloud side. <br>
The node also stores device twin information on the flow context. use flow.get("twinProps") on a function node to access the desired and reported properties.
<b>"fileUpload"</b> to send files to cloud. This can be used where the sensor data is actually a file like a camera or a sound recording etc. File upload requires msg.payload as the content of the file (buffer) and msg.filename as the name and extension of the file like "myImage123.png". If you want to use the standard "File In" node to read a file from filesystem and upload into device hub, select "a single Buffer Object" from the "File In" node settings<br>
<br>
Options for output : <br>
possible msg.topic values to be received are : <br>
<b>"c2d" :</b> Cloud to Device messages. These are like telemetry messages but coming from the cloud.<br>
<b>"customMethod" :</b> These are function calls where the device can receive, and send a response in return. To send the responses you need to use the custom method response node.<br>
<b>"twinUpdate" :</b>Receive desired properties information from Digital Factory. A message will be received with a payload object of desired properties every time a connection is made or a change on the desired properties is applied from the cloud.<br>
</p>
</script>