@ncd-io/node-red-enterprise-sensors 0.1.1 → 0.1.3
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 +33 -5
- package/package.json +1 -1
- package/wireless.html +17 -0
- package/wireless.js +5 -0
package/lib/WirelessGateway.js
CHANGED
|
@@ -741,6 +741,14 @@ module.exports = class WirelessSensor{
|
|
|
741
741
|
var packet = [244, 4, 0, 0, 0, reading_type];
|
|
742
742
|
return this.config_send(sensor_mac, packet);
|
|
743
743
|
}
|
|
744
|
+
config_set_motion_threshold_46(sensor_mac, value){
|
|
745
|
+
console.log('config_set_motion_threshold_46');
|
|
746
|
+
let packet = [244, 1, 0, 0, 0];
|
|
747
|
+
let threshold = int2Bytes((value), 4);
|
|
748
|
+
packet.push(...threshold);
|
|
749
|
+
console.log(packet);
|
|
750
|
+
return this.config_send(sensor_mac, packet);
|
|
751
|
+
}
|
|
744
752
|
|
|
745
753
|
config_set_sensor_forced_calibration(sensor_mac, value){
|
|
746
754
|
var packet = [244, 31, 0, 0, 0];
|
|
@@ -2467,7 +2475,7 @@ function sensor_types(parent){
|
|
|
2467
2475
|
return;
|
|
2468
2476
|
}
|
|
2469
2477
|
}
|
|
2470
|
-
else{
|
|
2478
|
+
else if(payload[8] === 0 || payload[8] === 2){
|
|
2471
2479
|
// mode byte most significant bit will indicate fft data.
|
|
2472
2480
|
// console.log(d);
|
|
2473
2481
|
var odr;
|
|
@@ -2534,6 +2542,10 @@ function sensor_types(parent){
|
|
|
2534
2542
|
z_peak_three_Hz: payload.slice(52, 54).reduce(msbLsb),
|
|
2535
2543
|
};
|
|
2536
2544
|
}
|
|
2545
|
+
else{
|
|
2546
|
+
parsed.data = {'error': 'Vibration mode error'}
|
|
2547
|
+
return parsed;
|
|
2548
|
+
}
|
|
2537
2549
|
},
|
|
2538
2550
|
'parse_fly': (frame) => {
|
|
2539
2551
|
let frame_data = {};
|
|
@@ -3034,7 +3046,7 @@ function sensor_types(parent){
|
|
|
3034
3046
|
return;
|
|
3035
3047
|
}
|
|
3036
3048
|
}
|
|
3037
|
-
else{
|
|
3049
|
+
else if(payload[8] === 0 || payload[8] === 2){
|
|
3038
3050
|
// mode byte most significant bit will indicate fft data.
|
|
3039
3051
|
// console.log(d);
|
|
3040
3052
|
var odr1;
|
|
@@ -3171,6 +3183,10 @@ function sensor_types(parent){
|
|
|
3171
3183
|
z2_peak_three_Hz: payload.slice(97, 99).reduce(msbLsb)
|
|
3172
3184
|
};
|
|
3173
3185
|
}
|
|
3186
|
+
else{
|
|
3187
|
+
parsed.data = {'error': 'Vibration mode error'}
|
|
3188
|
+
return parsed;
|
|
3189
|
+
}
|
|
3174
3190
|
},
|
|
3175
3191
|
'parse_fly': (frame) => {
|
|
3176
3192
|
let frame_data = {};
|
|
@@ -3766,7 +3782,7 @@ function sensor_types(parent){
|
|
|
3766
3782
|
return;
|
|
3767
3783
|
}
|
|
3768
3784
|
}
|
|
3769
|
-
else{
|
|
3785
|
+
else if(payload[8] === 0 || payload[8] === 2){
|
|
3770
3786
|
// mode byte most significant bit will indicate fft data.
|
|
3771
3787
|
// console.log(d);
|
|
3772
3788
|
var odr;
|
|
@@ -3834,6 +3850,10 @@ function sensor_types(parent){
|
|
|
3834
3850
|
z_peak_three_Hz: payload.slice(60, 62).reduce(msbLsb),
|
|
3835
3851
|
};
|
|
3836
3852
|
}
|
|
3853
|
+
else{
|
|
3854
|
+
parsed.data = {'error': 'Vibration mode error'}
|
|
3855
|
+
return parsed;
|
|
3856
|
+
}
|
|
3837
3857
|
},
|
|
3838
3858
|
'parse_fly': (frame) => {
|
|
3839
3859
|
let frame_data = {};
|
|
@@ -4320,7 +4340,7 @@ function sensor_types(parent){
|
|
|
4320
4340
|
return;
|
|
4321
4341
|
}
|
|
4322
4342
|
}
|
|
4323
|
-
else{
|
|
4343
|
+
else if(payload[8] === 0 || payload[8] === 2){
|
|
4324
4344
|
// mode byte most significant bit will indicate fft data.
|
|
4325
4345
|
// console.log(d);
|
|
4326
4346
|
var odr;
|
|
@@ -4387,6 +4407,10 @@ function sensor_types(parent){
|
|
|
4387
4407
|
z_peak_three_Hz: payload.slice(52, 54).reduce(msbLsb),
|
|
4388
4408
|
};
|
|
4389
4409
|
}
|
|
4410
|
+
else{
|
|
4411
|
+
parsed.data = {'error': 'Vibration mode error'}
|
|
4412
|
+
return parsed;
|
|
4413
|
+
}
|
|
4390
4414
|
},
|
|
4391
4415
|
'parse_fly': (frame) => {
|
|
4392
4416
|
let frame_data = {};
|
|
@@ -5138,7 +5162,7 @@ function sensor_types(parent){
|
|
|
5138
5162
|
return;
|
|
5139
5163
|
}
|
|
5140
5164
|
}
|
|
5141
|
-
else{
|
|
5165
|
+
else if(payload[8] === 0 || payload[8] === 2){
|
|
5142
5166
|
// mode byte most significant bit will indicate fft data.
|
|
5143
5167
|
// console.log(d);
|
|
5144
5168
|
var odr;
|
|
@@ -5208,6 +5232,10 @@ function sensor_types(parent){
|
|
|
5208
5232
|
z_peak_three_Hz: payload.slice(56, 58).reduce(msbLsb),
|
|
5209
5233
|
};
|
|
5210
5234
|
}
|
|
5235
|
+
else{
|
|
5236
|
+
parsed.data = {'error': 'Vibration mode error'}
|
|
5237
|
+
return parsed;
|
|
5238
|
+
}
|
|
5211
5239
|
},
|
|
5212
5240
|
'parse_fly': (frame) => {
|
|
5213
5241
|
let frame_data = {};
|
package/package.json
CHANGED
package/wireless.html
CHANGED
|
@@ -320,6 +320,9 @@
|
|
|
320
320
|
|
|
321
321
|
payload_length_80_active:{value:""},
|
|
322
322
|
payload_length_80:{value:3, validate: NCD_validators.number_range(0, 3)},
|
|
323
|
+
|
|
324
|
+
motion_threshold_46_active:{value:""},
|
|
325
|
+
motion_threshold_46:{value: 100, validate: NCD_validators.number_range(0, 4294967295)},
|
|
323
326
|
},
|
|
324
327
|
inputs: 0,
|
|
325
328
|
outputs: 1,
|
|
@@ -1574,6 +1577,20 @@
|
|
|
1574
1577
|
</div>
|
|
1575
1578
|
</div>
|
|
1576
1579
|
</div>
|
|
1580
|
+
<div class="ncd-dependent" data-sensor-46>
|
|
1581
|
+
<hr>
|
|
1582
|
+
<div class="form-row ncd-active-check">
|
|
1583
|
+
<strong>Motion Threshold</strong>
|
|
1584
|
+
<div>
|
|
1585
|
+
<label for="node-input-motion_threshold_46_active">Active:</label>
|
|
1586
|
+
<input type="checkbox" id="node-input-motion_threshold_46_active" class="ncd-config-toggle" data-target-id="node-input-motion_threshold_46" value="1">
|
|
1587
|
+
</div>
|
|
1588
|
+
<div>
|
|
1589
|
+
<label for="node-input-motion_threshold_46"><i class="icon-tag"></i>Value:</label>
|
|
1590
|
+
<input type="text" id="node-input-motion_threshold_46" placeholder="0-4294967295" value="100">
|
|
1591
|
+
</div>
|
|
1592
|
+
</div>
|
|
1593
|
+
</div>
|
|
1577
1594
|
<div class="ncd-dependent" data-sensor-10000 data-sensor-10012>
|
|
1578
1595
|
<div class="form-row">
|
|
1579
1596
|
<button id="config_sensor">Configure Now</button>
|
package/wireless.js
CHANGED
|
@@ -430,6 +430,11 @@ module.exports = function(RED) {
|
|
|
430
430
|
promises.sensor_boot_time_420ma = node.config_gateway.config_set_sensor_boot_time_420ma(mac, parseInt(config.sensor_boot_time_420ma));
|
|
431
431
|
}
|
|
432
432
|
break;
|
|
433
|
+
case 46:
|
|
434
|
+
if(config.motion_threshold_46_active){
|
|
435
|
+
promises.motion_threshold_46 = node.config_gateway.config_set_motion_threshold_46(mac, parseInt(config.motion_threshold_46));
|
|
436
|
+
}
|
|
437
|
+
break;
|
|
433
438
|
case 47:
|
|
434
439
|
if(config.roll_angle_threshold_47_active){
|
|
435
440
|
promises.roll_angle_threshold_47 = node.config_gateway.config_set_roll_threshold_47(mac, parseInt(config.roll_angle_threshold_47));
|