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