@gotillit/tillit-node-red 1.2.41 → 1.2.51
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/tillit-node.html +308 -223
- package/package.json +1 -1
package/dist/tillit-node.html
CHANGED
|
@@ -1,62 +1,83 @@
|
|
|
1
|
-
|
|
2
1
|
<script type="text/javascript">
|
|
3
|
-
console.log('Registring plugin html')
|
|
4
|
-
RED.plugins.registerPlugin("node-red-tillit", {
|
|
5
|
-
onadd: function() {
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
function populateDropdown(deviceId, elementId, entity, selectedId) {
|
|
4
|
+
const domElement = document.getElementById(elementId);
|
|
5
|
+
|
|
6
|
+
$.ajax({
|
|
7
|
+
url: `/tillit/${deviceId}/${entity}`,
|
|
8
|
+
type: "GET",
|
|
9
|
+
success: function (data) {
|
|
10
|
+
console.log(data)
|
|
11
|
+
const items = JSON.parse(data);
|
|
12
|
+
console.log(selectedId)
|
|
13
|
+
items.sort((a, b) => a.name < b.name ? -1 : 1).forEach(function (item) {
|
|
14
|
+
const option = document.createElement('option');
|
|
15
|
+
option.value = item.id;
|
|
16
|
+
option.text = item.name;
|
|
17
|
+
option.selected = item.id == selectedId
|
|
18
|
+
console.log(option.selected)
|
|
19
|
+
domElement.appendChild(option);
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
error: function (jqXHR, textStatus, errorThrown) {
|
|
23
|
+
console.log(jqXHR, textStatus, errorThrown);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
8
29
|
</script>
|
|
9
30
|
|
|
10
31
|
<script type="text/x-red" data-template-name="tillit-node-connection">
|
|
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
|
-
|
|
32
|
+
<div class="form-row">
|
|
33
|
+
<label for="node-config-input-name"><i class="fa fa-globe"></i>Name</label>
|
|
34
|
+
<input type="text" id="node-config-input-name" placeholder="Name">
|
|
35
|
+
</div>
|
|
36
|
+
<div class="form-row">
|
|
37
|
+
<label for="node-config-input-thingId"><i class="fa fa-tag"></i> Thing ID</label>
|
|
38
|
+
<input type="text" id="node-config-input-thingId" placeholder="Thing ID">
|
|
39
|
+
</div>
|
|
40
|
+
<div class="form-row">
|
|
41
|
+
<label for="node-config-input-environment"><i class="fa fa-tag"></i> Environment</label>
|
|
42
|
+
<input type="text" id="node-config-input-environment" placeholder="TilliT Environment">
|
|
43
|
+
</div>
|
|
44
|
+
<div class="form-row">
|
|
45
|
+
<label for="node-config-input-endpoint"><i class="fa fa-tag"></i> Tenant</label>
|
|
46
|
+
<input type="text" id="node-config-input-tenant" placeholder="Tenant name">
|
|
47
|
+
</div>
|
|
48
|
+
<div class="form-row">
|
|
49
|
+
<label for="node-config-input-privKey"><i class="fa fa-tag"></i> Private key</label>
|
|
50
|
+
<input type="text" id="node-config-input-privKey"></input>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div class="form-row">
|
|
54
|
+
<label for="node-config-input-thingCert"><i class="fa fa-tag"></i> Thing cert</label>
|
|
55
|
+
<input type="text" id="node-config-input-thingCert"></input>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<div class="form-row">
|
|
59
|
+
<label for="node-config-input-rootCa"><i class="fa fa-tag"></i> Root CA</label>
|
|
60
|
+
<input type="text" id="node-config-input-rootCa"></input>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
<div class="form-row">
|
|
65
|
+
<label for="node-config-input-username"><i class="fa fa-tag"></i> Username</label>
|
|
66
|
+
<input type="text" id="node-config-input-username"></input>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<div class="form-row">
|
|
70
|
+
<label for="node-config-input-password"><i class="fa fa-tag"></i> Password</label>
|
|
71
|
+
<input type="password" id="node-config-input-password"></input>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<div class="form-tips">
|
|
75
|
+
<p><b>Secret:</b> Using environment variables:</p>
|
|
76
|
+
<p>
|
|
77
|
+
You can override any of these settings using environment variables. Recommended for production deployment.
|
|
78
|
+
Use: USERNAME, PASSWORD, TENANT, ENVIRONMENT, THING_CERT, PRIV_KEY, ROOT_CA
|
|
79
|
+
</p>
|
|
80
|
+
</div>
|
|
60
81
|
</script>
|
|
61
82
|
|
|
62
83
|
<!-- MQTT Broker Configuration -->
|
|
@@ -104,32 +125,32 @@
|
|
|
104
125
|
</script>
|
|
105
126
|
|
|
106
127
|
<script type="text/x-red" data-template-name="tillit-out">
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
128
|
+
<div class="form-row">
|
|
129
|
+
<label for="node-input-name"><i class="fa fa-globe"></i> Name</label>
|
|
130
|
+
<input type="text" id="node-input-name">
|
|
131
|
+
</div>
|
|
132
|
+
<div class="form-row">
|
|
133
|
+
<label for="node-input-device"><i class="fa fa-globe"></i> Connection</label>
|
|
134
|
+
<input type="text" id="node-input-device">
|
|
135
|
+
</div>
|
|
136
|
+
<div class="form-row">
|
|
137
|
+
<label for="node-input-topic"><i class="fa fa-globe"></i> Topic</label>
|
|
138
|
+
<input type="text" id="node-input-topic">
|
|
139
|
+
</div>
|
|
140
|
+
<div class="form-row">
|
|
141
|
+
<label for="node-input-qos"><i class="fa fa-empire"></i> <span> QoS</span></label>
|
|
142
|
+
<select id="node-input-qos" style="width:125px !important">
|
|
143
|
+
<option value="0">0</option>
|
|
144
|
+
<option value="1">1</option>
|
|
145
|
+
</select>
|
|
146
|
+
</div>
|
|
126
147
|
</script>
|
|
127
148
|
|
|
128
149
|
<script type="text/x-red" data-help-name="tillit-out">
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
150
|
+
<p>Connects to a TilliT's MQTT broker and publishes <b>msg.payload</b> either to the <b>msg.topic</b> or to the topic specified in the edit window. The value in the edit window has precedence.</p>
|
|
151
|
+
<p>Likewise QoS and/or retain values in the edit panel will overwrite any <b>msg.qos</b> and <b>msg.retain</b> properties. If nothing is set they default to <i>0</i> and <i>false</i> respectively.</p>
|
|
152
|
+
<p>If <b>msg.payload</b> contains an object it will be stringified before being sent.</p>
|
|
153
|
+
<p>For more information visit our help documentation: <a href="https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/connecting-to-tillit/mqtt" target="blank">Open</a>
|
|
133
154
|
</script>
|
|
134
155
|
|
|
135
156
|
<script type="text/javascript">
|
|
@@ -168,27 +189,27 @@
|
|
|
168
189
|
</script>
|
|
169
190
|
|
|
170
191
|
<script type="text/x-red" data-template-name="tillit-in">
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
192
|
+
<div class="form-row">
|
|
193
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
194
|
+
<input type="text" id="node-input-device">
|
|
195
|
+
</div>
|
|
196
|
+
|
|
197
|
+
<div class="form-row">
|
|
198
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
199
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
200
|
+
</div>
|
|
201
|
+
<div class="form-row">
|
|
202
|
+
<label for="node-input-topic"><i class="fa fa-tag"></i> Topic</label>
|
|
203
|
+
<input type="text" id="node-input-topic" placeholder="Topic">
|
|
204
|
+
</div>
|
|
184
205
|
</script>
|
|
185
206
|
|
|
186
207
|
<script type="text/x-red" data-help-name="tillit-in">
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
208
|
+
<p>TillliT MQTT input node. Connects to a broker and subscribes to the specified topic. The topic may contain MQTT wildcards.</p>
|
|
209
|
+
<p>Topic needs to start with your tenant. To subscribe to all messages from your account, do {tenant}/#</p>
|
|
210
|
+
<p>Outputs an object called <b>msg</b> containing <b>msg.topic, msg.payload, msg.qos</b> and <b>msg.retain</b>.</p>
|
|
211
|
+
<p><b>msg.payload</b> is usually a string, but can also be a binary buffer.</p>
|
|
212
|
+
<p>For more information visit our help documentation: <a href="https://help.tillit.cloud/tillit/knowledge-base/setting-up-tillit/connecting-to-tillit/mqtt" target="blank">Open</a>
|
|
192
213
|
</script>
|
|
193
214
|
|
|
194
215
|
<script type="text/javascript">
|
|
@@ -223,41 +244,39 @@
|
|
|
223
244
|
</script>
|
|
224
245
|
|
|
225
246
|
|
|
226
|
-
|
|
227
|
-
|
|
228
247
|
<script type="text/x-red" data-template-name="tillit-api">
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
<div class="form-row">
|
|
249
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
250
|
+
<input type="text" id="node-input-device">
|
|
251
|
+
</div>
|
|
252
|
+
|
|
253
|
+
<div class="form-row">
|
|
254
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
255
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
256
|
+
</div>
|
|
257
|
+
<div class="form-row">
|
|
258
|
+
<label for="node-input-endpoint"><i class="fa fa-tag"></i> Endpoint</label>
|
|
259
|
+
<input type="text" id="node-input-endpoint" placeholder="Endpoint">
|
|
260
|
+
</div>
|
|
261
|
+
<div class="form-row">
|
|
262
|
+
<label for="node-input-method"><i class="fa fa-empire"></i> <span> Method</span></label>
|
|
263
|
+
<select id="node-input-method" style="width:125px !important">
|
|
264
|
+
<option value="GET">GET</option>
|
|
265
|
+
<option value="POST">POST</option>
|
|
266
|
+
<option value="PUT">PUT</option>
|
|
267
|
+
<option value="DELETE">DELETE</option>
|
|
268
|
+
</select>
|
|
269
|
+
</div>
|
|
251
270
|
</script>
|
|
252
271
|
|
|
253
272
|
<script type="text/x-red" data-help-name="tillit-api">
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
273
|
+
<p>An easy way for you to use the TilliT API from Node-red</p>
|
|
274
|
+
<p>Set your endpoint and method here.</p>
|
|
275
|
+
<p>Endpoint can be substituted by msg.endpoint</p>
|
|
276
|
+
<p><b>msg.payload</b> is expected to be a json and will be the body on POST and PUT calls</p>
|
|
277
|
+
<p><b>output 1</b> is the return of the call in case of success</p>
|
|
278
|
+
<p><b>output 2</b> is the error body in case of failure</p>
|
|
279
|
+
<p>For more information visit our help documentation: <a href="https://help.tillit.cloud/api/api/overview" target="blank">Open</a>
|
|
261
280
|
</script>
|
|
262
281
|
|
|
263
282
|
<script type="text/javascript">
|
|
@@ -296,42 +315,46 @@
|
|
|
296
315
|
|
|
297
316
|
|
|
298
317
|
<script type="text/x-red" data-help-name="tillit-pv">
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
318
|
+
<p>Publishes <b>msg.payload</b> to update the value of a process variable</p>
|
|
319
|
+
<p>msg.payload will be used as the value, respecting the data type selected</p>
|
|
320
|
+
<p>msg.topic will be used as assetId if you leave the configuration blank</p>
|
|
321
|
+
<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>
|
|
303
322
|
|
|
304
323
|
</script>
|
|
305
324
|
|
|
306
325
|
|
|
307
326
|
<script type="text/x-red" data-template-name="tillit-pv">
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
327
|
+
<div class="form-row">
|
|
328
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
329
|
+
<input type="text" id="node-input-device">
|
|
330
|
+
</div>
|
|
312
331
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
332
|
+
<div class="form-row">
|
|
333
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
334
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
335
|
+
</div>
|
|
317
336
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
337
|
+
<div class="form-row">
|
|
338
|
+
<label for="node-input-assetId"><i class="fa fa-tag"></i> Asset </label>
|
|
339
|
+
<select id="node-input-assetId" placeholder="will use msg.topic if blank">
|
|
340
|
+
<option></option>
|
|
341
|
+
</select>
|
|
342
|
+
</div>
|
|
322
343
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
344
|
+
<div class="form-row">
|
|
345
|
+
<label for="node-input-processVariableId"><i class="fa fa-tag"></i> Process Variable </label>
|
|
346
|
+
<select id="node-input-processVariableId" placeholder="">
|
|
347
|
+
<option></option>
|
|
348
|
+
</select>
|
|
349
|
+
</div>
|
|
327
350
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
351
|
+
<div class="form-row">
|
|
352
|
+
<label for="node-input-dataType"><i class="fa fa-tag"></i>Data Type</label>
|
|
353
|
+
<select id="node-input-dataType" style="width:125px !important">
|
|
354
|
+
<option value="number">NUMBER</option>
|
|
355
|
+
<option value="string">STRING</option>
|
|
356
|
+
<option value="boolean">BOOLEAN</option>
|
|
357
|
+
</select>
|
|
335
358
|
</div>
|
|
336
359
|
|
|
337
360
|
|
|
@@ -366,55 +389,77 @@
|
|
|
366
389
|
},
|
|
367
390
|
labelStyle: function () {
|
|
368
391
|
return this.name ? "node_label_italic" : "";
|
|
392
|
+
}, oneditprepare: function () {
|
|
393
|
+
const self = this;
|
|
394
|
+
|
|
395
|
+
function prepareForm() {
|
|
396
|
+
populateDropdown(self.device, 'node-input-assetId', 'assets', self.assetId);
|
|
397
|
+
populateDropdown(self.device, 'node-input-processVariableId', 'process-variables', self.assetId);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
console.log('oneditprepare')
|
|
401
|
+
$('#node-input-device').change(function () {
|
|
402
|
+
// handle change event here
|
|
403
|
+
prepareForm();
|
|
404
|
+
});
|
|
405
|
+
setTimeout(() => {
|
|
406
|
+
if (!$('#node-input-device').val()) {
|
|
407
|
+
return
|
|
408
|
+
}
|
|
409
|
+
prepareForm();
|
|
410
|
+
}, 100)
|
|
411
|
+
|
|
369
412
|
}
|
|
370
413
|
});
|
|
371
414
|
</script>
|
|
372
415
|
|
|
373
416
|
|
|
374
|
-
|
|
375
|
-
|
|
376
417
|
<script type="text/x-red" data-help-name="tillit-event">
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
418
|
+
<p>Publishes <b>msg.payload</b> to raise an event</p>
|
|
419
|
+
<p>msg.topic can be used as assetId if you leave the node blank</p>
|
|
420
|
+
<p>msg.payload should be like the following example:</p>
|
|
421
|
+
<code>
|
|
422
|
+
{
|
|
423
|
+
assetId: number, //ID of the asset
|
|
424
|
+
timestamp: string, //Timestamp of the event
|
|
425
|
+
eventTypeId: number, //ID of the event to raise
|
|
426
|
+
orderId: number //The id of the order to raise event on (Optional)
|
|
427
|
+
orderNumber: string //The order number of the order to raise event on (Optional)
|
|
428
|
+
status: string //ACTIVE | SCHEDULED | COMPLETED (Optional)
|
|
429
|
+
subtitle: string //Set a description for the event (Optional)
|
|
389
430
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
431
|
+
</code>
|
|
432
|
+
This node will merge the settings from the node with the payload.
|
|
433
|
+
<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>
|
|
393
434
|
|
|
394
435
|
</script>
|
|
395
436
|
|
|
396
437
|
|
|
397
438
|
<script type="text/x-red" data-template-name="tillit-event">
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
439
|
+
<div class="form-row">
|
|
440
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
441
|
+
<input type="text" id="node-input-device">
|
|
442
|
+
</div>
|
|
402
443
|
|
|
403
444
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
445
|
+
<div class="form-row">
|
|
446
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
447
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
448
|
+
</div>
|
|
408
449
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
450
|
+
<div class="form-row">
|
|
451
|
+
<label for="node-input-assetId"><i class="fa fa-tag"></i>Asset</label>
|
|
452
|
+
<select id="node-input-assetId" placeholder="Leave null and will use msg.topic or msg.payload.assetId">
|
|
453
|
+
<option></option>
|
|
454
|
+
</select>
|
|
455
|
+
</div>
|
|
413
456
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
457
|
+
<div class="form-row">
|
|
458
|
+
<label for="node-input-processVariableId"><i class="fa fa-tag"></i> Event Type</label>
|
|
459
|
+
<select id="node-input-eventTypeId" placeholder="Leave null and will use msg.payload.eventTypeId">
|
|
460
|
+
<option></option>
|
|
461
|
+
</select>
|
|
462
|
+
</div>
|
|
418
463
|
|
|
419
464
|
|
|
420
465
|
</script>
|
|
@@ -446,57 +491,78 @@
|
|
|
446
491
|
},
|
|
447
492
|
labelStyle: function () {
|
|
448
493
|
return this.name ? "node_label_italic" : "";
|
|
494
|
+
}, oneditprepare: function () {
|
|
495
|
+
const self = this;
|
|
496
|
+
|
|
497
|
+
function prepareForm() {
|
|
498
|
+
populateDropdown(self.device, 'node-input-assetId', 'assets', self.assetId);
|
|
499
|
+
populateDropdown(self.device, 'node-input-eventTypeId', 'event-types', self.eventTypeId);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
console.log('oneditprepare')
|
|
503
|
+
$('#node-input-device').change(function () {
|
|
504
|
+
// handle change event here
|
|
505
|
+
prepareForm();
|
|
506
|
+
});
|
|
507
|
+
setTimeout(() => {
|
|
508
|
+
if (!$('#node-input-device').val()) {
|
|
509
|
+
return
|
|
510
|
+
}
|
|
511
|
+
prepareForm();
|
|
512
|
+
}, 100)
|
|
513
|
+
|
|
449
514
|
}
|
|
450
515
|
});
|
|
451
|
-
</script>
|
|
452
|
-
|
|
453
516
|
|
|
517
|
+
</script>
|
|
454
518
|
|
|
455
519
|
|
|
456
520
|
<script type="text/x-red" data-help-name="tillit-progress">
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
521
|
+
<p>Publishes <b>msg.payload</b> to update the asset progress</p>
|
|
522
|
+
<code>
|
|
523
|
+
[{
|
|
524
|
+
assetId: number,
|
|
525
|
+
orderId: number, //Is optional, if not supplied then the current running order is used.
|
|
526
|
+
timestamp: string,
|
|
527
|
+
totalCount: number,
|
|
528
|
+
rejectCount: number,
|
|
529
|
+
EQUIPMENT_STATUS_READY: boolean,
|
|
530
|
+
EQUIPMENT_STATUS_RUNNING: boolean,
|
|
531
|
+
EQUIPMENT_STATUS_STOPPED: boolean,
|
|
532
|
+
EQUIPMENT_STATUS_COMPLETE: boolean,
|
|
533
|
+
EQUIPMENT_STATUS_SUSPENDED: boolean,
|
|
534
|
+
EQUIPMENT_STATUS_ABORTED: boolean,
|
|
535
|
+
EQUIPMENT_STATUS_STARVED: boolean,
|
|
536
|
+
EQUIPMENT_STATUS_BLOCKED: boolean,
|
|
537
|
+
EQUIPMENT_STATUS_FAULTED: boolean,
|
|
538
|
+
downtimeReason: string,
|
|
539
|
+
reasonGroupId: number
|
|
540
|
+
}]
|
|
541
|
+
</code>
|
|
542
|
+
<p>msg.topic will be used as assetId if you leave the configuration blank</p>
|
|
543
|
+
<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>
|
|
480
544
|
|
|
481
545
|
</script>
|
|
482
546
|
|
|
483
547
|
|
|
484
548
|
<script type="text/x-red" data-template-name="tillit-progress">
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
549
|
+
<div class="form-row">
|
|
550
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
551
|
+
<input type="text" id="node-input-device">
|
|
552
|
+
</div>
|
|
489
553
|
|
|
490
554
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
555
|
+
<div class="form-row">
|
|
556
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
557
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
558
|
+
</div>
|
|
495
559
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
560
|
+
<div class="form-row">
|
|
561
|
+
<label for="node-input-assetId"><i class="fa fa-tag"></i> Asset</label>
|
|
562
|
+
<select id="node-input-assetId" placeholder="will use msg.topic if blank">
|
|
563
|
+
<option></option>
|
|
564
|
+
</select>
|
|
565
|
+
</div>
|
|
500
566
|
|
|
501
567
|
</script>
|
|
502
568
|
|
|
@@ -525,6 +591,25 @@
|
|
|
525
591
|
},
|
|
526
592
|
labelStyle: function () {
|
|
527
593
|
return this.name ? "node_label_italic" : "";
|
|
594
|
+
}, oneditprepare: function () {
|
|
595
|
+
const self = this;
|
|
596
|
+
|
|
597
|
+
function prepareForm() {
|
|
598
|
+
populateDropdown(self.device, 'node-input-assetId', 'assets', self.assetId);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
console.log('oneditprepare')
|
|
602
|
+
$('#node-input-device').change(function () {
|
|
603
|
+
// handle change event here
|
|
604
|
+
prepareForm();
|
|
605
|
+
});
|
|
606
|
+
setTimeout(() => {
|
|
607
|
+
if (!$('#node-input-device').val()) {
|
|
608
|
+
return
|
|
609
|
+
}
|
|
610
|
+
prepareForm();
|
|
611
|
+
}, 100)
|
|
612
|
+
|
|
528
613
|
}
|
|
529
614
|
});
|
|
530
615
|
</script>
|