@ncd-io/node-red-enterprise-sensors 0.1.10 → 0.1.12
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 +54 -6
- package/package.json +1 -1
- package/wireless.html +9 -1
- package/wireless.js +21 -45
package/lib/WirelessGateway.js
CHANGED
|
@@ -62,7 +62,7 @@ module.exports = class WirelessSensor{
|
|
|
62
62
|
var new_mode = is_new;
|
|
63
63
|
var mode = (type == 'power_up') ? data.mode : ((type == 'sensor_data') ? 'RUN' : ((type == 'config_ack') ? 'ACK' : 'PGM'));
|
|
64
64
|
// #OTF
|
|
65
|
-
var otf_devices = [78,79,80,81,82,84,89,91,101,102,519,520,521];
|
|
65
|
+
var otf_devices = [45,48,78,79,80,81,82,84,88,89,91,101,102,519,520,521];
|
|
66
66
|
var device_type = msbLsb(frame.data[6], frame.data[7]);
|
|
67
67
|
// var device_type = frame.data[7];
|
|
68
68
|
|
|
@@ -214,7 +214,7 @@ module.exports = class WirelessSensor{
|
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
// #OTF
|
|
217
|
-
var otf_devices = [78,79,80,81,82,84,89,91,101,102,519,520,521];
|
|
217
|
+
var otf_devices = [45,48,78,79,80,81,82,84,88,89,91,101,102,519,520,521];
|
|
218
218
|
if(otf_devices.includes(parsed.sensor_type)){
|
|
219
219
|
// If the message says FLY and there is not FLY timer in progress.
|
|
220
220
|
if(payload[8] == 70 && payload[9] == 76 && payload[10] == 89) {
|
|
@@ -367,17 +367,17 @@ module.exports = class WirelessSensor{
|
|
|
367
367
|
default:
|
|
368
368
|
en_axis_data.increment = 0;
|
|
369
369
|
}
|
|
370
|
-
var fsr_mult = .
|
|
370
|
+
var fsr_mult = 0.000305185;
|
|
371
371
|
var fsr_text = "";
|
|
372
372
|
switch(globalDevices[deviceAddr].fsr){
|
|
373
373
|
case 0:
|
|
374
|
-
fsr_mult = 0.
|
|
374
|
+
fsr_mult = 0.000305185;
|
|
375
375
|
break;
|
|
376
376
|
case 1:
|
|
377
|
-
fsr_mult = 0.
|
|
377
|
+
fsr_mult = 0.00061037;
|
|
378
378
|
break;
|
|
379
379
|
case 2:
|
|
380
|
-
fsr_mult = 0.
|
|
380
|
+
fsr_mult = 0.0012207;
|
|
381
381
|
break;
|
|
382
382
|
}
|
|
383
383
|
switch(globalDevices[deviceAddr].fsr){
|
|
@@ -5010,6 +5010,24 @@ function sensor_types(parent){
|
|
|
5010
5010
|
};
|
|
5011
5011
|
}
|
|
5012
5012
|
},
|
|
5013
|
+
'95': {
|
|
5014
|
+
name: '16-Bit 1-Channel 0-24VDC Receiver',
|
|
5015
|
+
parse: (d) => {
|
|
5016
|
+
return {
|
|
5017
|
+
adc: signInt(d.slice(0, 2).reduce(msbLsb), 16),
|
|
5018
|
+
vdc: signInt(d.slice(2, 4).reduce(msbLsb), 16)/100
|
|
5019
|
+
};
|
|
5020
|
+
}
|
|
5021
|
+
},
|
|
5022
|
+
'96': {
|
|
5023
|
+
name: '16-Bit 1-Channel 0-48VDC Receiver',
|
|
5024
|
+
parse: (d) => {
|
|
5025
|
+
return {
|
|
5026
|
+
adc: signInt(d.slice(0, 2).reduce(msbLsb), 16),
|
|
5027
|
+
vdc: signInt(d.slice(2, 4).reduce(msbLsb), 16)/100
|
|
5028
|
+
};
|
|
5029
|
+
}
|
|
5030
|
+
},
|
|
5013
5031
|
'101':{
|
|
5014
5032
|
name: 'Pro Vibration',
|
|
5015
5033
|
parse: (d, full)=>{
|
|
@@ -5941,6 +5959,36 @@ function sensor_types(parent){
|
|
|
5941
5959
|
}
|
|
5942
5960
|
}
|
|
5943
5961
|
},
|
|
5962
|
+
'524': {
|
|
5963
|
+
name: 'SDI Multi Soil Probe',
|
|
5964
|
+
parse: (payload, parsed) => {
|
|
5965
|
+
return {
|
|
5966
|
+
moisture_1: payload.slice(0, 2).reduce(msbLsb)/100,
|
|
5967
|
+
temp_1: payload.slice(2, 4).reduce(msbLsb)/100,
|
|
5968
|
+
moisture_2: payload.slice(4, 6).reduce(msbLsb)/100,
|
|
5969
|
+
temp_2: payload.slice(6, 8).reduce(msbLsb)/100,
|
|
5970
|
+
moisture_3: payload.slice(8, 10).reduce(msbLsb)/100,
|
|
5971
|
+
temp_3: payload.slice(10, 12).reduce(msbLsb)/100,
|
|
5972
|
+
moisture_4: payload.slice(12, 14).reduce(msbLsb)/100,
|
|
5973
|
+
temp_4: payload.slice(14, 16).reduce(msbLsb)/100,
|
|
5974
|
+
moisture_5: payload.slice(16, 18).reduce(msbLsb)/100,
|
|
5975
|
+
temp_5: payload.slice(18, 20).reduce(msbLsb)/100,
|
|
5976
|
+
moisture_6: payload.slice(20, 22).reduce(msbLsb)/100,
|
|
5977
|
+
temp_6: payload.slice(22, 24).reduce(msbLsb)/100
|
|
5978
|
+
}
|
|
5979
|
+
}
|
|
5980
|
+
},
|
|
5981
|
+
'531': {
|
|
5982
|
+
name: 'Custom Noise Sensor',
|
|
5983
|
+
parse: (d) => {
|
|
5984
|
+
return {
|
|
5985
|
+
noise_db: d[0],
|
|
5986
|
+
peak_freq_1: d.slice(1, 3).reduce(msbLsb),
|
|
5987
|
+
peak_freq_2: d.slice(3, 5).reduce(msbLsb),
|
|
5988
|
+
peak_freq_3: d.slice(5, 7).reduce(msbLsb)
|
|
5989
|
+
};
|
|
5990
|
+
}
|
|
5991
|
+
},
|
|
5944
5992
|
'10000': {
|
|
5945
5993
|
name: '4-Relay',
|
|
5946
5994
|
parse: (d) => {
|
package/package.json
CHANGED
package/wireless.html
CHANGED
|
@@ -423,6 +423,8 @@
|
|
|
423
423
|
"89": "89 - 2 Channel Ultrasound Vibration Sensor",
|
|
424
424
|
"91": "91 - Wireless Air Velocity Sensor HVAC",
|
|
425
425
|
"92": "92 - Sound Sensor",
|
|
426
|
+
"95": "95 - 16-Bit 1-Channel 0-24VDC Receiver",
|
|
427
|
+
"96": "96 - 16-Bit 1-Channel 0-48VDC Receiver",
|
|
426
428
|
"101": "101 - Pro Vibration",
|
|
427
429
|
"102": "102 - Strain Gauge",
|
|
428
430
|
"200": "200 - 4-20mA Pass Through",
|
|
@@ -436,6 +438,8 @@
|
|
|
436
438
|
"519": "519: Custom Vibration 1",
|
|
437
439
|
"520": "520: Custom 6 Channel Current Temperature & Humidity",
|
|
438
440
|
"521": "521 - Custom 3 Channel Light Sensor",
|
|
441
|
+
"524": "524 - SDI Multi Soil Probe",
|
|
442
|
+
"531": "531 - Custom Noise Sensor",
|
|
439
443
|
"10000": "10000 - 4-Channel Relay",
|
|
440
444
|
"10006": "10006 - 4-Channel 4-20 mA Input",
|
|
441
445
|
"10007": "10007 - 4-Channel Current Monitor",
|
|
@@ -668,6 +672,8 @@
|
|
|
668
672
|
<option value="89">89 - 2 Channel Ultrasound Vibration Sensor</option>
|
|
669
673
|
<option value="91">91 - Wireless Air Velocity Sensor HVAC</option>
|
|
670
674
|
<option value="92">92 - Sound Sensor</option>
|
|
675
|
+
<option value="95">95 - 16-Bit 1-Channel 0-24VDC Receiver</option>
|
|
676
|
+
<option value="96">96 - 16-Bit 1-Channel 0-48VDC Receiver</option>
|
|
671
677
|
<option value="101">101 - Pro Vibration</option>
|
|
672
678
|
<option value="102">102 - Strain Gauge</option>
|
|
673
679
|
<option value="200">200 - 4-20mA Pass Through</option>
|
|
@@ -681,6 +687,8 @@
|
|
|
681
687
|
<option value="519">519 - Type 519: Custom Vibration 1</option>
|
|
682
688
|
<option value="520">520 - Type 520: Custom 6 Channel Current Temperature & Humidity</option>
|
|
683
689
|
<option value="521">521 - Custom 3 Channel Light Sensor</option>
|
|
690
|
+
<option value="524">524 - SDI Multi Soil Probe</option>
|
|
691
|
+
<option value="531">531 - Custom Noise Sensor</option>
|
|
684
692
|
<option value="10000">10000 - 4-Channel Relay</option>
|
|
685
693
|
<option value="10006">10006 - 4-Channel 4-20 mA Input</option>
|
|
686
694
|
<option value="10007">10007 - 4-Channel Current Monitor</option>
|
|
@@ -694,7 +702,7 @@
|
|
|
694
702
|
<label for="node-input-auto_config"><i class="icon-tag"></i> Auto Config</label>
|
|
695
703
|
<input class="section-control" type="checkbox" id="node-input-auto_config" value="1">
|
|
696
704
|
</div>
|
|
697
|
-
<div class="form-row ncd-dependent" data-sensor-78 data-sensor-79 data-sensor-80 data-sensor-81 data-sensor-82 data-sensor-84 data-sensor-88 data-sensor-89 data-sensor-91 data-sensor-101 data-sensor-102 data-sensor-519 data-sensor-520 data-sensor-521>
|
|
705
|
+
<div class="form-row ncd-dependent" data-sensor-45 data-sensor-48 data-sensor-78 data-sensor-79 data-sensor-80 data-sensor-81 data-sensor-82 data-sensor-84 data-sensor-88 data-sensor-89 data-sensor-91 data-sensor-101 data-sensor-102 data-sensor-519 data-sensor-520 data-sensor-521>
|
|
698
706
|
<hr>
|
|
699
707
|
<label for="node-input-on_the_fly_enable"><i class="icon-tag"></i> OTF Config*</label>
|
|
700
708
|
<input type="checkbox" id="node-input-on_the_fly_enable" value="1">
|
package/wireless.js
CHANGED
|
@@ -775,6 +775,7 @@ module.exports = function(RED) {
|
|
|
775
775
|
if(config.sensor_boot_time_78_active){
|
|
776
776
|
promises.sensor_boot_time_78 = node.config_gateway.config_set_sensor_boot_time_78(mac, parseInt(config.sensor_boot_time_78));
|
|
777
777
|
}
|
|
778
|
+
break;
|
|
778
779
|
case 101:
|
|
779
780
|
if(config.output_data_rate_101_m2_active){
|
|
780
781
|
promises.output_data_rate_101_m2 = node.config_gateway.config_set_output_data_rate_101(mac, parseInt(config.output_data_rate_101_m2));
|
|
@@ -1007,52 +1008,40 @@ module.exports = function(RED) {
|
|
|
1007
1008
|
var tout = setTimeout(() => {
|
|
1008
1009
|
_send_otn_request(sensor);
|
|
1009
1010
|
}, 100);
|
|
1010
|
-
}else if(sensor.mode == "FLY" && config.sensor_type == 101 || sensor.mode == "FLY" && config.sensor_type == 102){
|
|
1011
|
-
// send broadcast rtc to 101 and 102 regardless of settings
|
|
1012
|
-
if(this.gateway.hasOwnProperty('fly_101_in_progress') && this.gateway.fly_101_in_progress == false || !this.gateway.hasOwnProperty('fly_101_in_progress')){
|
|
1013
|
-
var broadcast_tout = setTimeout(() => {
|
|
1014
|
-
_send_otn_request(sensor);
|
|
1015
|
-
}, 100);
|
|
1016
|
-
}
|
|
1017
1011
|
}else if(config.auto_config && config.on_the_fly_enable && sensor.mode == "OTN"){
|
|
1018
1012
|
if(config.sensor_type == 101 || config.sensor_type == 102){
|
|
1019
1013
|
if(this.gateway.hasOwnProperty('fly_101_in_progress') && this.gateway.fly_101_in_progress == false || !this.gateway.hasOwnProperty('fly_101_in_progress')){
|
|
1020
1014
|
this.gateway.fly_101_in_progress = true;
|
|
1021
|
-
node.warn('
|
|
1015
|
+
node.warn('Starting RTC Timer' + Date.now());
|
|
1016
|
+
node.warn('Sensor checked in for RTC: ' + sensor.mac + ' at ' + Date.now());
|
|
1022
1017
|
var broadcast_tout = setTimeout(() => {
|
|
1023
|
-
node.warn('
|
|
1018
|
+
node.warn('Sending RTC Broadcast ' + Date.now());
|
|
1024
1019
|
_broadcast_rtc(sensor);
|
|
1025
1020
|
}, 2000);
|
|
1026
1021
|
}else{
|
|
1027
|
-
node.warn('
|
|
1022
|
+
node.warn('Sensor checked in for RTC: ' + sensor.mac + ' at ' + Date.now());
|
|
1028
1023
|
}
|
|
1024
|
+
|
|
1029
1025
|
if(config.auto_config && config.on_the_fly_enable){
|
|
1030
1026
|
var tout = setTimeout(() => {
|
|
1031
|
-
node.warn('
|
|
1027
|
+
node.warn('Proceeding with normal configs' + Date.now());
|
|
1032
1028
|
_config(sensor, true);
|
|
1033
1029
|
}, 3500);
|
|
1034
1030
|
}
|
|
1035
1031
|
}else{
|
|
1036
1032
|
_config(sensor, true);
|
|
1037
1033
|
}
|
|
1038
|
-
} else if(config.sensor_type == 101 && sensor.mode == "
|
|
1034
|
+
} else if(config.sensor_type == 101 && sensor.mode == "FLY" || config.sensor_type == 102 && sensor.mode == "FLY"){
|
|
1039
1035
|
if(this.gateway.hasOwnProperty('fly_101_in_progress') && this.gateway.fly_101_in_progress == false || !this.gateway.hasOwnProperty('fly_101_in_progress')){
|
|
1040
1036
|
this.gateway.fly_101_in_progress = true;
|
|
1041
|
-
node.warn('
|
|
1037
|
+
node.warn('Starting RTC Timer' + Date.now());
|
|
1038
|
+
node.warn('Sensor checked in for RTC: ' + sensor.mac + ' at ' + Date.now());
|
|
1042
1039
|
var broadcast_tout = setTimeout(() => {
|
|
1043
|
-
node.warn('
|
|
1040
|
+
node.warn('Sending RTC Broadcast ' + Date.now());
|
|
1044
1041
|
_broadcast_rtc(sensor);
|
|
1045
|
-
var otf_timeout = setTimeout(() => {
|
|
1046
|
-
node.warn('Sending OTF request ' + Date.now());
|
|
1047
|
-
this.config_gateway.config_exit_otn_mode(sensor.mac);
|
|
1048
|
-
}, 1000);
|
|
1049
1042
|
}, 2000);
|
|
1050
1043
|
}else{
|
|
1051
|
-
node.warn('
|
|
1052
|
-
var otf_timeout = setTimeout(() => {
|
|
1053
|
-
node.warn('Sending OTF request ' + Date.now());
|
|
1054
|
-
this.config_gateway.config_exit_otn_mode(sensor.mac);
|
|
1055
|
-
}, 3000);
|
|
1044
|
+
node.warn('Sensor checked in for RTC: ' + sensor.mac + ' at ' + Date.now());
|
|
1056
1045
|
}
|
|
1057
1046
|
}
|
|
1058
1047
|
});
|
|
@@ -1125,24 +1114,18 @@ module.exports = function(RED) {
|
|
|
1125
1114
|
var tout = setTimeout(() => {
|
|
1126
1115
|
_send_otn_request(sensor);
|
|
1127
1116
|
}, 100);
|
|
1128
|
-
}else if(sensor.mode == "FLY" && config.sensor_type == 101 || sensor.mode == "FLY" && config.sensor_type == 102){
|
|
1129
|
-
// send broadcast rtc to 101 and 102 regardless of settings
|
|
1130
|
-
if(this.gateway.hasOwnProperty('fly_101_in_progress') && this.gateway.fly_101_in_progress == false || !this.gateway.hasOwnProperty('fly_101_in_progress')){
|
|
1131
|
-
var broadcast_tout = setTimeout(() => {
|
|
1132
|
-
_send_otn_request(sensor);
|
|
1133
|
-
}, 100);
|
|
1134
|
-
}
|
|
1135
1117
|
}else if(config.auto_config && config.on_the_fly_enable && sensor.mode == "OTN"){
|
|
1136
1118
|
if(config.sensor_type == 101 || config.sensor_type == 102){
|
|
1137
1119
|
if(this.gateway.hasOwnProperty('fly_101_in_progress') && this.gateway.fly_101_in_progress == false || !this.gateway.hasOwnProperty('fly_101_in_progress')){
|
|
1138
1120
|
this.gateway.fly_101_in_progress = true;
|
|
1139
|
-
node.warn('
|
|
1121
|
+
node.warn('Starting RTC Timer' + Date.now());
|
|
1122
|
+
node.warn('Sensor checked in for RTC: ' + sensor.mac + ' at ' + Date.now());
|
|
1140
1123
|
var broadcast_tout = setTimeout(() => {
|
|
1141
|
-
node.warn('
|
|
1124
|
+
node.warn('Sending RTC Broadcast ' + Date.now());
|
|
1142
1125
|
_broadcast_rtc(sensor);
|
|
1143
1126
|
}, 2000);
|
|
1144
1127
|
}else{
|
|
1145
|
-
node.warn('
|
|
1128
|
+
node.warn('Sensor checked in for RTC: ' + sensor.mac + ' at ' + Date.now());
|
|
1146
1129
|
}
|
|
1147
1130
|
if(config.auto_config && config.on_the_fly_enable){
|
|
1148
1131
|
var tout = setTimeout(() => {
|
|
@@ -1154,24 +1137,17 @@ module.exports = function(RED) {
|
|
|
1154
1137
|
_config(sensor, true);
|
|
1155
1138
|
}
|
|
1156
1139
|
|
|
1157
|
-
}else if(
|
|
1140
|
+
}else if(sensor.mode == "FLY" && config.sensor_type == 101 || sensor.mode == "FLY" && config.sensor_type == 102){
|
|
1158
1141
|
if(this.gateway.hasOwnProperty('fly_101_in_progress') && this.gateway.fly_101_in_progress == false || !this.gateway.hasOwnProperty('fly_101_in_progress')){
|
|
1159
1142
|
this.gateway.fly_101_in_progress = true;
|
|
1160
|
-
node.warn('
|
|
1143
|
+
node.warn('Starting RTC Timer' + Date.now());
|
|
1144
|
+
node.warn('Sensor checked in for RTC: ' + sensor.mac + ' at ' + Date.now());
|
|
1161
1145
|
var broadcast_tout = setTimeout(() => {
|
|
1162
|
-
node.warn('
|
|
1146
|
+
node.warn('Sending RTC Broadcast ' + Date.now());
|
|
1163
1147
|
_broadcast_rtc(sensor);
|
|
1164
|
-
var otf_timeout = setTimeout(() => {
|
|
1165
|
-
node.warn('Sending OTF request ' + Date.now());
|
|
1166
|
-
this.config_gateway.config_exit_otn_mode(sensor.mac);
|
|
1167
|
-
}, 1000);
|
|
1168
1148
|
}, 2000);
|
|
1169
1149
|
}else{
|
|
1170
|
-
node.warn('
|
|
1171
|
-
var otf_timeout = setTimeout(() => {
|
|
1172
|
-
node.warn('Sending OTF request ' + Date.now());
|
|
1173
|
-
this.config_gateway.config_exit_otn_mode(sensor.mac);
|
|
1174
|
-
}, 3000);
|
|
1150
|
+
node.warn('Sensor checked in for RTC: ' + sensor.mac + ' at ' + Date.now());
|
|
1175
1151
|
}
|
|
1176
1152
|
}
|
|
1177
1153
|
}
|