@gotillit/tillit-node-red 1.1.13 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nodes/node-api.d.ts +2 -0
- package/dist/nodes/node-api.js +124 -0
- package/dist/nodes/node-api.js.map +1 -0
- package/dist/nodes/node-broker.d.ts +16 -0
- package/dist/nodes/node-broker.js +96 -0
- package/dist/nodes/node-broker.js.map +1 -0
- package/dist/nodes/node-event.d.ts +2 -0
- package/dist/nodes/node-event.js +138 -0
- package/dist/nodes/node-event.js.map +1 -0
- package/dist/nodes/node-in.d.ts +2 -0
- package/dist/nodes/node-in.js +85 -0
- package/dist/nodes/node-in.js.map +1 -0
- package/dist/nodes/node-out.d.ts +2 -0
- package/dist/nodes/node-out.js +79 -0
- package/dist/nodes/node-out.js.map +1 -0
- package/dist/nodes/node-progress.d.ts +2 -0
- package/dist/nodes/node-progress.js +88 -0
- package/dist/nodes/node-progress.js.map +1 -0
- package/dist/nodes/node-pv.d.ts +2 -0
- package/dist/nodes/node-pv.js +96 -0
- package/dist/nodes/node-pv.js.map +1 -0
- package/dist/shared/types.d.ts +12 -0
- package/dist/tillit-node.html +247 -9
- package/dist/tillit-node.js +14 -330
- package/dist/tillit-node.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildNodeProgressFunction = void 0;
|
|
4
|
+
var buildNodeProgressFunction = function (RED) { return (function awsMqttNodeProgress(n) {
|
|
5
|
+
RED.nodes.createNode(this, n);
|
|
6
|
+
this.connection = RED.nodes.getNode(n.device);
|
|
7
|
+
this.broker = this.connection.broker;
|
|
8
|
+
this.assetId = n.assetId;
|
|
9
|
+
var self = this;
|
|
10
|
+
var options = {
|
|
11
|
+
qos: 0
|
|
12
|
+
};
|
|
13
|
+
self.on("input", function (msg) {
|
|
14
|
+
try {
|
|
15
|
+
if (self.broker) {
|
|
16
|
+
self.broker.connect(msg.clientId, msg.reconnect, function (event, error) {
|
|
17
|
+
if ((event == "connected")) {
|
|
18
|
+
var topic = "$aws/rules/".concat(self.broker.environment, "_edge_data/").concat(self.broker.tenant, "/").concat(self.broker.clientId, "/order-progress");
|
|
19
|
+
var finalPayload = {
|
|
20
|
+
format: 'json', body: [Object.assign({
|
|
21
|
+
assetId: (1 * self.assetId > 0) ? (1 * self.assetId > 0) : msg.topic * 1,
|
|
22
|
+
timestamp: new Date().toISOString()
|
|
23
|
+
}, msg.payload)]
|
|
24
|
+
};
|
|
25
|
+
self.log("SEND> " + topic + ' ' + JSON.stringify(finalPayload));
|
|
26
|
+
var buffer = new Buffer(JSON.stringify(finalPayload), "utf-8");
|
|
27
|
+
self.status({
|
|
28
|
+
fill: "blue",
|
|
29
|
+
shape: "ring",
|
|
30
|
+
text: "sending..."
|
|
31
|
+
});
|
|
32
|
+
try {
|
|
33
|
+
self.broker.mqttClient.publish(topic, buffer, options.qos, false).then(function (result, error) {
|
|
34
|
+
if (error) {
|
|
35
|
+
self.status({
|
|
36
|
+
fill: "red",
|
|
37
|
+
shape: "ring",
|
|
38
|
+
text: error.message
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
self.status({
|
|
43
|
+
fill: "green",
|
|
44
|
+
shape: "ring",
|
|
45
|
+
text: "done"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
self.status({
|
|
52
|
+
fill: "red",
|
|
53
|
+
shape: "ring",
|
|
54
|
+
text: e.message
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (event == 'error') {
|
|
59
|
+
self.error("connection error");
|
|
60
|
+
self.status({
|
|
61
|
+
fill: "red",
|
|
62
|
+
shape: "ring",
|
|
63
|
+
text: "connection error"
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
self.error("connection is not configured");
|
|
70
|
+
self.status({
|
|
71
|
+
fill: "red",
|
|
72
|
+
shape: "ring",
|
|
73
|
+
text: "not configured"
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
self.error("something went wrong", e);
|
|
79
|
+
self.status({
|
|
80
|
+
fill: "red",
|
|
81
|
+
shape: "ring",
|
|
82
|
+
text: e.message
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}); };
|
|
87
|
+
exports.buildNodeProgressFunction = buildNodeProgressFunction;
|
|
88
|
+
//# sourceMappingURL=node-progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-progress.js","sourceRoot":"","sources":["../../src/nodes/node-progress.ts"],"names":[],"mappings":";;;AAEO,IAAM,yBAAyB,GAAG,UAAC,GAAQ,IAAK,OAAA,CACnD,SAAS,mBAAmB,CAAC,CAAW;IACpC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9B,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC9C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;IACrC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;IACzB,IAAM,IAAI,GAAG,IAAI,CAAC;IAClB,IAAM,OAAO,GAAG;QACZ,GAAG,EAAE,CAAC;KACT,CAAC;IAEF,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,GAAQ;QAC/B,IAAI;YACA,IAAI,IAAI,CAAC,MAAM,EAAE;gBACb,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,SAAS,EA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2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildNodePvFunction = void 0;
|
|
4
|
+
var buildNodePvFunction = function (RED) { return (function awsMqttNodePv(n) {
|
|
5
|
+
RED.nodes.createNode(this, n);
|
|
6
|
+
this.myDevice = n.device;
|
|
7
|
+
this.configuration = RED.nodes.getNode(this.myDevice);
|
|
8
|
+
this.broker = this.configuration.broker;
|
|
9
|
+
var self = this;
|
|
10
|
+
var options = {
|
|
11
|
+
qos: 0
|
|
12
|
+
};
|
|
13
|
+
this.dataType = n.dataType;
|
|
14
|
+
var body = {
|
|
15
|
+
assetId: +n.assetId,
|
|
16
|
+
processVariableId: +n.processVariableId,
|
|
17
|
+
timestamp: new Date().toISOString()
|
|
18
|
+
};
|
|
19
|
+
self.on("input", function (msg) {
|
|
20
|
+
if (self.broker) {
|
|
21
|
+
self.broker.connect(msg.clientId, msg.reconnect, function (event, error) {
|
|
22
|
+
if ((event == "connected")) {
|
|
23
|
+
var topic = "$aws/rules/".concat(self.broker.environment, "_edge_data/").concat(self.broker.tenant, "/").concat(self.broker.clientId, "/timeseries");
|
|
24
|
+
if (body.assetId < 1)
|
|
25
|
+
body.assetId = msg.topic;
|
|
26
|
+
var payload = void 0;
|
|
27
|
+
if (typeof msg.payload === 'object') {
|
|
28
|
+
body = Object.assign(body, msg.payload);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
if (self.dataType === 'number') {
|
|
32
|
+
body['numericValue'] = msg.payload;
|
|
33
|
+
}
|
|
34
|
+
else if (self.dataType === 'string') {
|
|
35
|
+
body['stringValue'] = msg.payload;
|
|
36
|
+
}
|
|
37
|
+
else if (self.dataType === 'boolean') {
|
|
38
|
+
body['booleanValue'] = msg.payload;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
var finalPayload = { format: 'json', body: [body] };
|
|
42
|
+
self.log("SEND> " + topic + ' ' + JSON.stringify(finalPayload));
|
|
43
|
+
var buffer = new Buffer(JSON.stringify(finalPayload), "utf-8");
|
|
44
|
+
self.status({
|
|
45
|
+
fill: "blue",
|
|
46
|
+
shape: "ring",
|
|
47
|
+
text: "sending..."
|
|
48
|
+
});
|
|
49
|
+
try {
|
|
50
|
+
self.broker.mqttClient.publish(topic, buffer, options.qos, false).then(function (result, error) {
|
|
51
|
+
if (error) {
|
|
52
|
+
self.status({
|
|
53
|
+
fill: "red",
|
|
54
|
+
shape: "ring",
|
|
55
|
+
text: error.message
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
self.status({
|
|
60
|
+
fill: "green",
|
|
61
|
+
shape: "ring",
|
|
62
|
+
text: "done"
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
self.status({
|
|
69
|
+
fill: "red",
|
|
70
|
+
shape: "ring",
|
|
71
|
+
text: e.message
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (event == 'error') {
|
|
76
|
+
self.error("connection error");
|
|
77
|
+
self.status({
|
|
78
|
+
fill: "red",
|
|
79
|
+
shape: "ring",
|
|
80
|
+
text: "connection error"
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
self.error("connection is not configured");
|
|
87
|
+
self.status({
|
|
88
|
+
fill: "red",
|
|
89
|
+
shape: "ring",
|
|
90
|
+
text: "not configured"
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}); };
|
|
95
|
+
exports.buildNodePvFunction = buildNodePvFunction;
|
|
96
|
+
//# sourceMappingURL=node-pv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-pv.js","sourceRoot":"","sources":["../../src/nodes/node-pv.ts"],"names":[],"mappings":";;;AAEO,IAAM,mBAAmB,GAAG,UAAC,GAAQ,IAAK,OAAA,CAC7C,SAAS,aA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,CAAC;6BACN;iCAAM;gCACH,IAAI,CAAC,MAAM,CAAC;oCACR,IAAI,EAAE,OAAO;oCACb,KAAK,EAAE,MAAM;oCACb,IAAI,EAAE,MAAM;iCACf,CAAC,CAAC;6BACN;wBACL,CAAC,CAAC,CAAC;qBACN;oBAAC,OAAO,CAAC,EAAE;wBACR,IAAI,CAAC,MAAM,CAAC;4BACR,IAAI,EAAE,KAAK;4BACX,KAAK,EAAE,MAAM;4BACb,IAAI,EAAE,CAAC,CAAC,OAAO;yBAClB,CAAC,CAAC;qBACN;iBACJ;gBACD,IAAI,KAAK,IAAI,OAAO,EAAC;oBACjB,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;oBAC/B,IAAI,CAAC,MAAM,CAAC;wBACR,IAAI,EAAE,KAAK;wBACX,KAAK,EAAE,MAAM;wBACb,IAAI,EAAE,kBAAkB;qBAC3B,CAAC,CAAC;iBACN;YACL,CAAC,CAAC,CAAC;SACN;aAAM;YACH,IAAI,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;YAC5C,IAAI,CAAC,MAAM,CAAC;gBACR,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,gBAAgB;aACzB,CAAC,CAAC;SACN;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,EArF2C,CAqF3C,CAAA;AArFO,QAAA,mBAAmB,uBAqF1B"}
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -24,6 +24,18 @@ export interface TilliTOut {
|
|
|
24
24
|
qos: string;
|
|
25
25
|
device: string;
|
|
26
26
|
}
|
|
27
|
+
export interface TilliTPv {
|
|
28
|
+
device: string;
|
|
29
|
+
assetId: number;
|
|
30
|
+
processVariableId: number;
|
|
31
|
+
dataType: string;
|
|
32
|
+
}
|
|
33
|
+
export interface TilliTEvent {
|
|
34
|
+
device: string;
|
|
35
|
+
assetId: number;
|
|
36
|
+
eventTypeId: number;
|
|
37
|
+
subtitle: string;
|
|
38
|
+
}
|
|
27
39
|
export interface ApiCallNodeDef extends TilliTConnection {
|
|
28
40
|
endpoint: string;
|
|
29
41
|
method: 'POST' | 'GET' | 'PUT' | 'DELETE';
|
package/dist/tillit-node.html
CHANGED
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
category : 'config',
|
|
59
59
|
defaults : {
|
|
60
60
|
name : {
|
|
61
|
-
value : "",
|
|
61
|
+
value : "tillit",
|
|
62
62
|
required : true
|
|
63
63
|
},
|
|
64
64
|
thingId : {
|
|
@@ -128,10 +128,10 @@
|
|
|
128
128
|
RED.nodes.registerType('tillit-out', {
|
|
129
129
|
category : 'tillit',
|
|
130
130
|
color : "#747ee2",
|
|
131
|
-
paletteLabel: '
|
|
131
|
+
paletteLabel: 'publish',
|
|
132
132
|
defaults : {
|
|
133
133
|
name: {
|
|
134
|
-
|
|
134
|
+
value: 'publish'
|
|
135
135
|
},
|
|
136
136
|
device : {
|
|
137
137
|
type : "tillit-node-connection",
|
|
@@ -187,8 +187,11 @@
|
|
|
187
187
|
RED.nodes.registerType('tillit-in', {
|
|
188
188
|
category : 'tillit',
|
|
189
189
|
color : "#747ee2",
|
|
190
|
-
paletteLabel: '
|
|
190
|
+
paletteLabel: 'subscribe',
|
|
191
191
|
defaults : {
|
|
192
|
+
name:{
|
|
193
|
+
value: 'subscribe'
|
|
194
|
+
},
|
|
192
195
|
device : {
|
|
193
196
|
type : "tillit-node-connection",
|
|
194
197
|
required : true
|
|
@@ -252,7 +255,7 @@
|
|
|
252
255
|
<script type="text/javascript">
|
|
253
256
|
RED.nodes.registerType('tillit-api', {
|
|
254
257
|
category : 'tillit',
|
|
255
|
-
paletteLabel: '
|
|
258
|
+
paletteLabel: 'api call',
|
|
256
259
|
color : "#747ee2",
|
|
257
260
|
defaults : {
|
|
258
261
|
device : {
|
|
@@ -260,7 +263,7 @@
|
|
|
260
263
|
required : true
|
|
261
264
|
},
|
|
262
265
|
name : {
|
|
263
|
-
value: '
|
|
266
|
+
value: 'api'
|
|
264
267
|
},
|
|
265
268
|
endpoint : {
|
|
266
269
|
value : "core/assets"
|
|
@@ -273,11 +276,246 @@
|
|
|
273
276
|
outputs : 2,
|
|
274
277
|
icon : "white-globe.png",
|
|
275
278
|
align : "left",
|
|
276
|
-
label
|
|
279
|
+
label: function () {
|
|
277
280
|
var dbNode = RED.nodes.node(this.device);
|
|
278
|
-
return this.name || (
|
|
281
|
+
return this.name || (dbNode ? dbNode.label() : this.name);
|
|
279
282
|
},
|
|
280
|
-
labelStyle
|
|
283
|
+
labelStyle: function () {
|
|
284
|
+
return this.name ? "node_label_italic" : "";
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
</script>
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
<script type="text/x-red" data-help-name="tillit-pv">
|
|
291
|
+
<p>Publishes <b>msg.payload</b> to update the value of a process variable</p>
|
|
292
|
+
<p>msg.payload will be used as the value, respecting the data type selected</p>
|
|
293
|
+
<p>msg.topic will be used as assetId if you leave the configuration blank</p>
|
|
294
|
+
<p>For more information visit our help documentation: <a href="https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/connecting-to-tillit/mqtt/publish-timeseries" target="blank">Open</a>
|
|
295
|
+
|
|
296
|
+
</script>
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
<script type="text/x-red" data-template-name="tillit-pv">
|
|
300
|
+
<div class="form-row">
|
|
301
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
302
|
+
<input type="text" id="node-input-device">
|
|
303
|
+
</div>
|
|
304
|
+
|
|
305
|
+
<div class="form-row">
|
|
306
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
307
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
308
|
+
</div>
|
|
309
|
+
|
|
310
|
+
<div class="form-row">
|
|
311
|
+
<label for="node-input-assetId"><i class="fa fa-tag"></i> Asset Id</label>
|
|
312
|
+
<input type="text" id="node-input-assetId" placeholder="will use msg.topic if blank">
|
|
313
|
+
</div>
|
|
314
|
+
|
|
315
|
+
<div class="form-row">
|
|
316
|
+
<label for="node-input-processVariableId"><i class="fa fa-tag"></i> Process Variable Id</label>
|
|
317
|
+
<input type="text" id="node-input-processVariableId" placeholder="">
|
|
318
|
+
</div>
|
|
319
|
+
|
|
320
|
+
<div class="form-row">
|
|
321
|
+
<label for="node-input-dataType"><i class="fa fa-tag"></i>Data Type</label>
|
|
322
|
+
<select id="node-input-dataType" style="width:125px !important">
|
|
323
|
+
<option value="number">NUMBER</option>
|
|
324
|
+
<option value="string">STRING</option>
|
|
325
|
+
<option value="boolean">BOOLEAN</option>
|
|
326
|
+
</select>
|
|
327
|
+
</div>
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
</script>
|
|
331
|
+
|
|
332
|
+
<script type="text/javascript">
|
|
333
|
+
RED.nodes.registerType('tillit-pv', {
|
|
334
|
+
category: 'tillit',
|
|
335
|
+
color: "#747ee2",
|
|
336
|
+
paletteLabel: 'process variable',
|
|
337
|
+
defaults: {
|
|
338
|
+
name: {
|
|
339
|
+
value: 'process variable'
|
|
340
|
+
},
|
|
341
|
+
device: {
|
|
342
|
+
type: "tillit-node-connection",
|
|
343
|
+
required: true
|
|
344
|
+
},
|
|
345
|
+
processVariableId: {},
|
|
346
|
+
assetId: {},
|
|
347
|
+
dataType: {
|
|
348
|
+
value: 'number'
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
inputs: 1,
|
|
352
|
+
outputs: 0,
|
|
353
|
+
icon: "bridge.png",
|
|
354
|
+
align: "right",
|
|
355
|
+
label: function () {
|
|
356
|
+
var dbNode = RED.nodes.node(this.device);
|
|
357
|
+
return this.name || (dbNode ? dbNode.label() : this.name);
|
|
358
|
+
},
|
|
359
|
+
labelStyle: function () {
|
|
360
|
+
return this.name ? "node_label_italic" : "";
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
</script>
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
<script type="text/x-red" data-help-name="tillit-event">
|
|
369
|
+
<p>Publishes <b>msg.payload</b> to raise an event</p>
|
|
370
|
+
<p>msg.topic can be used as assetId if you leave the node blank</p>
|
|
371
|
+
<p>msg.payload should be like the following example:</p>
|
|
372
|
+
<code>
|
|
373
|
+
{
|
|
374
|
+
assetId: number, //ID of the asset
|
|
375
|
+
timestamp: string, //Timestamp of the event
|
|
376
|
+
eventTypeId: number, //ID of the event to raise
|
|
377
|
+
orderId: number //The id of the order to raise event on (Optional)
|
|
378
|
+
orderNumber: string //The order number of the order to raise event on (Optional)
|
|
379
|
+
status: string //ACTIVE | SCHEDULED | COMPLETED (Optional)
|
|
380
|
+
subtitle: string //Set a description for the event (Optional)
|
|
381
|
+
}
|
|
382
|
+
</code>
|
|
383
|
+
This node will merge the settings from the node with the payload.
|
|
384
|
+
<p>For more information visit our help documentation: <a href="https://help.tillit.cloud/api/examples/raise-an-event-in-tillit" target="blank">Open</a>
|
|
385
|
+
|
|
386
|
+
</script>
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
<script type="text/x-red" data-template-name="tillit-event">
|
|
390
|
+
<div class="form-row">
|
|
391
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
392
|
+
<input type="text" id="node-input-device">
|
|
393
|
+
</div>
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
<div class="form-row">
|
|
397
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
398
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
399
|
+
</div>
|
|
400
|
+
|
|
401
|
+
<div class="form-row">
|
|
402
|
+
<label for="node-input-assetId"><i class="fa fa-tag"></i> Asset Id</label>
|
|
403
|
+
<input type="text" id="node-input-assetId" placeholder="Leave null and will use msg.topic or msg.payload.assetId">
|
|
404
|
+
</div>
|
|
405
|
+
|
|
406
|
+
<div class="form-row">
|
|
407
|
+
<label for="node-input-processVariableId"><i class="fa fa-tag"></i> Event Type Id</label>
|
|
408
|
+
<input type="text" id="node-input-eventTypeId" placeholder="Leave null and will use msg.payload.eventTypeId">
|
|
409
|
+
</div>
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
</script>
|
|
413
|
+
|
|
414
|
+
<script type="text/javascript">
|
|
415
|
+
RED.nodes.registerType('tillit-event', {
|
|
416
|
+
category: 'tillit',
|
|
417
|
+
color: "#747ee2",
|
|
418
|
+
paletteLabel: 'raise event',
|
|
419
|
+
defaults: {
|
|
420
|
+
name: {
|
|
421
|
+
value: 'raise event'
|
|
422
|
+
},
|
|
423
|
+
device: {
|
|
424
|
+
type: "tillit-node-connection",
|
|
425
|
+
required: true
|
|
426
|
+
},
|
|
427
|
+
eventTypeId: {},
|
|
428
|
+
assetId: {},
|
|
429
|
+
subtitle: {},
|
|
430
|
+
},
|
|
431
|
+
inputs: 1,
|
|
432
|
+
outputs: 1,
|
|
433
|
+
icon: "bridge.png",
|
|
434
|
+
align: "right",
|
|
435
|
+
label: function () {
|
|
436
|
+
var dbNode = RED.nodes.node(this.device);
|
|
437
|
+
return this.name || (dbNode ? dbNode.label() : this.name);
|
|
438
|
+
},
|
|
439
|
+
labelStyle: function () {
|
|
440
|
+
return this.name ? "node_label_italic" : "";
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
</script>
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
<script type="text/x-red" data-help-name="tillit-progress">
|
|
449
|
+
<p>Publishes <b>msg.payload</b> to update the asset progress</p>
|
|
450
|
+
<code>
|
|
451
|
+
[{
|
|
452
|
+
assetId: number,
|
|
453
|
+
orderId: number, //Is optional, if not supplied then the current running order is used.
|
|
454
|
+
timestamp: string,
|
|
455
|
+
totalCount: number,
|
|
456
|
+
rejectCount: number,
|
|
457
|
+
EQUIPMENT_STATUS_READY: boolean,
|
|
458
|
+
EQUIPMENT_STATUS_RUNNING: boolean,
|
|
459
|
+
EQUIPMENT_STATUS_STOPPED: boolean,
|
|
460
|
+
EQUIPMENT_STATUS_COMPLETE: boolean,
|
|
461
|
+
EQUIPMENT_STATUS_SUSPENDED: boolean,
|
|
462
|
+
EQUIPMENT_STATUS_ABORTED: boolean,
|
|
463
|
+
EQUIPMENT_STATUS_STARVED: boolean,
|
|
464
|
+
EQUIPMENT_STATUS_BLOCKED: boolean,
|
|
465
|
+
EQUIPMENT_STATUS_FAULTED: boolean,
|
|
466
|
+
downtimeReason: string,
|
|
467
|
+
reasonGroupId: number
|
|
468
|
+
}]
|
|
469
|
+
</code>
|
|
470
|
+
<p>msg.topic will be used as assetId if you leave the configuration blank</p>
|
|
471
|
+
<p>For more information visit our help documentation: <a href="https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/connecting-to-tillit/mqtt/publish-timeseries" target="blank">Open</a>
|
|
472
|
+
|
|
473
|
+
</script>
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
<script type="text/x-red" data-template-name="tillit-progress">
|
|
477
|
+
<div class="form-row">
|
|
478
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
479
|
+
<input type="text" id="node-input-device">
|
|
480
|
+
</div>
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
<div class="form-row">
|
|
484
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
485
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
486
|
+
</div>
|
|
487
|
+
|
|
488
|
+
<div class="form-row">
|
|
489
|
+
<label for="node-input-assetId"><i class="fa fa-tag"></i> Asset Id</label>
|
|
490
|
+
<input type="text" id="node-input-assetId" placeholder="will use msg.topic if blank">
|
|
491
|
+
</div>
|
|
492
|
+
|
|
493
|
+
</script>
|
|
494
|
+
|
|
495
|
+
<script type="text/javascript">
|
|
496
|
+
RED.nodes.registerType('tillit-progress', {
|
|
497
|
+
category: 'tillit',
|
|
498
|
+
color: "#747ee2",
|
|
499
|
+
paletteLabel: 'progress',
|
|
500
|
+
defaults: {
|
|
501
|
+
name: {
|
|
502
|
+
value: 'progress'
|
|
503
|
+
},
|
|
504
|
+
device: {
|
|
505
|
+
type: "tillit-node-connection",
|
|
506
|
+
required: true
|
|
507
|
+
},
|
|
508
|
+
assetId: {},
|
|
509
|
+
},
|
|
510
|
+
inputs: 1,
|
|
511
|
+
outputs: 0,
|
|
512
|
+
icon: "bridge.png",
|
|
513
|
+
align: "right",
|
|
514
|
+
label: function () {
|
|
515
|
+
var dbNode = RED.nodes.node(this.device);
|
|
516
|
+
return this.name || (dbNode ? dbNode.label() : this.name);
|
|
517
|
+
},
|
|
518
|
+
labelStyle: function () {
|
|
281
519
|
return this.name ? "node_label_italic" : "";
|
|
282
520
|
}
|
|
283
521
|
});
|