@gotillit/tillit-node-red 1.2.4 → 1.2.5
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-routes.js +2 -1
- package/dist/nodes/node-routes.js.map +1 -1
- package/dist/tillit-node.html +307 -223
- package/package.json +1 -1
|
@@ -44,7 +44,8 @@ var utils_1 = require("../shared/utils");
|
|
|
44
44
|
var got_1 = __importDefault(require("got"));
|
|
45
45
|
var buildRoutes = function (RED) {
|
|
46
46
|
var apiRoot = "/tillit";
|
|
47
|
-
RED.
|
|
47
|
+
var routeAuthHandler = RED.auth.needsPermission("tillit.write");
|
|
48
|
+
RED.httpAdmin.get("".concat(apiRoot, "/:conn/:entity"), routeAuthHandler, function (req, res) { return __awaiter(void 0, void 0, void 0, function () {
|
|
48
49
|
var conn, entity, broker, environment, tenant, username, password, ops, url, response;
|
|
49
50
|
return __generator(this, function (_a) {
|
|
50
51
|
switch (_a.label) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-routes.js","sourceRoot":"","sources":["../../src/nodes/node-routes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAyC;AACzC,4CAAsB;AAEf,IAAM,WAAW,GAAG,UAAC,GAAQ;IAChC,IAAM,OAAO,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"node-routes.js","sourceRoot":"","sources":["../../src/nodes/node-routes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAyC;AACzC,4CAAsB;AAEf,IAAM,WAAW,GAAG,UAAC,GAAQ;IAChC,IAAM,OAAO,GAAG,SAAS,CAAC;IAC1B,IAAM,gBAAgB,GAAG,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IAElE,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,UAAG,OAAO,mBAAgB,EAAE,gBAAgB,EAAE,UAAO,GAAQ,EAAE,GAAQ;;;;;oBAC/E,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAA;oBACtB,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;oBAC3B,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;oBACvC,WAAW,GAAgC,MAAM,YAAtC,EAAE,MAAM,GAAwB,MAAM,OAA9B,EAAE,QAAQ,GAAc,MAAM,SAApB,EAAE,QAAQ,GAAI,MAAM,SAAV,CAAW;oBACrD,GAAG,GAAQ;wBACX,MAAM,EAAE,KAAK;wBACb,QAAQ,EAAE,QAAQ;wBAClB,QAAQ,EAAE,QAAQ;qBACrB,CAAA;oBACK,GAAG,GAAG,IAAA,gBAAQ,EAAC,WAAW,EAAE,MAAM,CAAC,GAAG,oBAAa,MAAM,eAAY,CAAC;oBAC3D,qBAAM,IAAA,aAAG,EAAC,GAAG,EAAE,GAAG,CAAC,EAAA;;oBAA9B,QAAQ,GAAG,SAAmB;oBACpC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;;;;SAC3B,CAAC,CAAC;AACP,CAAC,CAAA;AAlBY,QAAA,WAAW,eAkBvB"}
|
package/dist/tillit-node.html
CHANGED
|
@@ -1,62 +1,82 @@
|
|
|
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
|
+
fetch(`/tillit/${deviceId}/${entity}`)
|
|
7
|
+
.then(function (response) {
|
|
8
|
+
return response.json();
|
|
9
|
+
})
|
|
10
|
+
.then(function (data) {
|
|
11
|
+
// Populate the select element with returned data
|
|
12
|
+
const items = JSON.parse(data);
|
|
13
|
+
console.log(selectedId)
|
|
14
|
+
items.sort((a, b) => a.name < b.name ? -1 : 1).forEach(function (item) {
|
|
15
|
+
const option = document.createElement('option');
|
|
16
|
+
option.value = item.id;
|
|
17
|
+
option.text = item.name;
|
|
18
|
+
option.selected = item.id == selectedId
|
|
19
|
+
console.log(option.selected)
|
|
20
|
+
domElement.appendChild(option);
|
|
21
|
+
});
|
|
22
|
+
})
|
|
23
|
+
.catch(function (error) {
|
|
24
|
+
console.error(error);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
8
28
|
</script>
|
|
9
29
|
|
|
10
30
|
<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
|
-
|
|
31
|
+
<div class="form-row">
|
|
32
|
+
<label for="node-config-input-name"><i class="fa fa-globe"></i>Name</label>
|
|
33
|
+
<input type="text" id="node-config-input-name" placeholder="Name">
|
|
34
|
+
</div>
|
|
35
|
+
<div class="form-row">
|
|
36
|
+
<label for="node-config-input-thingId"><i class="fa fa-tag"></i> Thing ID</label>
|
|
37
|
+
<input type="text" id="node-config-input-thingId" placeholder="Thing ID">
|
|
38
|
+
</div>
|
|
39
|
+
<div class="form-row">
|
|
40
|
+
<label for="node-config-input-environment"><i class="fa fa-tag"></i> Environment</label>
|
|
41
|
+
<input type="text" id="node-config-input-environment" placeholder="TilliT Environment">
|
|
42
|
+
</div>
|
|
43
|
+
<div class="form-row">
|
|
44
|
+
<label for="node-config-input-endpoint"><i class="fa fa-tag"></i> Tenant</label>
|
|
45
|
+
<input type="text" id="node-config-input-tenant" placeholder="Tenant name">
|
|
46
|
+
</div>
|
|
47
|
+
<div class="form-row">
|
|
48
|
+
<label for="node-config-input-privKey"><i class="fa fa-tag"></i> Private key</label>
|
|
49
|
+
<input type="text" id="node-config-input-privKey"></input>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div class="form-row">
|
|
53
|
+
<label for="node-config-input-thingCert"><i class="fa fa-tag"></i> Thing cert</label>
|
|
54
|
+
<input type="text" id="node-config-input-thingCert"></input>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div class="form-row">
|
|
58
|
+
<label for="node-config-input-rootCa"><i class="fa fa-tag"></i> Root CA</label>
|
|
59
|
+
<input type="text" id="node-config-input-rootCa"></input>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
<div class="form-row">
|
|
64
|
+
<label for="node-config-input-username"><i class="fa fa-tag"></i> Username</label>
|
|
65
|
+
<input type="text" id="node-config-input-username"></input>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div class="form-row">
|
|
69
|
+
<label for="node-config-input-password"><i class="fa fa-tag"></i> Password</label>
|
|
70
|
+
<input type="password" id="node-config-input-password"></input>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<div class="form-tips">
|
|
74
|
+
<p><b>Secret:</b> Using environment variables:</p>
|
|
75
|
+
<p>
|
|
76
|
+
You can override any of these settings using environment variables. Recommended for production deployment.
|
|
77
|
+
Use: USERNAME, PASSWORD, TENANT, ENVIRONMENT, THING_CERT, PRIV_KEY, ROOT_CA
|
|
78
|
+
</p>
|
|
79
|
+
</div>
|
|
60
80
|
</script>
|
|
61
81
|
|
|
62
82
|
<!-- MQTT Broker Configuration -->
|
|
@@ -104,32 +124,32 @@
|
|
|
104
124
|
</script>
|
|
105
125
|
|
|
106
126
|
<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
|
-
|
|
127
|
+
<div class="form-row">
|
|
128
|
+
<label for="node-input-name"><i class="fa fa-globe"></i> Name</label>
|
|
129
|
+
<input type="text" id="node-input-name">
|
|
130
|
+
</div>
|
|
131
|
+
<div class="form-row">
|
|
132
|
+
<label for="node-input-device"><i class="fa fa-globe"></i> Connection</label>
|
|
133
|
+
<input type="text" id="node-input-device">
|
|
134
|
+
</div>
|
|
135
|
+
<div class="form-row">
|
|
136
|
+
<label for="node-input-topic"><i class="fa fa-globe"></i> Topic</label>
|
|
137
|
+
<input type="text" id="node-input-topic">
|
|
138
|
+
</div>
|
|
139
|
+
<div class="form-row">
|
|
140
|
+
<label for="node-input-qos"><i class="fa fa-empire"></i> <span> QoS</span></label>
|
|
141
|
+
<select id="node-input-qos" style="width:125px !important">
|
|
142
|
+
<option value="0">0</option>
|
|
143
|
+
<option value="1">1</option>
|
|
144
|
+
</select>
|
|
145
|
+
</div>
|
|
126
146
|
</script>
|
|
127
147
|
|
|
128
148
|
<script type="text/x-red" data-help-name="tillit-out">
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
149
|
+
<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>
|
|
150
|
+
<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>
|
|
151
|
+
<p>If <b>msg.payload</b> contains an object it will be stringified before being sent.</p>
|
|
152
|
+
<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
153
|
</script>
|
|
134
154
|
|
|
135
155
|
<script type="text/javascript">
|
|
@@ -168,27 +188,27 @@
|
|
|
168
188
|
</script>
|
|
169
189
|
|
|
170
190
|
<script type="text/x-red" data-template-name="tillit-in">
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
191
|
+
<div class="form-row">
|
|
192
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
193
|
+
<input type="text" id="node-input-device">
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<div class="form-row">
|
|
197
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
198
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
199
|
+
</div>
|
|
200
|
+
<div class="form-row">
|
|
201
|
+
<label for="node-input-topic"><i class="fa fa-tag"></i> Topic</label>
|
|
202
|
+
<input type="text" id="node-input-topic" placeholder="Topic">
|
|
203
|
+
</div>
|
|
184
204
|
</script>
|
|
185
205
|
|
|
186
206
|
<script type="text/x-red" data-help-name="tillit-in">
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
207
|
+
<p>TillliT MQTT input node. Connects to a broker and subscribes to the specified topic. The topic may contain MQTT wildcards.</p>
|
|
208
|
+
<p>Topic needs to start with your tenant. To subscribe to all messages from your account, do {tenant}/#</p>
|
|
209
|
+
<p>Outputs an object called <b>msg</b> containing <b>msg.topic, msg.payload, msg.qos</b> and <b>msg.retain</b>.</p>
|
|
210
|
+
<p><b>msg.payload</b> is usually a string, but can also be a binary buffer.</p>
|
|
211
|
+
<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
212
|
</script>
|
|
193
213
|
|
|
194
214
|
<script type="text/javascript">
|
|
@@ -223,41 +243,39 @@
|
|
|
223
243
|
</script>
|
|
224
244
|
|
|
225
245
|
|
|
226
|
-
|
|
227
|
-
|
|
228
246
|
<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
|
-
|
|
247
|
+
<div class="form-row">
|
|
248
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
249
|
+
<input type="text" id="node-input-device">
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
<div class="form-row">
|
|
253
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
254
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
255
|
+
</div>
|
|
256
|
+
<div class="form-row">
|
|
257
|
+
<label for="node-input-endpoint"><i class="fa fa-tag"></i> Endpoint</label>
|
|
258
|
+
<input type="text" id="node-input-endpoint" placeholder="Endpoint">
|
|
259
|
+
</div>
|
|
260
|
+
<div class="form-row">
|
|
261
|
+
<label for="node-input-method"><i class="fa fa-empire"></i> <span> Method</span></label>
|
|
262
|
+
<select id="node-input-method" style="width:125px !important">
|
|
263
|
+
<option value="GET">GET</option>
|
|
264
|
+
<option value="POST">POST</option>
|
|
265
|
+
<option value="PUT">PUT</option>
|
|
266
|
+
<option value="DELETE">DELETE</option>
|
|
267
|
+
</select>
|
|
268
|
+
</div>
|
|
251
269
|
</script>
|
|
252
270
|
|
|
253
271
|
<script type="text/x-red" data-help-name="tillit-api">
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
272
|
+
<p>An easy way for you to use the TilliT API from Node-red</p>
|
|
273
|
+
<p>Set your endpoint and method here.</p>
|
|
274
|
+
<p>Endpoint can be substituted by msg.endpoint</p>
|
|
275
|
+
<p><b>msg.payload</b> is expected to be a json and will be the body on POST and PUT calls</p>
|
|
276
|
+
<p><b>output 1</b> is the return of the call in case of success</p>
|
|
277
|
+
<p><b>output 2</b> is the error body in case of failure</p>
|
|
278
|
+
<p>For more information visit our help documentation: <a href="https://help.tillit.cloud/api/api/overview" target="blank">Open</a>
|
|
261
279
|
</script>
|
|
262
280
|
|
|
263
281
|
<script type="text/javascript">
|
|
@@ -296,42 +314,46 @@
|
|
|
296
314
|
|
|
297
315
|
|
|
298
316
|
<script type="text/x-red" data-help-name="tillit-pv">
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
317
|
+
<p>Publishes <b>msg.payload</b> to update the value of a process variable</p>
|
|
318
|
+
<p>msg.payload will be used as the value, respecting the data type selected</p>
|
|
319
|
+
<p>msg.topic will be used as assetId if you leave the configuration blank</p>
|
|
320
|
+
<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
321
|
|
|
304
322
|
</script>
|
|
305
323
|
|
|
306
324
|
|
|
307
325
|
<script type="text/x-red" data-template-name="tillit-pv">
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
326
|
+
<div class="form-row">
|
|
327
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
328
|
+
<input type="text" id="node-input-device">
|
|
329
|
+
</div>
|
|
312
330
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
331
|
+
<div class="form-row">
|
|
332
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
333
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
334
|
+
</div>
|
|
317
335
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
336
|
+
<div class="form-row">
|
|
337
|
+
<label for="node-input-assetId"><i class="fa fa-tag"></i> Asset </label>
|
|
338
|
+
<select id="node-input-assetId" placeholder="will use msg.topic if blank">
|
|
339
|
+
<option></option>
|
|
340
|
+
</select>
|
|
341
|
+
</div>
|
|
322
342
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
343
|
+
<div class="form-row">
|
|
344
|
+
<label for="node-input-processVariableId"><i class="fa fa-tag"></i> Process Variable </label>
|
|
345
|
+
<select id="node-input-processVariableId" placeholder="">
|
|
346
|
+
<option></option>
|
|
347
|
+
</select>
|
|
348
|
+
</div>
|
|
327
349
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
350
|
+
<div class="form-row">
|
|
351
|
+
<label for="node-input-dataType"><i class="fa fa-tag"></i>Data Type</label>
|
|
352
|
+
<select id="node-input-dataType" style="width:125px !important">
|
|
353
|
+
<option value="number">NUMBER</option>
|
|
354
|
+
<option value="string">STRING</option>
|
|
355
|
+
<option value="boolean">BOOLEAN</option>
|
|
356
|
+
</select>
|
|
335
357
|
</div>
|
|
336
358
|
|
|
337
359
|
|
|
@@ -366,55 +388,77 @@
|
|
|
366
388
|
},
|
|
367
389
|
labelStyle: function () {
|
|
368
390
|
return this.name ? "node_label_italic" : "";
|
|
391
|
+
}, oneditprepare: function () {
|
|
392
|
+
const self = this;
|
|
393
|
+
|
|
394
|
+
function prepareForm() {
|
|
395
|
+
populateDropdown(self.device, 'node-input-assetId', 'assets', self.assetId);
|
|
396
|
+
populateDropdown(self.device, 'node-input-processVariableId', 'process-variables', self.assetId);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
console.log('oneditprepare')
|
|
400
|
+
$('#node-input-device').change(function () {
|
|
401
|
+
// handle change event here
|
|
402
|
+
prepareForm();
|
|
403
|
+
});
|
|
404
|
+
setTimeout(() => {
|
|
405
|
+
if (!$('#node-input-device').val()) {
|
|
406
|
+
return
|
|
407
|
+
}
|
|
408
|
+
prepareForm();
|
|
409
|
+
}, 100)
|
|
410
|
+
|
|
369
411
|
}
|
|
370
412
|
});
|
|
371
413
|
</script>
|
|
372
414
|
|
|
373
415
|
|
|
374
|
-
|
|
375
|
-
|
|
376
416
|
<script type="text/x-red" data-help-name="tillit-event">
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
417
|
+
<p>Publishes <b>msg.payload</b> to raise an event</p>
|
|
418
|
+
<p>msg.topic can be used as assetId if you leave the node blank</p>
|
|
419
|
+
<p>msg.payload should be like the following example:</p>
|
|
420
|
+
<code>
|
|
421
|
+
{
|
|
422
|
+
assetId: number, //ID of the asset
|
|
423
|
+
timestamp: string, //Timestamp of the event
|
|
424
|
+
eventTypeId: number, //ID of the event to raise
|
|
425
|
+
orderId: number //The id of the order to raise event on (Optional)
|
|
426
|
+
orderNumber: string //The order number of the order to raise event on (Optional)
|
|
427
|
+
status: string //ACTIVE | SCHEDULED | COMPLETED (Optional)
|
|
428
|
+
subtitle: string //Set a description for the event (Optional)
|
|
389
429
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
430
|
+
</code>
|
|
431
|
+
This node will merge the settings from the node with the payload.
|
|
432
|
+
<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
433
|
|
|
394
434
|
</script>
|
|
395
435
|
|
|
396
436
|
|
|
397
437
|
<script type="text/x-red" data-template-name="tillit-event">
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
438
|
+
<div class="form-row">
|
|
439
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
440
|
+
<input type="text" id="node-input-device">
|
|
441
|
+
</div>
|
|
402
442
|
|
|
403
443
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
444
|
+
<div class="form-row">
|
|
445
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
446
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
447
|
+
</div>
|
|
408
448
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
449
|
+
<div class="form-row">
|
|
450
|
+
<label for="node-input-assetId"><i class="fa fa-tag"></i>Asset</label>
|
|
451
|
+
<select id="node-input-assetId" placeholder="Leave null and will use msg.topic or msg.payload.assetId">
|
|
452
|
+
<option></option>
|
|
453
|
+
</select>
|
|
454
|
+
</div>
|
|
413
455
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
456
|
+
<div class="form-row">
|
|
457
|
+
<label for="node-input-processVariableId"><i class="fa fa-tag"></i> Event Type</label>
|
|
458
|
+
<select id="node-input-eventTypeId" placeholder="Leave null and will use msg.payload.eventTypeId">
|
|
459
|
+
<option></option>
|
|
460
|
+
</select>
|
|
461
|
+
</div>
|
|
418
462
|
|
|
419
463
|
|
|
420
464
|
</script>
|
|
@@ -446,57 +490,78 @@
|
|
|
446
490
|
},
|
|
447
491
|
labelStyle: function () {
|
|
448
492
|
return this.name ? "node_label_italic" : "";
|
|
493
|
+
}, oneditprepare: function () {
|
|
494
|
+
const self = this;
|
|
495
|
+
|
|
496
|
+
function prepareForm() {
|
|
497
|
+
populateDropdown(self.device, 'node-input-assetId', 'assets', self.assetId);
|
|
498
|
+
populateDropdown(self.device, 'node-input-eventTypeId', 'event-types', self.eventTypeId);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
console.log('oneditprepare')
|
|
502
|
+
$('#node-input-device').change(function () {
|
|
503
|
+
// handle change event here
|
|
504
|
+
prepareForm();
|
|
505
|
+
});
|
|
506
|
+
setTimeout(() => {
|
|
507
|
+
if (!$('#node-input-device').val()) {
|
|
508
|
+
return
|
|
509
|
+
}
|
|
510
|
+
prepareForm();
|
|
511
|
+
}, 100)
|
|
512
|
+
|
|
449
513
|
}
|
|
450
514
|
});
|
|
451
|
-
</script>
|
|
452
|
-
|
|
453
515
|
|
|
516
|
+
</script>
|
|
454
517
|
|
|
455
518
|
|
|
456
519
|
<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
|
-
|
|
520
|
+
<p>Publishes <b>msg.payload</b> to update the asset progress</p>
|
|
521
|
+
<code>
|
|
522
|
+
[{
|
|
523
|
+
assetId: number,
|
|
524
|
+
orderId: number, //Is optional, if not supplied then the current running order is used.
|
|
525
|
+
timestamp: string,
|
|
526
|
+
totalCount: number,
|
|
527
|
+
rejectCount: number,
|
|
528
|
+
EQUIPMENT_STATUS_READY: boolean,
|
|
529
|
+
EQUIPMENT_STATUS_RUNNING: boolean,
|
|
530
|
+
EQUIPMENT_STATUS_STOPPED: boolean,
|
|
531
|
+
EQUIPMENT_STATUS_COMPLETE: boolean,
|
|
532
|
+
EQUIPMENT_STATUS_SUSPENDED: boolean,
|
|
533
|
+
EQUIPMENT_STATUS_ABORTED: boolean,
|
|
534
|
+
EQUIPMENT_STATUS_STARVED: boolean,
|
|
535
|
+
EQUIPMENT_STATUS_BLOCKED: boolean,
|
|
536
|
+
EQUIPMENT_STATUS_FAULTED: boolean,
|
|
537
|
+
downtimeReason: string,
|
|
538
|
+
reasonGroupId: number
|
|
539
|
+
}]
|
|
540
|
+
</code>
|
|
541
|
+
<p>msg.topic will be used as assetId if you leave the configuration blank</p>
|
|
542
|
+
<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
543
|
|
|
481
544
|
</script>
|
|
482
545
|
|
|
483
546
|
|
|
484
547
|
<script type="text/x-red" data-template-name="tillit-progress">
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
548
|
+
<div class="form-row">
|
|
549
|
+
<label for="node-input-device"><i class="fa fa-device"></i> Connection</label>
|
|
550
|
+
<input type="text" id="node-input-device">
|
|
551
|
+
</div>
|
|
489
552
|
|
|
490
553
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
554
|
+
<div class="form-row">
|
|
555
|
+
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
556
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
557
|
+
</div>
|
|
495
558
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
559
|
+
<div class="form-row">
|
|
560
|
+
<label for="node-input-assetId"><i class="fa fa-tag"></i> Asset</label>
|
|
561
|
+
<select id="node-input-assetId" placeholder="will use msg.topic if blank">
|
|
562
|
+
<option></option>
|
|
563
|
+
</select>
|
|
564
|
+
</div>
|
|
500
565
|
|
|
501
566
|
</script>
|
|
502
567
|
|
|
@@ -525,6 +590,25 @@
|
|
|
525
590
|
},
|
|
526
591
|
labelStyle: function () {
|
|
527
592
|
return this.name ? "node_label_italic" : "";
|
|
593
|
+
}, oneditprepare: function () {
|
|
594
|
+
const self = this;
|
|
595
|
+
|
|
596
|
+
function prepareForm() {
|
|
597
|
+
populateDropdown(self.device, 'node-input-assetId', 'assets', self.assetId);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
console.log('oneditprepare')
|
|
601
|
+
$('#node-input-device').change(function () {
|
|
602
|
+
// handle change event here
|
|
603
|
+
prepareForm();
|
|
604
|
+
});
|
|
605
|
+
setTimeout(() => {
|
|
606
|
+
if (!$('#node-input-device').val()) {
|
|
607
|
+
return
|
|
608
|
+
}
|
|
609
|
+
prepareForm();
|
|
610
|
+
}, 100)
|
|
611
|
+
|
|
528
612
|
}
|
|
529
613
|
});
|
|
530
614
|
</script>
|