@ncd-io/node-red-enterprise-sensors 1.2.3 → 1.4.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/lib/WirelessGateway.js +3067 -1145
- package/package.json +1 -1
- package/wireless.html +551 -213
- package/wireless.js +465 -39
package/wireless.js
CHANGED
|
@@ -4,6 +4,7 @@ const sp = require('serialport');
|
|
|
4
4
|
const Queue = require("promise-queue");
|
|
5
5
|
const events = require("events");
|
|
6
6
|
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
7
8
|
const home_dir = require('os').homedir
|
|
8
9
|
module.exports = function(RED) {
|
|
9
10
|
var gateway_pool = {};
|
|
@@ -20,6 +21,9 @@ module.exports = function(RED) {
|
|
|
20
21
|
this._emitter = new events.EventEmitter();
|
|
21
22
|
this.on = (e,c) => this._emitter.on(e, c);
|
|
22
23
|
|
|
24
|
+
// comms_timer object var added to clear the time to prevent issues with rapid redeploy
|
|
25
|
+
this.comms_timer;
|
|
26
|
+
|
|
23
27
|
if(config.comm_type == 'serial'){
|
|
24
28
|
this.key = config.port;
|
|
25
29
|
}
|
|
@@ -62,7 +66,7 @@ module.exports = function(RED) {
|
|
|
62
66
|
|
|
63
67
|
if(config.comm_type == 'serial'){
|
|
64
68
|
if(config.port !== ''){
|
|
65
|
-
setTimeout(()=>{node.gateway.digi.serial.setupSerial()}, 5000);
|
|
69
|
+
this.comms_timer = setTimeout(()=>{node.gateway.digi.serial.setupSerial()}, 5000);
|
|
66
70
|
}else{
|
|
67
71
|
node.warn('No Port Selected for Serial Communications.')
|
|
68
72
|
}
|
|
@@ -70,7 +74,7 @@ module.exports = function(RED) {
|
|
|
70
74
|
if(config.tcp_port === '' || config.ip_address === ''){
|
|
71
75
|
node.warn('TCP Socket not configured for Network Communications. Please enter a Port and IP Address.');
|
|
72
76
|
}else{
|
|
73
|
-
setTimeout(()=>{node.gateway.digi.serial.setupClient()}, 5000);
|
|
77
|
+
this.comms_timer = setTimeout(()=>{node.gateway.digi.serial.setupClient()}, 5000);
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
node.gateway.digi.serial.on('ready', () => {
|
|
@@ -133,14 +137,32 @@ module.exports = function(RED) {
|
|
|
133
137
|
});
|
|
134
138
|
for(var i in promises){
|
|
135
139
|
(function(name){
|
|
136
|
-
promises[name].then((
|
|
140
|
+
promises[name].then((res) => {
|
|
137
141
|
if(name != 'finish'){
|
|
142
|
+
// IF we receive an FON message with success
|
|
143
|
+
if(Object.hasOwn(res, 'data') && res.data[0] == 70 && res.data[1] == 79 && res.data[2] == 78 && res.result == 255){
|
|
144
|
+
manifest_data.enter_ota_fota_version = res.original.data[5];
|
|
145
|
+
console.log('Great Success');
|
|
146
|
+
console.log(res);
|
|
147
|
+
}
|
|
138
148
|
console.log(name);
|
|
139
|
-
}
|
|
140
|
-
else{
|
|
149
|
+
} else{
|
|
141
150
|
// enter ota mode
|
|
142
151
|
node.gateway.digi.send.at_command("ID", [0x7a, 0xaa]).then().catch().then(() => {
|
|
143
|
-
|
|
152
|
+
console.log(manifest_data);
|
|
153
|
+
if(manifest_data.enter_ota_fota_version > 16){
|
|
154
|
+
console.log('V17 PROCESS');
|
|
155
|
+
console.log(manifest_data);
|
|
156
|
+
node.start_firmware_update_v17(manifest_data, firmware_data);
|
|
157
|
+
}else if(manifest_data.enter_ota_fota_version > 12){
|
|
158
|
+
console.log('V13 PROCESS');
|
|
159
|
+
console.log(manifest_data);
|
|
160
|
+
node.start_firmware_update_v13(manifest_data, firmware_data);
|
|
161
|
+
}else{
|
|
162
|
+
console.log('OLD PROCESSS');
|
|
163
|
+
console.log(manifest_data);
|
|
164
|
+
node.start_firmware_update(manifest_data, firmware_data);
|
|
165
|
+
}
|
|
144
166
|
});
|
|
145
167
|
}
|
|
146
168
|
}).catch((err) => {
|
|
@@ -148,7 +170,7 @@ module.exports = function(RED) {
|
|
|
148
170
|
// msg[name] = err;
|
|
149
171
|
});
|
|
150
172
|
})(i);
|
|
151
|
-
}
|
|
173
|
+
};
|
|
152
174
|
});
|
|
153
175
|
});
|
|
154
176
|
}));
|
|
@@ -180,7 +202,6 @@ module.exports = function(RED) {
|
|
|
180
202
|
node._emitter.emit('mode_change', mode);
|
|
181
203
|
});
|
|
182
204
|
};
|
|
183
|
-
|
|
184
205
|
node.start_firmware_update = function(manifest_data, firmware_data){
|
|
185
206
|
return new Promise((top_fulfill, top_reject) => {
|
|
186
207
|
var success = {};
|
|
@@ -244,6 +265,208 @@ module.exports = function(RED) {
|
|
|
244
265
|
}
|
|
245
266
|
}, 1000);
|
|
246
267
|
});
|
|
268
|
+
};
|
|
269
|
+
node.start_firmware_update_v13 = function(manifest_data, firmware_data){
|
|
270
|
+
console.log('V13');
|
|
271
|
+
return new Promise((top_fulfill, top_reject) => {
|
|
272
|
+
var success = {successes:{}, failures:{}};
|
|
273
|
+
|
|
274
|
+
let chunk_size = 128;
|
|
275
|
+
let image_start = firmware_data.firmware.slice(1, 5).reduce(msbLsb)+6;
|
|
276
|
+
|
|
277
|
+
var promises = {
|
|
278
|
+
manifest: node.gateway.firmware_send_manifest(manifest_data.addr, firmware_data.firmware.slice(5, image_start-1))
|
|
279
|
+
};
|
|
280
|
+
// promises.manifest = node.gateway.firmware_send_manifest(manifest_data.addr, firmware_data.firmware.slice(5, image_start-1));
|
|
281
|
+
firmware_data.firmware = firmware_data.firmware.slice(image_start+4);
|
|
282
|
+
|
|
283
|
+
var index = 0;
|
|
284
|
+
if(Object.hasOwn(node.sensor_list[manifest_data.addr], 'last_chunk_success')){
|
|
285
|
+
index = node.sensor_list[manifest_data.addr].last_chunk_success;
|
|
286
|
+
}
|
|
287
|
+
while(index*chunk_size < firmware_data.manifest.image_size){
|
|
288
|
+
let offset = index*chunk_size;
|
|
289
|
+
let offset_bytes = int2Bytes(offset, 4);
|
|
290
|
+
let firmware_chunk = firmware_data.firmware.slice(index*chunk_size, index*chunk_size+chunk_size);
|
|
291
|
+
promises[index] = node.gateway.firmware_send_chunk_v13(manifest_data.addr, offset_bytes, firmware_chunk);
|
|
292
|
+
if(((index + 1) % 50) == 0 || (index+1)*chunk_size >= firmware_data.manifest.image_size){
|
|
293
|
+
promises[index+'_check'] = node.gateway.firmware_read_last_chunk_segment(manifest_data.addr);
|
|
294
|
+
};
|
|
295
|
+
index++;
|
|
296
|
+
}
|
|
297
|
+
console.log('Update Started');
|
|
298
|
+
console.log(Object.keys(promises).length);
|
|
299
|
+
console.log(Date.now());
|
|
300
|
+
promises.reboot = node.gateway.config_reboot_sensor(manifest_data.addr);
|
|
301
|
+
var firmware_continue = true;
|
|
302
|
+
for(var i in promises){
|
|
303
|
+
(function(name){
|
|
304
|
+
let retryCount = 0;
|
|
305
|
+
const maxRetries = 3; // Set the maximum number of retries
|
|
306
|
+
|
|
307
|
+
function attemptPromise() {
|
|
308
|
+
console.log(name);
|
|
309
|
+
promises[name].then((status_frame) => {
|
|
310
|
+
if(name == 'manifest'){
|
|
311
|
+
console.log('MANIFEST SUCCESFULLY SENT');
|
|
312
|
+
node.sensor_list[manifest_data.addr].test_check = {name: true};
|
|
313
|
+
node.sensor_list[manifest_data.addr].update_in_progress = true;
|
|
314
|
+
}
|
|
315
|
+
else if(name.includes('_check')){
|
|
316
|
+
console.log(name);
|
|
317
|
+
console.log(parseInt(name.split('_')[0]) * chunk_size);
|
|
318
|
+
let last_chunk = status_frame.data.reduce(msbLsb);
|
|
319
|
+
console.log(last_chunk);
|
|
320
|
+
if(last_chunk != (parseInt(name.split('_')[0]) * chunk_size)){
|
|
321
|
+
console.log('ERROR DETECTED IN OTA UPDATE');
|
|
322
|
+
success.failures[name] = {chunk: last_chunk, last_transmit: (parseInt(name.split('_')[0]) * chunk_size), last_report: last_chunk};
|
|
323
|
+
// node.gateway.clear_queue_except_last();
|
|
324
|
+
node.gateway.clear_queue();
|
|
325
|
+
node.resume_normal_operation();
|
|
326
|
+
} else {
|
|
327
|
+
success.successes[name] = {chunk: last_chunk};
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
success[name] = true;
|
|
332
|
+
node.sensor_list[manifest_data.addr].test_check[name] = true;
|
|
333
|
+
node.sensor_list[manifest_data.addr].last_chunk_success = name;
|
|
334
|
+
}
|
|
335
|
+
}).catch((err) => {
|
|
336
|
+
console.log(name);
|
|
337
|
+
console.log(err);
|
|
338
|
+
if(name != 'reboot'){
|
|
339
|
+
node.gateway.clear_queue();
|
|
340
|
+
success[name] = err;
|
|
341
|
+
} else {
|
|
342
|
+
delete node.sensor_list[manifest_data.addr].last_chunk_success;
|
|
343
|
+
delete node.sensor_list[manifest_data.addr].update_request;
|
|
344
|
+
node._emitter.emit('send_firmware_stats', {state: success, addr: manifest_data.addr});
|
|
345
|
+
top_fulfill(success);
|
|
346
|
+
}
|
|
347
|
+
console.log('Update Finished')
|
|
348
|
+
console.log(Date.now());
|
|
349
|
+
node._emitter.emit('send_firmware_stats', {state: success, addr: manifest_data.addr});
|
|
350
|
+
node.resume_normal_operation();
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
attemptPromise(); // Start the initial attempt
|
|
354
|
+
})(i);
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
};
|
|
358
|
+
node.start_firmware_update_v17 = function(manifest_data, firmware_data){
|
|
359
|
+
console.log('V17 Update Start');
|
|
360
|
+
var start_offset = 0;
|
|
361
|
+
setTimeout(() => {
|
|
362
|
+
if(Object.hasOwn(node.sensor_list[manifest_data.addr], 'last_chunk_success')){
|
|
363
|
+
node.gateway.firmware_read_last_chunk_segment(manifest_data.addr).then((status_frame) => {
|
|
364
|
+
console.log('Last Chunk Segment Read');
|
|
365
|
+
console.log(status_frame);
|
|
366
|
+
start_offset = status_frame.data.slice(4,8).reduce(msbLsb);
|
|
367
|
+
node.queue_firmware_update_v17(manifest_data, firmware_data, start_offset);
|
|
368
|
+
}).catch((err) => {
|
|
369
|
+
// TODO FOTA EMIT ERROR FOTA
|
|
370
|
+
console.log('Error reading last chunk segment');
|
|
371
|
+
node.resume_normal_operation();
|
|
372
|
+
});
|
|
373
|
+
}else{
|
|
374
|
+
node.queue_firmware_update_v17(manifest_data, firmware_data, start_offset);
|
|
375
|
+
};
|
|
376
|
+
}, 1000);
|
|
377
|
+
};
|
|
378
|
+
node.queue_firmware_update_v17 = function(manifest_data, firmware_data, start_offset){
|
|
379
|
+
console.log('V17 Queue Update Start');
|
|
380
|
+
console.log('Start Offset: '+start_offset);
|
|
381
|
+
return new Promise((top_fulfill, top_reject) => {
|
|
382
|
+
var success = {successes:{}, failures:{}};
|
|
383
|
+
|
|
384
|
+
let chunk_size = 128;
|
|
385
|
+
let image_start = firmware_data.firmware.slice(1, 5).reduce(msbLsb)+6;
|
|
386
|
+
var promises = {};
|
|
387
|
+
if(start_offset == 0){
|
|
388
|
+
promises.manifest = node.gateway.firmware_send_manifest(manifest_data.addr, firmware_data.firmware.slice(5, image_start-1));
|
|
389
|
+
};
|
|
390
|
+
// promises.manifest = node.gateway.firmware_send_manifest(manifest_data.addr, firmware_data.firmware.slice(5, image_start-1));
|
|
391
|
+
firmware_data.firmware = firmware_data.firmware.slice(image_start+4);
|
|
392
|
+
|
|
393
|
+
// if(Object.hasOwn(node.sensor_list[manifest_data.addr], 'last_chunk_success')){
|
|
394
|
+
// index = node.sensor_list[manifest_data.addr].last_chunk_success;
|
|
395
|
+
// }
|
|
396
|
+
|
|
397
|
+
// reverse calculate index based on start_offset.
|
|
398
|
+
var index = parseInt(start_offset / chunk_size);
|
|
399
|
+
console.log('Index: '+index);
|
|
400
|
+
while(index*chunk_size < firmware_data.manifest.image_size){
|
|
401
|
+
let offset = index*chunk_size;
|
|
402
|
+
let offset_bytes = int2Bytes(offset, 4);
|
|
403
|
+
let firmware_chunk = firmware_data.firmware.slice(index*chunk_size, index*chunk_size+chunk_size);
|
|
404
|
+
promises[index] = node.gateway.firmware_send_chunk_v13(manifest_data.addr, offset_bytes, firmware_chunk);
|
|
405
|
+
if(((index + 1) % 50) == 0 || (index+1)*chunk_size >= firmware_data.manifest.image_size){
|
|
406
|
+
promises[index+'_check'] = node.gateway.firmware_read_last_chunk_segment(manifest_data.addr);
|
|
407
|
+
};
|
|
408
|
+
index++;
|
|
409
|
+
}
|
|
410
|
+
console.log('Update Started');
|
|
411
|
+
console.log(Object.keys(promises).length);
|
|
412
|
+
console.log(Date.now());
|
|
413
|
+
promises.reboot = node.gateway.config_reboot_sensor(manifest_data.addr);
|
|
414
|
+
var firmware_continue = true;
|
|
415
|
+
for(var i in promises){
|
|
416
|
+
(function(name){
|
|
417
|
+
let retryCount = 0;
|
|
418
|
+
const maxRetries = 3; // Set the maximum number of retries
|
|
419
|
+
|
|
420
|
+
function attemptPromise() {
|
|
421
|
+
console.log(name);
|
|
422
|
+
promises[name].then((status_frame) => {
|
|
423
|
+
if(name == 'manifest'){
|
|
424
|
+
console.log('MANIFEST SUCCESFULLY SENT');
|
|
425
|
+
node.sensor_list[manifest_data.addr].test_check = {name: true};
|
|
426
|
+
node.sensor_list[manifest_data.addr].update_in_progress = true;
|
|
427
|
+
}
|
|
428
|
+
else if(name.includes('_check')){
|
|
429
|
+
console.log(name);
|
|
430
|
+
console.log(parseInt(name.split('_')[0]) * chunk_size);
|
|
431
|
+
let last_chunk = status_frame.data.slice(0,4).reduce(msbLsb);
|
|
432
|
+
console.log(last_chunk);
|
|
433
|
+
if(last_chunk != (parseInt(name.split('_')[0]) * chunk_size)){
|
|
434
|
+
console.log('ERROR DETECTED IN OTA UPDATE');
|
|
435
|
+
success.failures[name] = {chunk: last_chunk, last_transmit: (parseInt(name.split('_')[0]) * chunk_size), last_report: last_chunk};
|
|
436
|
+
// node.gateway.clear_queue_except_last();
|
|
437
|
+
node.gateway.clear_queue();
|
|
438
|
+
node.resume_normal_operation();
|
|
439
|
+
} else {
|
|
440
|
+
success.successes[name] = {chunk: last_chunk};
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
success[name] = true;
|
|
445
|
+
node.sensor_list[manifest_data.addr].test_check[name] = true;
|
|
446
|
+
node.sensor_list[manifest_data.addr].last_chunk_success = name;
|
|
447
|
+
}
|
|
448
|
+
}).catch((err) => {
|
|
449
|
+
console.log(name);
|
|
450
|
+
console.log(err);
|
|
451
|
+
if(name != 'reboot'){
|
|
452
|
+
node.gateway.clear_queue();
|
|
453
|
+
success[name] = err;
|
|
454
|
+
} else {
|
|
455
|
+
delete node.sensor_list[manifest_data.addr].last_chunk_success;
|
|
456
|
+
delete node.sensor_list[manifest_data.addr].update_request;
|
|
457
|
+
node._emitter.emit('send_firmware_stats', {state: success, addr: manifest_data.addr});
|
|
458
|
+
top_fulfill(success);
|
|
459
|
+
}
|
|
460
|
+
console.log('Update Finished')
|
|
461
|
+
console.log(Date.now());
|
|
462
|
+
node._emitter.emit('send_firmware_stats', {state: success, addr: manifest_data.addr});
|
|
463
|
+
node.resume_normal_operation();
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
attemptPromise(); // Start the initial attempt
|
|
467
|
+
})(i);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
247
470
|
}
|
|
248
471
|
node.resume_normal_operation = function(){
|
|
249
472
|
let pan_id = parseInt(config.pan_id, 16);
|
|
@@ -262,11 +485,13 @@ module.exports = function(RED) {
|
|
|
262
485
|
if(typeof gateway_pool[this.key] != 'undefined'){
|
|
263
486
|
if(config.comm_type == 'serial'){
|
|
264
487
|
node.gateway.digi.serial.close();
|
|
488
|
+
clearTimeout(this.comms_timer);
|
|
265
489
|
// node.gateway.digi.serial.close(() => {
|
|
266
490
|
delete gateway_pool[this.key];
|
|
267
491
|
// });
|
|
268
492
|
}else{
|
|
269
493
|
node.gateway.digi.serial.close();
|
|
494
|
+
clearTimeout(this.comms_timer);
|
|
270
495
|
// node.gateway.digi.serial.close(() => {
|
|
271
496
|
delete gateway_pool[this.key];
|
|
272
497
|
// });
|
|
@@ -341,6 +566,18 @@ module.exports = function(RED) {
|
|
|
341
566
|
|
|
342
567
|
node.on('close', function(){
|
|
343
568
|
this._gateway_node.close_comms();
|
|
569
|
+
this._gateway_node._emitter.removeAllListeners('send_manifest');
|
|
570
|
+
this._gateway_node._emitter.removeAllListeners('send_firmware_stats');
|
|
571
|
+
this._gateway_node._emitter.removeAllListeners('mode_change');
|
|
572
|
+
this.gateway._emitter.removeAllListeners('ncd_error');
|
|
573
|
+
this.gateway._emitter.removeAllListeners('sensor_data');
|
|
574
|
+
this.gateway._emitter.removeAllListeners('sensor_mode');
|
|
575
|
+
this.gateway._emitter.removeAllListeners('receive_packet-unknown_device');
|
|
576
|
+
this.gateway._emitter.removeAllListeners('route_info');
|
|
577
|
+
this.gateway._emitter.removeAllListeners('link_info');
|
|
578
|
+
this.gateway._emitter.removeAllListeners('converter_response');
|
|
579
|
+
this.gateway._emitter.removeAllListeners('manifest_received');
|
|
580
|
+
console.log(this.gateway._emitter.eventNames());
|
|
344
581
|
});
|
|
345
582
|
|
|
346
583
|
node.is_config = false;
|
|
@@ -446,10 +683,13 @@ module.exports = function(RED) {
|
|
|
446
683
|
// 'description': 'Query water levels in mm/cm',
|
|
447
684
|
// 'target_parser': 'parse_water_levels'
|
|
448
685
|
// }
|
|
686
|
+
if(!Object.hasOwn(msg.payload, 'timeout')){
|
|
687
|
+
msg.payload.timeout = 1500;
|
|
688
|
+
}
|
|
449
689
|
if(msg.payload.hasOwnProperty('meta')){
|
|
450
|
-
node.gateway.queue_bridge_query(msg.payload.address, msg.payload.command, msg.payload.meta);
|
|
690
|
+
node.gateway.queue_bridge_query(msg.payload.address, msg.payload.command, msg.payload.meta, msg.payload.timeout);
|
|
451
691
|
}else{
|
|
452
|
-
node.gateway.queue_bridge_query(msg.payload.address, msg.payload.command);
|
|
692
|
+
node.gateway.queue_bridge_query(msg.payload.address, msg.payload.command, null, msg.payload.timeout);
|
|
453
693
|
}
|
|
454
694
|
break;
|
|
455
695
|
case "converter_send_multiple":
|
|
@@ -474,7 +714,10 @@ module.exports = function(RED) {
|
|
|
474
714
|
// }
|
|
475
715
|
// }
|
|
476
716
|
// ];
|
|
477
|
-
|
|
717
|
+
if(!Object.hasOwn(msg.payload, 'timeout')){
|
|
718
|
+
msg.payload.timeout = 1500;
|
|
719
|
+
}
|
|
720
|
+
node.gateway.prepare_bridge_query(msg.payload.address, msg.payload.commands, msg.payload.timeout);
|
|
478
721
|
break;
|
|
479
722
|
case "start_luber":
|
|
480
723
|
// msg = {
|
|
@@ -582,6 +825,32 @@ module.exports = function(RED) {
|
|
|
582
825
|
// device_type: 80,
|
|
583
826
|
// hardware_id: [88, 88, 88]
|
|
584
827
|
// }
|
|
828
|
+
let fw_dir = home_dir()+'/.node-red/node_modules/@ncd-io/node-red-enterprise-sensors/firmware_files';
|
|
829
|
+
fs.readdir(fw_dir, (err, files) => {
|
|
830
|
+
if (err) {
|
|
831
|
+
node.error('Error reading firmware directory: ' + err);
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
// Create firmware files array
|
|
836
|
+
const firmwareFiles = files
|
|
837
|
+
.filter(file => file.endsWith('.ncd'))
|
|
838
|
+
.map((file) => {
|
|
839
|
+
const stats = fs.statSync(path.join(fw_dir, file));
|
|
840
|
+
const file_info = file.split("-");
|
|
841
|
+
return {
|
|
842
|
+
file_name: file,
|
|
843
|
+
download_date: stats.mtime,
|
|
844
|
+
for_sensor_type: Number(file_info[0]),
|
|
845
|
+
for_hardware_id: file_info[1].substring(0, file_info[1].length - 4)
|
|
846
|
+
};
|
|
847
|
+
});
|
|
848
|
+
// Send firmware files list
|
|
849
|
+
node.send({
|
|
850
|
+
topic: 'check_firmware_file_response',
|
|
851
|
+
payload: firmwareFiles
|
|
852
|
+
});
|
|
853
|
+
});
|
|
585
854
|
break;
|
|
586
855
|
case "ota_firmware_update_single":
|
|
587
856
|
// msg.payload = {
|
|
@@ -604,10 +873,10 @@ module.exports = function(RED) {
|
|
|
604
873
|
// }
|
|
605
874
|
// TODO unfinished
|
|
606
875
|
msg.payload.addresses.forEach((address) => {
|
|
607
|
-
if(!Object.hasOwn(node._gateway_node.sensor_list,
|
|
876
|
+
if(!Object.hasOwn(node._gateway_node.sensor_list, address)){
|
|
608
877
|
node._gateway_node.sensor_list[address] = {};
|
|
609
878
|
};
|
|
610
|
-
if(!Object.hasOwn(node._gateway_node.sensor_list[
|
|
879
|
+
if(!Object.hasOwn(node._gateway_node.sensor_list[address], 'update_request')){
|
|
611
880
|
node._gateway_node.sensor_list[address].update_request = true;
|
|
612
881
|
};
|
|
613
882
|
});
|
|
@@ -774,7 +1043,7 @@ module.exports = function(RED) {
|
|
|
774
1043
|
|
|
775
1044
|
var promises = {};
|
|
776
1045
|
// This command is used for OTF on types 53, 80,81,82,83,84, 101, 102, 110, 111, 518, 519
|
|
777
|
-
let original_otf_devices = [53, 80, 81, 82, 83, 84, 101, 102, 110, 111, 112, 114, 180, 181, 518, 519, 520, 538];
|
|
1046
|
+
let original_otf_devices = [53, 80, 81, 82, 83, 84, 101, 102, 110, 111, 112, 114, 117, 180, 181, 518, 519, 520, 538];
|
|
778
1047
|
if(original_otf_devices.includes(sensor.type)){
|
|
779
1048
|
// This command is used for OTF on types 53, 80, 81, 82, 83, 84, 101, 102, 110, 111, 518, 519
|
|
780
1049
|
promises.config_enter_otn_mode = node.config_gateway.config_enter_otn_mode(sensor.mac);
|
|
@@ -930,6 +1199,12 @@ module.exports = function(RED) {
|
|
|
930
1199
|
if(config.change_detection_t3_active){
|
|
931
1200
|
promises.change_detection = node.config_gateway.config_set_change_detection(mac, config.change_enabled ? 1 : 0, parseInt(config.change_pr), parseInt(config.change_interval));
|
|
932
1201
|
}
|
|
1202
|
+
if(config.fsr_420ma_active){
|
|
1203
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
1204
|
+
}
|
|
1205
|
+
if(config.always_on_420ma_active){
|
|
1206
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
1207
|
+
}
|
|
933
1208
|
break;
|
|
934
1209
|
case 4:
|
|
935
1210
|
if(config.thermocouple_type_23_active){
|
|
@@ -1041,6 +1316,12 @@ module.exports = function(RED) {
|
|
|
1041
1316
|
if(config.auto_check_threshold_88_active){
|
|
1042
1317
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1043
1318
|
}
|
|
1319
|
+
if(config.fsr_420ma_active){
|
|
1320
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
1321
|
+
}
|
|
1322
|
+
if(config.always_on_420ma_active){
|
|
1323
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
1324
|
+
}
|
|
1044
1325
|
break;
|
|
1045
1326
|
case 15:
|
|
1046
1327
|
if(config.sensor_boot_time_420ma_active){
|
|
@@ -1061,6 +1342,12 @@ module.exports = function(RED) {
|
|
|
1061
1342
|
if(config.auto_check_threshold_88_active){
|
|
1062
1343
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1063
1344
|
}
|
|
1345
|
+
if(config.fsr_420ma_active){
|
|
1346
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
1347
|
+
}
|
|
1348
|
+
if(config.always_on_420ma_active){
|
|
1349
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
1350
|
+
}
|
|
1064
1351
|
break;
|
|
1065
1352
|
case 19:
|
|
1066
1353
|
if(config.current_calibration_13_active){
|
|
@@ -1098,6 +1385,12 @@ module.exports = function(RED) {
|
|
|
1098
1385
|
if(config.pressure_sensor_type_21_active){
|
|
1099
1386
|
promises.pressure_sensor_type_21 = node.config_gateway.config_set_pressure_sensor_type_21(mac, parseInt(config.pressure_sensor_type_21));
|
|
1100
1387
|
}
|
|
1388
|
+
if(config.pressure_sensor_range_AMS5812_21_active){
|
|
1389
|
+
promises.pressure_sensor_range_AMS5812_21 = node.config_gateway.config_set_pressure_sensor_range_21(mac, parseInt(config.pressure_sensor_range_AMS5812_21));
|
|
1390
|
+
}
|
|
1391
|
+
if(config.pressure_sensor_range_AMS5915_21_active){
|
|
1392
|
+
promises.pressure_sensor_range_AMS5915_21 = node.config_gateway.config_set_pressure_sensor_range_21(mac, parseInt(config.pressure_sensor_range_AMS5915_21));
|
|
1393
|
+
}
|
|
1101
1394
|
break;
|
|
1102
1395
|
case 23:
|
|
1103
1396
|
if(config.thermocouple_type_23_active){
|
|
@@ -1151,6 +1444,14 @@ module.exports = function(RED) {
|
|
|
1151
1444
|
var interr = parseInt(config.activ_interr_x) | parseInt(config.activ_interr_y) | parseInt(config.activ_interr_z) | parseInt(config.activ_interr_op);
|
|
1152
1445
|
promises.activity_interrupt = node.config_gateway.config_set_interrupt_24(mac, interr);
|
|
1153
1446
|
break;
|
|
1447
|
+
case 26:
|
|
1448
|
+
if(config.pressure_limit_26_active){
|
|
1449
|
+
promises.pressure_limit_26 = node.config_gateway.config_set_pressure_limit_26(mac, parseInt(config.pressure_limit_26));
|
|
1450
|
+
}
|
|
1451
|
+
if(config.auto_pressure_check_26_active){
|
|
1452
|
+
promises.auto_pressure_check_26 = node.config_gateway.config_set_auto_pressure_check_26(mac, parseInt(config.auto_pressure_check_26));
|
|
1453
|
+
}
|
|
1454
|
+
break;
|
|
1154
1455
|
case 28:
|
|
1155
1456
|
if(config.current_calibration_13_active){
|
|
1156
1457
|
var cali = parseInt(config.current_calibration_13);
|
|
@@ -1292,6 +1593,12 @@ module.exports = function(RED) {
|
|
|
1292
1593
|
if(config.auto_check_threshold_88_active){
|
|
1293
1594
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1294
1595
|
}
|
|
1596
|
+
if(config.fsr_420ma_active){
|
|
1597
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
1598
|
+
}
|
|
1599
|
+
if(config.always_on_420ma_active){
|
|
1600
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
1601
|
+
}
|
|
1295
1602
|
break;
|
|
1296
1603
|
case 46:
|
|
1297
1604
|
if(config.motion_threshold_46_active){
|
|
@@ -1325,6 +1632,12 @@ module.exports = function(RED) {
|
|
|
1325
1632
|
if(config.auto_check_threshold_88_active){
|
|
1326
1633
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1327
1634
|
}
|
|
1635
|
+
if(config.fsr_420ma_active){
|
|
1636
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
1637
|
+
}
|
|
1638
|
+
if(config.always_on_420ma_active){
|
|
1639
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
1640
|
+
}
|
|
1328
1641
|
break;
|
|
1329
1642
|
case 52:
|
|
1330
1643
|
if(config.sensor_boot_time_420ma_active){
|
|
@@ -1345,6 +1658,12 @@ module.exports = function(RED) {
|
|
|
1345
1658
|
if(config.auto_check_threshold_88_active){
|
|
1346
1659
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1347
1660
|
}
|
|
1661
|
+
if(config.fsr_420ma_active){
|
|
1662
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
1663
|
+
}
|
|
1664
|
+
if(config.always_on_420ma_active){
|
|
1665
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
1666
|
+
}
|
|
1348
1667
|
break;
|
|
1349
1668
|
case 53:
|
|
1350
1669
|
if(config.scd_skip_samples_44_active){
|
|
@@ -1376,6 +1695,12 @@ module.exports = function(RED) {
|
|
|
1376
1695
|
if(config.auto_check_threshold_88_active){
|
|
1377
1696
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1378
1697
|
}
|
|
1698
|
+
if(config.fsr_420ma_active){
|
|
1699
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
1700
|
+
}
|
|
1701
|
+
if(config.always_on_420ma_active){
|
|
1702
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
1703
|
+
}
|
|
1379
1704
|
break;
|
|
1380
1705
|
case 58:
|
|
1381
1706
|
if(config.calibration_58){
|
|
@@ -1648,6 +1973,12 @@ module.exports = function(RED) {
|
|
|
1648
1973
|
if(config.auto_check_threshold_88_active){
|
|
1649
1974
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1650
1975
|
}
|
|
1976
|
+
if(config.fsr_420ma_active){
|
|
1977
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
1978
|
+
}
|
|
1979
|
+
if(config.always_on_420ma_active){
|
|
1980
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
1981
|
+
}
|
|
1651
1982
|
break;
|
|
1652
1983
|
case 88:
|
|
1653
1984
|
if(config.sensor_boot_time_420ma_active){
|
|
@@ -1668,6 +1999,12 @@ module.exports = function(RED) {
|
|
|
1668
1999
|
if(config.auto_check_threshold_88_active){
|
|
1669
2000
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1670
2001
|
}
|
|
2002
|
+
if(config.fsr_420ma_active){
|
|
2003
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
2004
|
+
}
|
|
2005
|
+
if(config.always_on_420ma_active){
|
|
2006
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
2007
|
+
}
|
|
1671
2008
|
break;
|
|
1672
2009
|
case 89:
|
|
1673
2010
|
if(config.sensor_boot_time_420ma_active){
|
|
@@ -1688,6 +2025,12 @@ module.exports = function(RED) {
|
|
|
1688
2025
|
if(config.auto_check_threshold_88_active){
|
|
1689
2026
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1690
2027
|
}
|
|
2028
|
+
if(config.fsr_420ma_active){
|
|
2029
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
2030
|
+
}
|
|
2031
|
+
if(config.always_on_420ma_active){
|
|
2032
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
2033
|
+
}
|
|
1691
2034
|
break;
|
|
1692
2035
|
case 90:
|
|
1693
2036
|
if(config.sensor_boot_time_420ma_active){
|
|
@@ -1708,6 +2051,12 @@ module.exports = function(RED) {
|
|
|
1708
2051
|
if(config.auto_check_threshold_88_active){
|
|
1709
2052
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1710
2053
|
}
|
|
2054
|
+
if(config.fsr_420ma_active){
|
|
2055
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
2056
|
+
}
|
|
2057
|
+
if(config.always_on_420ma_active){
|
|
2058
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
2059
|
+
}
|
|
1711
2060
|
break;
|
|
1712
2061
|
case 91:
|
|
1713
2062
|
if(config.sensor_boot_time_78_active){
|
|
@@ -1733,6 +2082,12 @@ module.exports = function(RED) {
|
|
|
1733
2082
|
if(config.auto_check_threshold_88_active){
|
|
1734
2083
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1735
2084
|
}
|
|
2085
|
+
if(config.fsr_420ma_active){
|
|
2086
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
2087
|
+
}
|
|
2088
|
+
if(config.always_on_420ma_active){
|
|
2089
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
2090
|
+
}
|
|
1736
2091
|
break;
|
|
1737
2092
|
case 96:
|
|
1738
2093
|
if(config.sensor_boot_time_420ma_active){
|
|
@@ -1753,6 +2108,12 @@ module.exports = function(RED) {
|
|
|
1753
2108
|
if(config.auto_check_threshold_88_active){
|
|
1754
2109
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1755
2110
|
}
|
|
2111
|
+
if(config.fsr_420ma_active){
|
|
2112
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
2113
|
+
}
|
|
2114
|
+
if(config.always_on_420ma_active){
|
|
2115
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
2116
|
+
}
|
|
1756
2117
|
break;
|
|
1757
2118
|
case 97:
|
|
1758
2119
|
if(config.raw_length_97_active){
|
|
@@ -1860,6 +2221,12 @@ module.exports = function(RED) {
|
|
|
1860
2221
|
if(config.auto_check_threshold_88_active){
|
|
1861
2222
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1862
2223
|
}
|
|
2224
|
+
if(config.fsr_420ma_active){
|
|
2225
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
2226
|
+
}
|
|
2227
|
+
if(config.always_on_420ma_active){
|
|
2228
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
2229
|
+
}
|
|
1863
2230
|
break;
|
|
1864
2231
|
case 106:
|
|
1865
2232
|
if(config.sensor_boot_time_420ma_active){
|
|
@@ -1880,6 +2247,12 @@ module.exports = function(RED) {
|
|
|
1880
2247
|
if(config.auto_check_threshold_88_active){
|
|
1881
2248
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1882
2249
|
}
|
|
2250
|
+
if(config.fsr_420ma_active){
|
|
2251
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
2252
|
+
}
|
|
2253
|
+
if(config.always_on_420ma_active){
|
|
2254
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
2255
|
+
}
|
|
1883
2256
|
break;
|
|
1884
2257
|
case 107:
|
|
1885
2258
|
if(config.sensor_boot_time_420ma_active){
|
|
@@ -1900,6 +2273,12 @@ module.exports = function(RED) {
|
|
|
1900
2273
|
if(config.auto_check_threshold_88_active){
|
|
1901
2274
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1902
2275
|
}
|
|
2276
|
+
if(config.fsr_420ma_active){
|
|
2277
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
2278
|
+
}
|
|
2279
|
+
if(config.always_on_420ma_active){
|
|
2280
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
2281
|
+
}
|
|
1903
2282
|
break;
|
|
1904
2283
|
case 108:
|
|
1905
2284
|
if(config.accelerometer_state_108_active){
|
|
@@ -1960,16 +2339,19 @@ module.exports = function(RED) {
|
|
|
1960
2339
|
promises.quality_of_service_108 = node.config_gateway.config_set_quality_of_service_108(mac, parseInt(config.quality_of_service_108));
|
|
1961
2340
|
}
|
|
1962
2341
|
if(config.fly_interval_108_active){
|
|
1963
|
-
|
|
1964
|
-
|
|
2342
|
+
promises.fly_interval_108 = node.config_gateway.config_set_fly_interval_108(mac, parseInt(config.fly_interval_108));
|
|
2343
|
+
}
|
|
1965
2344
|
if(config.sample_rate_108_active){
|
|
1966
|
-
|
|
1967
|
-
|
|
2345
|
+
promises.sample_rate_108 = node.config_gateway.config_set_sample_rate_108(mac, parseInt(config.sample_rate_108));
|
|
2346
|
+
}
|
|
1968
2347
|
break;
|
|
1969
2348
|
case 110:
|
|
1970
2349
|
if(config.odr_p1_110_active){
|
|
1971
2350
|
promises.odr_p1_110 = node.config_gateway.config_set_odr_p1_110(mac, parseInt(config.odr_p1_110));
|
|
1972
2351
|
}
|
|
2352
|
+
if(config.enable_filtering_110_active){
|
|
2353
|
+
promises.enable_filtering_110 = node.config_gateway.config_set_enable_filtering_110(mac, parseInt(config.enable_filtering_110));
|
|
2354
|
+
}
|
|
1973
2355
|
if(config.sampling_duration_p1_110_active){
|
|
1974
2356
|
promises.sampling_duration_p1_110 = node.config_gateway.config_set_sampling_duration_p1_110(mac, parseInt(config.sampling_duration_p1_110));
|
|
1975
2357
|
}
|
|
@@ -1991,9 +2373,6 @@ module.exports = function(RED) {
|
|
|
1991
2373
|
if(config.high_pass_filter_p1_110_active){
|
|
1992
2374
|
promises.high_pass_filter_p1_110 = node.config_gateway.config_set_high_pass_filter_p1_110(mac, parseInt(config.high_pass_filter_p1_110));
|
|
1993
2375
|
}
|
|
1994
|
-
if(config.measurement_mode_80_active){
|
|
1995
|
-
promises.measurement_mode = node.config_gateway.config_set_measurement_mode_80(mac, parseInt(config.measurement_mode_80));
|
|
1996
|
-
}
|
|
1997
2376
|
if(config.on_request_timeout_80_active){
|
|
1998
2377
|
promises.on_request_timeout = node.config_gateway.config_set_on_request_timeout_80(mac, parseInt(config.on_request_timeout_80));
|
|
1999
2378
|
}
|
|
@@ -2038,6 +2417,9 @@ module.exports = function(RED) {
|
|
|
2038
2417
|
if(config.odr_p1_110_active){
|
|
2039
2418
|
promises.odr_p1_111 = node.config_gateway.config_set_odr_p1_110(mac, parseInt(config.odr_p1_110));
|
|
2040
2419
|
}
|
|
2420
|
+
if(config.enable_filtering_110_active){
|
|
2421
|
+
promises.enable_filtering_111 = node.config_gateway.config_set_enable_filtering_110(mac, parseInt(config.enable_filtering_110));
|
|
2422
|
+
}
|
|
2041
2423
|
if(config.sampling_duration_p1_110_active){
|
|
2042
2424
|
promises.sampling_duration_p1_111 = node.config_gateway.config_set_sampling_duration_p1_110(mac, parseInt(config.sampling_duration_p1_110));
|
|
2043
2425
|
}
|
|
@@ -2071,9 +2453,6 @@ module.exports = function(RED) {
|
|
|
2071
2453
|
if(config.high_pass_filter_p2_110_active){
|
|
2072
2454
|
promises.high_pass_filter_p2_111 = node.config_gateway.config_set_high_pass_filter_p2_110(mac, parseInt(config.high_pass_filter_p2_110));
|
|
2073
2455
|
}
|
|
2074
|
-
if(config.measurement_mode_80_active){
|
|
2075
|
-
promises.measurement_mode = node.config_gateway.config_set_measurement_mode_80(mac, parseInt(config.measurement_mode_80));
|
|
2076
|
-
}
|
|
2077
2456
|
if(config.on_request_timeout_80_active){
|
|
2078
2457
|
promises.on_request_timeout = node.config_gateway.config_set_on_request_timeout_80(mac, parseInt(config.on_request_timeout_80));
|
|
2079
2458
|
}
|
|
@@ -2127,6 +2506,9 @@ module.exports = function(RED) {
|
|
|
2127
2506
|
if(config.odr_p1_110_active){
|
|
2128
2507
|
promises.odr_p1_112 = node.config_gateway.config_set_odr_p1_110(mac, parseInt(config.odr_p1_110));
|
|
2129
2508
|
}
|
|
2509
|
+
if(config.enable_filtering_110_active){
|
|
2510
|
+
promises.enable_filtering_112 = node.config_gateway.config_set_enable_filtering_110(mac, parseInt(config.enable_filtering_110));
|
|
2511
|
+
}
|
|
2130
2512
|
if(config.sampling_duration_p1_110_active){
|
|
2131
2513
|
promises.sampling_duration_p1_112 = node.config_gateway.config_set_sampling_duration_p1_110(mac, parseInt(config.sampling_duration_p1_110));
|
|
2132
2514
|
}
|
|
@@ -2148,9 +2530,6 @@ module.exports = function(RED) {
|
|
|
2148
2530
|
if(config.high_pass_filter_p1_110_active){
|
|
2149
2531
|
promises.high_pass_filter_p1_112 = node.config_gateway.config_set_high_pass_filter_p1_110(mac, parseInt(config.high_pass_filter_p1_110));
|
|
2150
2532
|
}
|
|
2151
|
-
if(config.measurement_mode_80_active){
|
|
2152
|
-
promises.measurement_mode = node.config_gateway.config_set_measurement_mode_80(mac, parseInt(config.measurement_mode_80));
|
|
2153
|
-
}
|
|
2154
2533
|
if(config.on_request_timeout_80_active){
|
|
2155
2534
|
promises.on_request_timeout = node.config_gateway.config_set_on_request_timeout_80(mac, parseInt(config.on_request_timeout_80));
|
|
2156
2535
|
}
|
|
@@ -2216,6 +2595,9 @@ module.exports = function(RED) {
|
|
|
2216
2595
|
if(config.odr_p1_110_active){
|
|
2217
2596
|
promises.odr_p1_114 = node.config_gateway.config_set_odr_p1_110(mac, parseInt(config.odr_p1_110));
|
|
2218
2597
|
}
|
|
2598
|
+
if(config.enable_filtering_110_active){
|
|
2599
|
+
promises.enable_filtering_114 = node.config_gateway.config_set_enable_filtering_110(mac, parseInt(config.enable_filtering_110));
|
|
2600
|
+
}
|
|
2219
2601
|
if(config.sampling_duration_p1_110_active){
|
|
2220
2602
|
promises.sampling_duration_p1_114 = node.config_gateway.config_set_sampling_duration_p1_110(mac, parseInt(config.sampling_duration_p1_110));
|
|
2221
2603
|
}
|
|
@@ -2237,9 +2619,6 @@ module.exports = function(RED) {
|
|
|
2237
2619
|
if(config.high_pass_filter_p1_110_active){
|
|
2238
2620
|
promises.high_pass_filter_p1_114 = node.config_gateway.config_set_high_pass_filter_p1_110(mac, parseInt(config.high_pass_filter_p1_110));
|
|
2239
2621
|
}
|
|
2240
|
-
if(config.measurement_mode_80_active){
|
|
2241
|
-
promises.measurement_mode = node.config_gateway.config_set_measurement_mode_80(mac, parseInt(config.measurement_mode_80));
|
|
2242
|
-
}
|
|
2243
2622
|
if(config.on_request_timeout_80_active){
|
|
2244
2623
|
promises.on_request_timeout = node.config_gateway.config_set_on_request_timeout_80(mac, parseInt(config.on_request_timeout_80));
|
|
2245
2624
|
}
|
|
@@ -2323,6 +2702,40 @@ module.exports = function(RED) {
|
|
|
2323
2702
|
promises.alert_threshold_120 = node.config_gateway.config_set_alert_threshold_120(mac, parseInt(config.alert_threshold_120));
|
|
2324
2703
|
}
|
|
2325
2704
|
break;
|
|
2705
|
+
case 121:
|
|
2706
|
+
if(config.wood_type_121_active){
|
|
2707
|
+
promises.wood_type_121 = node.config_gateway.config_set_wood_type_121(mac, parseInt(config.wood_type_121));
|
|
2708
|
+
}
|
|
2709
|
+
if(config.quality_of_service_121_active){
|
|
2710
|
+
promises.quality_of_service_121 = node.config_gateway.config_set_quality_of_service_121(mac, parseInt(config.quality_of_service_121));
|
|
2711
|
+
}
|
|
2712
|
+
break;
|
|
2713
|
+
case 122:
|
|
2714
|
+
if(config.sensor_boot_time_420ma_active){
|
|
2715
|
+
promises.sensor_boot_time_420ma_122 = node.config_gateway.config_set_sensor_boot_time_420ma(mac, parseInt(config.sensor_boot_time_420ma));
|
|
2716
|
+
}
|
|
2717
|
+
if(config.low_calibration_420ma_active){
|
|
2718
|
+
promises.low_calibration_420ma_122 = node.config_gateway.config_set_low_calibration_420ma(mac, parseInt(config.low_calibration_420ma));
|
|
2719
|
+
}
|
|
2720
|
+
if(config.mid_calibration_420ma_active){
|
|
2721
|
+
promises.mid_calibration_420ma_122 = node.config_gateway.config_set_mid_calibration_420ma(mac, parseInt(config.mid_calibration_420ma));
|
|
2722
|
+
}
|
|
2723
|
+
if(config.high_calibration_420ma_active){
|
|
2724
|
+
promises.high_calibration_420ma_122 = node.config_gateway.config_set_high_calibration_420ma(mac, parseInt(config.high_calibration_420ma));
|
|
2725
|
+
}
|
|
2726
|
+
if(config.auto_check_interval_88_active){
|
|
2727
|
+
promises.auto_check_interval_122 = node.config_gateway.config_set_auto_check_interval_88(mac, parseInt(config.auto_check_interval_88));
|
|
2728
|
+
}
|
|
2729
|
+
if(config.auto_check_threshold_88_active){
|
|
2730
|
+
promises.auto_check_threshold_122 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
2731
|
+
}
|
|
2732
|
+
if(config.fsr_420ma_active){
|
|
2733
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
2734
|
+
}
|
|
2735
|
+
if(config.always_on_420ma_active){
|
|
2736
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
2737
|
+
}
|
|
2738
|
+
break;
|
|
2326
2739
|
case 180:
|
|
2327
2740
|
if(config.output_data_rate_101_active){
|
|
2328
2741
|
promises.output_data_rate_101 = node.config_gateway.config_set_output_data_rate_101(mac, parseInt(config.output_data_rate_101));
|
|
@@ -2433,6 +2846,12 @@ module.exports = function(RED) {
|
|
|
2433
2846
|
if(config.high_calibration_420ma_active){
|
|
2434
2847
|
promises.high_calibration_420ma = node.config_gateway.config_set_high_calibration_420ma(mac, parseInt(config.high_calibration_420ma));
|
|
2435
2848
|
}
|
|
2849
|
+
if(config.fsr_420ma_active){
|
|
2850
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
2851
|
+
}
|
|
2852
|
+
if(config.always_on_420ma_active){
|
|
2853
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
2854
|
+
}
|
|
2436
2855
|
break;
|
|
2437
2856
|
case 202:
|
|
2438
2857
|
if(config.sampling_interval_202_active){
|
|
@@ -2446,13 +2865,13 @@ module.exports = function(RED) {
|
|
|
2446
2865
|
}
|
|
2447
2866
|
break;
|
|
2448
2867
|
case 217:
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2868
|
+
if(config.tare_the_scale_217){
|
|
2869
|
+
promises.tare_the_scale_217 = node.config_gateway.config_set_tare_the_scale_217(mac);
|
|
2870
|
+
}
|
|
2871
|
+
if(config.weight_calib_217_active){
|
|
2872
|
+
promises.weight_calib_217 = node.config_gateway.config_set_weight_calib_217(mac, parseInt(config.weight_calib_217));
|
|
2873
|
+
}
|
|
2874
|
+
break;
|
|
2456
2875
|
case 505:
|
|
2457
2876
|
if(config.current_calibration_c1_80_active){
|
|
2458
2877
|
promises.current_calibration_c1_80_active = node.config_gateway.config_set_current_calibration_individual_80(mac, parseInt(config.current_calibration_c1_80), 1);
|
|
@@ -2696,6 +3115,12 @@ module.exports = function(RED) {
|
|
|
2696
3115
|
if(config.auto_check_threshold_88_active){
|
|
2697
3116
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
2698
3117
|
}
|
|
3118
|
+
if(config.fsr_420ma_active){
|
|
3119
|
+
promises.fsr_420ma = node.config_gateway.config_set_fsr_420ma(mac, parseInt(config.fsr_420ma));
|
|
3120
|
+
}
|
|
3121
|
+
if(config.always_on_420ma_active){
|
|
3122
|
+
promises.always_on_420ma = node.config_gateway.config_set_always_on_420ma(mac, parseInt(config.always_on_420ma));
|
|
3123
|
+
}
|
|
2699
3124
|
break;
|
|
2700
3125
|
case 1010:
|
|
2701
3126
|
if(config.stay_on_mode_539_active){
|
|
@@ -2746,7 +3171,7 @@ module.exports = function(RED) {
|
|
|
2746
3171
|
}
|
|
2747
3172
|
}
|
|
2748
3173
|
// These sensors listed in original_otf_devices use a different OTF code.
|
|
2749
|
-
let original_otf_devices = [53, 80, 81, 82, 83, 84, 101, 102, 110, 111, 112, 114, 180, 181, 518, 519, 520, 538];
|
|
3174
|
+
let original_otf_devices = [53, 80, 81, 82, 83, 84, 101, 102, 110, 111, 112, 114, 117, 180, 181, 518, 519, 520, 538];
|
|
2750
3175
|
// If we changed the network ID reboot the sensor to take effect.
|
|
2751
3176
|
// TODO if we add the encryption key command to node-red we need to reboot for it as well.
|
|
2752
3177
|
if(reboot){
|
|
@@ -3059,9 +3484,10 @@ module.exports = function(RED) {
|
|
|
3059
3484
|
for(var p in pgm_events){
|
|
3060
3485
|
node.config_gateway._emitter.removeAllListeners(p);
|
|
3061
3486
|
}
|
|
3487
|
+
|
|
3062
3488
|
node.gateway_node.close_comms();
|
|
3063
3489
|
if(typeof node.config_gateway_node != 'undefined'){
|
|
3064
|
-
node.config_gateway_node.close_comms();
|
|
3490
|
+
console.log(node.config_gateway_node.close_comms());
|
|
3065
3491
|
}
|
|
3066
3492
|
});
|
|
3067
3493
|
}
|