-
Notifications
You must be signed in to change notification settings - Fork 0
/
ngest_formatter.html
61 lines (59 loc) · 1.64 KB
/
ngest_formatter.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<script type="text/javascript">
RED.nodes.registerType('nGest Formatter', {
category: 'ndustrialio',
color: '#99be40',
defaults: {
name: { value: "" }
},
inputs: 1,
outputs: 1,
icon: "feeds_icon2x.png",
label: function () {
return this.name || "nGest Formatter";
}
});
</script>
<script type="text/x-red" data-template-name="nGest Formatter">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i>Name</label>
<input type="text" id="node-input-name" placeholder="nGest Formatter">
</div>
</script>
<script type="text/x-red" data-help-name="nGest Formatter">
<p>A simple node that converts an array of objects into ndustrial.io's nGest formant</p>
<p>Expected Input:</p>
<pre>
msg.payload : array[2]
array[2]
0: object
name: "switch1"
value: "true"
1: object
name: "switch2"
value: "true"
</pre>
<p>To a message payload into the nGest format</p>
<p>nGest Output</p>
<pre>
msg.payload : Object
object
type: "timeseries"
data: array[2]
0: object
timestamp: "1571748448099"
data: object
switch1: object
value: "false"
1: object
timestamp: "1571748448099"
data: object
switch2: object
value: "true"
</pre>
<p>To join several inputs use 'join' and manually join by array</p>
<p> Then flatten the array with a function node:</p>
<pre>
msg.payload = [].concat.apply([],msg.payload);
return msg;
</pre>
</script>