@ncd-io/node-red-enterprise-sensors 1.1.0 → 1.1.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 +590 -36
- package/package.json +2 -2
- package/wireless.html +319 -38
- package/wireless.js +177 -32
package/wireless.js
CHANGED
|
@@ -41,7 +41,14 @@ module.exports = function(RED) {
|
|
|
41
41
|
if(!config.ip_address){
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
if(!config.tcp_inactive_timeout){
|
|
45
|
+
config.tcp_inactive_timeout = 1200;
|
|
46
|
+
}
|
|
47
|
+
if(config.tcp_inactive_timeout_active){
|
|
48
|
+
var comm = new comms.NcdTCP(config.ip_address, this.port, false, parseInt(config.tcp_inactive_timeout));
|
|
49
|
+
}else{
|
|
50
|
+
var comm = new comms.NcdTCP(config.ip_address, this.port, false, false);
|
|
51
|
+
}
|
|
45
52
|
comm._emitter.on('error', (err) => {
|
|
46
53
|
console.log('tcp init error', err);
|
|
47
54
|
});
|
|
@@ -671,7 +678,8 @@ module.exports = function(RED) {
|
|
|
671
678
|
// OFF: {fill:"green",shape:"dot",text:"OFF Recieved, OTF Configuration Completed"}
|
|
672
679
|
FLY: {fill:"yellow",shape:"ring",text:"FLY"},
|
|
673
680
|
OTN: {fill:"yellow",shape:"ring",text:"OTN Received, Config Entered"},
|
|
674
|
-
OTF: {fill:"green",shape:"dot",text:"OTF Received, Config Complete"}
|
|
681
|
+
OTF: {fill:"green",shape:"dot",text:"OTF Received, Config Complete"},
|
|
682
|
+
UPTHWRN: {fill:"yellow",shape:"ring",text:"Threshold is low"}
|
|
675
683
|
};
|
|
676
684
|
var events = {};
|
|
677
685
|
var pgm_events = {};
|
|
@@ -694,7 +702,7 @@ module.exports = function(RED) {
|
|
|
694
702
|
|
|
695
703
|
var promises = {};
|
|
696
704
|
// This command is used for OTF on types 53, 80,81,82,83,84, 101, 102, 110, 111, 518, 519
|
|
697
|
-
let original_otf_devices = [53, 80, 81, 82, 83, 84, 101, 102, 110, 111, 112, 114, 180, 181, 518, 519, 520, 538];
|
|
705
|
+
let original_otf_devices = [53, 80, 81, 82, 83, 84, 97, 98, 101, 102, 110, 111, 112, 114, 180, 181, 518, 519, 520, 538];
|
|
698
706
|
if(original_otf_devices.includes(sensor.type)){
|
|
699
707
|
// This command is used for OTF on types 53, 80, 81, 82, 83, 84, 101, 102, 110, 111, 518, 519
|
|
700
708
|
promises.config_enter_otn_mode = node.config_gateway.config_enter_otn_mode(sensor.mac);
|
|
@@ -851,6 +859,26 @@ module.exports = function(RED) {
|
|
|
851
859
|
promises.change_detection = node.config_gateway.config_set_change_detection(mac, config.change_enabled ? 1 : 0, parseInt(config.change_pr), parseInt(config.change_interval));
|
|
852
860
|
}
|
|
853
861
|
break;
|
|
862
|
+
case 4:
|
|
863
|
+
if(config.thermocouple_type_23_active){
|
|
864
|
+
promises.thermocouple_type_4 = node.config_gateway.config_set_thermocouple_type_23(mac, parseInt(config.thermocouple_type_23));
|
|
865
|
+
}
|
|
866
|
+
if(config.filter_thermocouple_active){
|
|
867
|
+
promises.filter_thermocouple_4 = node.config_gateway.config_set_filter_thermocouple(mac, parseInt(config.filter_thermocouple));
|
|
868
|
+
}
|
|
869
|
+
if(config.cold_junction_thermocouple_active){
|
|
870
|
+
promises.cold_junction_thermocouple_4 = node.config_gateway.config_set_cold_junction_thermocouple(mac, parseInt(config.cold_junction_thermocouple));
|
|
871
|
+
}
|
|
872
|
+
if(config.sample_resolution_thermocouple_active){
|
|
873
|
+
promises.sample_resolution_thermocouple_4 = node.config_gateway.config_set_sample_resolution_thermocouple(mac, parseInt(config.sample_resolution_thermocouple));
|
|
874
|
+
}
|
|
875
|
+
if(config.number_of_samples_thermocouple_active){
|
|
876
|
+
promises.number_of_samples_thermocouple_4 = node.config_gateway.config_set_number_of_samples_thermocouple(mac, parseInt(config.number_of_samples_thermocouple));
|
|
877
|
+
}
|
|
878
|
+
if(config.measurement_type_thermocouple_active){
|
|
879
|
+
promises.measurement_type_thermocouple_4 = node.config_gateway.config_set_measurement_type_thermocouple(mac, parseInt(config.measurement_type_thermocouple));
|
|
880
|
+
}
|
|
881
|
+
break;
|
|
854
882
|
case 5:
|
|
855
883
|
promises.acceleration_range = node.config_gateway.config_set_amgt_accel(mac, parseInt(config.amgt_accel));
|
|
856
884
|
promises.magnetometer_gain = node.config_gateway.config_set_amgt_magnet(mac, parseInt(config.amgt_mag));
|
|
@@ -885,6 +913,26 @@ module.exports = function(RED) {
|
|
|
885
913
|
promises.change_detection = node.config_gateway.config_set_change_detection(mac, config.change_enabled ? 1 : 0, parseInt(config.change_pr), parseInt(config.change_interval));
|
|
886
914
|
}
|
|
887
915
|
break;
|
|
916
|
+
case 12:
|
|
917
|
+
if(config.thermocouple_type_23_active){
|
|
918
|
+
promises.thermocouple_type_12 = node.config_gateway.config_set_thermocouple_type_23(mac, parseInt(config.thermocouple_type_23));
|
|
919
|
+
}
|
|
920
|
+
if(config.filter_thermocouple_active){
|
|
921
|
+
promises.filter_thermocouple_12 = node.config_gateway.config_set_filter_thermocouple(mac, parseInt(config.filter_thermocouple));
|
|
922
|
+
}
|
|
923
|
+
if(config.cold_junction_thermocouple_active){
|
|
924
|
+
promises.cold_junction_thermocouple_12 = node.config_gateway.config_set_cold_junction_thermocouple(mac, parseInt(config.cold_junction_thermocouple));
|
|
925
|
+
}
|
|
926
|
+
if(config.sample_resolution_thermocouple_active){
|
|
927
|
+
promises.sample_resolution_thermocouple_12 = node.config_gateway.config_set_sample_resolution_thermocouple(mac, parseInt(config.sample_resolution_thermocouple));
|
|
928
|
+
}
|
|
929
|
+
if(config.number_of_samples_thermocouple_active){
|
|
930
|
+
promises.number_of_samples_thermocouple_12 = node.config_gateway.config_set_number_of_samples_thermocouple(mac, parseInt(config.number_of_samples_thermocouple));
|
|
931
|
+
}
|
|
932
|
+
if(config.measurement_type_thermocouple_active){
|
|
933
|
+
promises.measurement_type_thermocouple_12 = node.config_gateway.config_set_measurement_type_thermocouple(mac, parseInt(config.measurement_type_thermocouple));
|
|
934
|
+
}
|
|
935
|
+
break;
|
|
888
936
|
case 13:
|
|
889
937
|
if(config.current_calibration_13_active){
|
|
890
938
|
var cali = parseInt(config.current_calibration_13);
|
|
@@ -967,11 +1015,32 @@ module.exports = function(RED) {
|
|
|
967
1015
|
// promises.current_calibration_ch2_19_dep = node.config_gateway.config_set_current_calibration_ch2_19_dep(mac, cali);
|
|
968
1016
|
// }
|
|
969
1017
|
// }
|
|
1018
|
+
if(config.change_detection_t3_active){
|
|
1019
|
+
promises.change_detection = node.config_gateway.config_set_change_detection(mac, config.change_enabled ? 1 : 0, parseInt(config.change_pr), parseInt(config.change_interval));
|
|
1020
|
+
}
|
|
1021
|
+
if(config.change_detection_ch2_active){
|
|
1022
|
+
promises.change_detection_ch2 = node.config_gateway.config_set_change_detection_ch2(mac, config.change_enabled_ch2 ? 1 : 0, parseInt(config.change_pr_ch2), parseInt(config.change_interval_ch2));
|
|
1023
|
+
}
|
|
970
1024
|
break;
|
|
971
1025
|
case 23:
|
|
972
1026
|
if(config.thermocouple_type_23_active){
|
|
973
1027
|
promises.thermocouple_type_23 = node.config_gateway.config_set_thermocouple_type_23(mac, parseInt(config.thermocouple_type_23));
|
|
974
1028
|
}
|
|
1029
|
+
if(config.filter_thermocouple_active){
|
|
1030
|
+
promises.filter_thermocouple_23 = node.config_gateway.config_set_filter_thermocouple(mac, parseInt(config.filter_thermocouple));
|
|
1031
|
+
}
|
|
1032
|
+
if(config.cold_junction_thermocouple_active){
|
|
1033
|
+
promises.cold_junction_thermocouple_23 = node.config_gateway.config_set_cold_junction_thermocouple(mac, parseInt(config.cold_junction_thermocouple));
|
|
1034
|
+
}
|
|
1035
|
+
if(config.sample_resolution_thermocouple_active){
|
|
1036
|
+
promises.sample_resolution_thermocouple_23 = node.config_gateway.config_set_sample_resolution_thermocouple(mac, parseInt(config.sample_resolution_thermocouple));
|
|
1037
|
+
}
|
|
1038
|
+
if(config.number_of_samples_thermocouple_active){
|
|
1039
|
+
promises.number_of_samples_thermocouple_23 = node.config_gateway.config_set_number_of_samples_thermocouple(mac, parseInt(config.number_of_samples_thermocouple));
|
|
1040
|
+
}
|
|
1041
|
+
if(config.measurement_type_thermocouple_active){
|
|
1042
|
+
promises.measurement_type_thermocouple_23 = node.config_gateway.config_set_measurement_type_thermocouple(mac, parseInt(config.measurement_type_thermocouple));
|
|
1043
|
+
}
|
|
975
1044
|
break;
|
|
976
1045
|
case 24:
|
|
977
1046
|
if(config.impact_accel_active){
|
|
@@ -1608,25 +1677,51 @@ module.exports = function(RED) {
|
|
|
1608
1677
|
promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1609
1678
|
}
|
|
1610
1679
|
break;
|
|
1611
|
-
case
|
|
1612
|
-
if(config.
|
|
1613
|
-
promises.
|
|
1680
|
+
case 97:
|
|
1681
|
+
if(config.raw_length_97_active){
|
|
1682
|
+
promises.raw_length_97 = node.config_gateway.config_set_raw_length_97(mac, parseInt(config.raw_length_97));
|
|
1614
1683
|
}
|
|
1615
|
-
if(config.
|
|
1616
|
-
promises.
|
|
1684
|
+
if(config.raw_timeout_97_active){
|
|
1685
|
+
promises.raw_timeout_97 = node.config_gateway.config_set_raw_timeout_97(mac, parseInt(config.raw_timeout_97));
|
|
1617
1686
|
}
|
|
1618
|
-
if(config.
|
|
1619
|
-
promises.
|
|
1687
|
+
if(config.fly_rate_97_active){
|
|
1688
|
+
promises.fly_rate_97 = node.config_gateway.config_set_fly_rate_97(mac, parseInt(config.fly_rate_97));
|
|
1620
1689
|
}
|
|
1621
|
-
if(config.
|
|
1622
|
-
promises.
|
|
1690
|
+
if(config.boot_up_time_97_active){
|
|
1691
|
+
promises.boot_up_time_97 = node.config_gateway.config_set_boot_up_time_97(mac, parseInt(config.boot_up_time_97));
|
|
1623
1692
|
}
|
|
1624
|
-
|
|
1625
|
-
|
|
1693
|
+
break;
|
|
1694
|
+
case 98:
|
|
1695
|
+
if(config.raw_length_97_active){
|
|
1696
|
+
promises.raw_length_97 = node.config_gateway.config_set_raw_length_97(mac, parseInt(config.raw_length_97));
|
|
1626
1697
|
}
|
|
1627
|
-
if(config.
|
|
1628
|
-
promises.
|
|
1698
|
+
if(config.raw_timeout_97_active){
|
|
1699
|
+
promises.raw_timeout_97 = node.config_gateway.config_set_raw_timeout_97(mac, parseInt(config.raw_timeout_97));
|
|
1700
|
+
}
|
|
1701
|
+
if(config.fly_rate_97_active){
|
|
1702
|
+
promises.fly_rate_97 = node.config_gateway.config_set_fly_rate_97(mac, parseInt(config.fly_rate_97));
|
|
1629
1703
|
}
|
|
1704
|
+
if(config.boot_up_time_97_active){
|
|
1705
|
+
promises.boot_up_time_97 = node.config_gateway.config_set_boot_up_time_97(mac, parseInt(config.boot_up_time_97));
|
|
1706
|
+
}
|
|
1707
|
+
// if(config.sensor_boot_time_420ma_active){
|
|
1708
|
+
// promises.sensor_boot_time_420ma = node.config_gateway.config_set_sensor_boot_time_420ma(mac, parseInt(config.sensor_boot_time_420ma));
|
|
1709
|
+
// }
|
|
1710
|
+
// if(config.low_calibration_420ma_active){
|
|
1711
|
+
// promises.low_calibration_420ma = node.config_gateway.config_set_low_calibration_420ma(mac, parseInt(config.low_calibration_420ma));
|
|
1712
|
+
// }
|
|
1713
|
+
// if(config.mid_calibration_420ma_active){
|
|
1714
|
+
// promises.mid_calibration_420ma = node.config_gateway.config_set_mid_calibration_420ma(mac, parseInt(config.mid_calibration_420ma));
|
|
1715
|
+
// }
|
|
1716
|
+
// if(config.high_calibration_420ma_active){
|
|
1717
|
+
// promises.high_calibration_420ma = node.config_gateway.config_set_high_calibration_420ma(mac, parseInt(config.high_calibration_420ma));
|
|
1718
|
+
// }
|
|
1719
|
+
// if(config.auto_check_interval_88_active){
|
|
1720
|
+
// promises.auto_check_interval_88 = node.config_gateway.config_set_auto_check_interval_88(mac, parseInt(config.auto_check_interval_88));
|
|
1721
|
+
// }
|
|
1722
|
+
// if(config.auto_check_threshold_88_active){
|
|
1723
|
+
// promises.auto_check_threshold_88 = node.config_gateway.config_set_auto_check_threshold_88(mac, parseInt(config.auto_check_threshold_88));
|
|
1724
|
+
// }
|
|
1630
1725
|
break;
|
|
1631
1726
|
case 101:
|
|
1632
1727
|
if(config.output_data_rate_101_m2_active){
|
|
@@ -1751,9 +1846,6 @@ module.exports = function(RED) {
|
|
|
1751
1846
|
if(config.push_notification_108_active){
|
|
1752
1847
|
promises.push_notification_108 = node.config_gateway.config_set_push_notification_108(mac, parseInt(config.push_notification_108));
|
|
1753
1848
|
}
|
|
1754
|
-
if(config.qos_108_active){
|
|
1755
|
-
promises.qos_108 = node.config_gateway.config_set_qos_108(mac, parseInt(config.qos_108));
|
|
1756
|
-
}
|
|
1757
1849
|
if(config.deactivate_activate_accelero_108_active){
|
|
1758
1850
|
promises.deactivate_activate_accelero_108 = node.config_gateway.config_set_deactivate_activate_accelero_108(mac, parseInt(config.deactivate_activate_accelero_108));
|
|
1759
1851
|
}
|
|
@@ -1831,8 +1923,8 @@ module.exports = function(RED) {
|
|
|
1831
1923
|
if(config.auto_raw_destination_110_active){
|
|
1832
1924
|
promises.auto_raw_destination_110 = node.config_gateway.config_set_auto_raw_destination_110(mac, parseInt(config.auto_raw_destination_110, 16));
|
|
1833
1925
|
}
|
|
1834
|
-
if(config.
|
|
1835
|
-
promises.
|
|
1926
|
+
if(config.clear_probe_uptimers_110){
|
|
1927
|
+
promises.clear_probe_uptimers = node.config_gateway.config_set_clear_probe_uptimers_110(mac);
|
|
1836
1928
|
}
|
|
1837
1929
|
if(config.smart_interval_110_active){
|
|
1838
1930
|
promises.smart_interval_110 = node.config_gateway.config_set_smart_interval_110(mac, parseInt(config.smart_interval_110));
|
|
@@ -1905,8 +1997,8 @@ module.exports = function(RED) {
|
|
|
1905
1997
|
if(config.auto_raw_destination_110_active){
|
|
1906
1998
|
promises.auto_raw_destination_110 = node.config_gateway.config_set_auto_raw_destination_110(mac, parseInt(config.auto_raw_destination_110, 16));
|
|
1907
1999
|
}
|
|
1908
|
-
if(config.
|
|
1909
|
-
promises.
|
|
2000
|
+
if(config.clear_probe_uptimers_110){
|
|
2001
|
+
promises.clear_probe_uptimers = node.config_gateway.config_set_clear_probe_uptimers_110(mac);
|
|
1910
2002
|
}
|
|
1911
2003
|
if(config.smart_interval_110_active){
|
|
1912
2004
|
promises.smart_interval_110 = node.config_gateway.config_set_smart_interval_110(mac, parseInt(config.smart_interval_110));
|
|
@@ -1914,6 +2006,9 @@ module.exports = function(RED) {
|
|
|
1914
2006
|
if(config.smart_threshold_110_active){
|
|
1915
2007
|
promises.smart_threshold_110 = node.config_gateway.config_set_smart_threshold_110(mac, parseInt(config.smart_threshold_110));
|
|
1916
2008
|
}
|
|
2009
|
+
if(config.smart_threshold_p2_110_active){
|
|
2010
|
+
promises.smart_threshold_p2_110 = node.config_gateway.config_set_smart_threshold_p2_110(mac, parseInt(config.smart_threshold_p2_110));
|
|
2011
|
+
}
|
|
1917
2012
|
if(config.fly_interval_110_active){
|
|
1918
2013
|
promises.fly_interval_110 = node.config_gateway.config_set_fly_interval_110(mac, parseInt(config.fly_interval_110));
|
|
1919
2014
|
}
|
|
@@ -1970,8 +2065,8 @@ module.exports = function(RED) {
|
|
|
1970
2065
|
if(config.auto_raw_destination_110_active){
|
|
1971
2066
|
promises.auto_raw_destination_110 = node.config_gateway.config_set_auto_raw_destination_110(mac, parseInt(config.auto_raw_destination_110, 16));
|
|
1972
2067
|
}
|
|
1973
|
-
if(config.
|
|
1974
|
-
promises.
|
|
2068
|
+
if(config.clear_probe_uptimers_110){
|
|
2069
|
+
promises.clear_probe_uptimers = node.config_gateway.config_set_clear_probe_uptimers_110(mac);
|
|
1975
2070
|
}
|
|
1976
2071
|
if(config.smart_interval_110_active){
|
|
1977
2072
|
promises.smart_interval_110 = node.config_gateway.config_set_smart_interval_110(mac, parseInt(config.smart_interval_110));
|
|
@@ -2044,8 +2139,8 @@ module.exports = function(RED) {
|
|
|
2044
2139
|
if(config.auto_raw_destination_110_active){
|
|
2045
2140
|
promises.auto_raw_destination_110 = node.config_gateway.config_set_auto_raw_destination_110(mac, parseInt(config.auto_raw_destination_110, 16));
|
|
2046
2141
|
}
|
|
2047
|
-
if(config.
|
|
2048
|
-
promises.
|
|
2142
|
+
if(config.clear_probe_uptimers_110){
|
|
2143
|
+
promises.clear_probe_uptimers = node.config_gateway.config_set_clear_probe_uptimers_110(mac);
|
|
2049
2144
|
}
|
|
2050
2145
|
if(config.smart_interval_110_active){
|
|
2051
2146
|
promises.smart_interval_110 = node.config_gateway.config_set_smart_interval_110(mac, parseInt(config.smart_interval_110));
|
|
@@ -2057,6 +2152,23 @@ module.exports = function(RED) {
|
|
|
2057
2152
|
promises.fly_interval_110 = node.config_gateway.config_set_fly_interval_110(mac, parseInt(config.fly_interval_110));
|
|
2058
2153
|
}
|
|
2059
2154
|
break;
|
|
2155
|
+
case 118:
|
|
2156
|
+
if(config.pressure_sensor_fs_ch1_118_active){
|
|
2157
|
+
promises.pressure_sensor_fs_ch1_118 = node.config_gateway.config_set_pressure_sensor_fs_ch1_118(mac, parseInt(config.pressure_sensor_fs_ch1_118));
|
|
2158
|
+
}
|
|
2159
|
+
if(config.pressure_sensor_fs_ch2_118_active){
|
|
2160
|
+
promises.pressure_sensor_fs_ch2_118 = node.config_gateway.config_set_pressure_sensor_fs_ch2_118(mac, parseInt(config.pressure_sensor_fs_ch2_118));
|
|
2161
|
+
}
|
|
2162
|
+
if(config.auto_check_interval_118_active){
|
|
2163
|
+
promises.auto_check_interval_118 = node.config_gateway.config_set_auto_check_interval_118(mac, parseInt(config.auto_check_interval_118));
|
|
2164
|
+
}
|
|
2165
|
+
if(config.press_auto_check_percent_118_active){
|
|
2166
|
+
promises.press_auto_check_percent_118 = node.config_gateway.config_set_press_auto_check_percent_118(mac, parseInt(config.press_auto_check_percent_118));
|
|
2167
|
+
}
|
|
2168
|
+
if(config.temp_auto_check_percent_118_active){
|
|
2169
|
+
promises.temp_auto_check_percent_118 = node.config_gateway.config_set_temp_auto_check_percent_118(mac, parseInt(config.temp_auto_check_percent_118));
|
|
2170
|
+
}
|
|
2171
|
+
break;
|
|
2060
2172
|
case 180:
|
|
2061
2173
|
if(config.output_data_rate_101_active){
|
|
2062
2174
|
promises.output_data_rate_101 = node.config_gateway.config_set_output_data_rate_101(mac, parseInt(config.output_data_rate_101));
|
|
@@ -2371,6 +2483,12 @@ module.exports = function(RED) {
|
|
|
2371
2483
|
if(config.baudrate_539_active){
|
|
2372
2484
|
promises.baudrate_539 = node.config_gateway.config_set_baudrate_539(mac, parseInt(config.baudrate_539));
|
|
2373
2485
|
}
|
|
2486
|
+
if(config.stop_bit_1011_active){
|
|
2487
|
+
promises.stop_bit_1011 = node.config_gateway.config_set_stop_bit_1011(mac, parseInt(config.stop_bit_1011));
|
|
2488
|
+
}
|
|
2489
|
+
if(config.set_parity_1011_active){
|
|
2490
|
+
promises.set_parity_1011 = node.config_gateway.config_set_parity_1011(mac, parseInt(config.set_parity_1011));
|
|
2491
|
+
}
|
|
2374
2492
|
if(config.rx_timeout_539_active){
|
|
2375
2493
|
promises.rx_timeout_539 = node.config_gateway.config_set_rx_timeout_539(mac, parseInt(config.rx_timeout_539));
|
|
2376
2494
|
}
|
|
@@ -2466,7 +2584,7 @@ module.exports = function(RED) {
|
|
|
2466
2584
|
}
|
|
2467
2585
|
}
|
|
2468
2586
|
// These sensors listed in original_otf_devices use a different OTF code.
|
|
2469
|
-
let original_otf_devices = [53, 80, 81, 82, 83, 84, 101, 102, 110, 111, 112, 114, 180, 181, 518, 519, 520, 538];
|
|
2587
|
+
let original_otf_devices = [53, 80, 81, 82, 83, 84, 97, 98, 101, 102, 110, 111, 112, 114, 180, 181, 518, 519, 520, 538];
|
|
2470
2588
|
// If we changed the network ID reboot the sensor to take effect.
|
|
2471
2589
|
// TODO if we add the encryption key command to node-red we need to reboot for it as well.
|
|
2472
2590
|
if(reboot){
|
|
@@ -2491,7 +2609,30 @@ module.exports = function(RED) {
|
|
|
2491
2609
|
for(var i in promises){
|
|
2492
2610
|
(function(name){
|
|
2493
2611
|
promises[name].then((f) => {
|
|
2494
|
-
if(name != 'finish')
|
|
2612
|
+
if(name != 'finish'){
|
|
2613
|
+
// console.log('IN PROMISE RESOLVE');
|
|
2614
|
+
// console.log(f);
|
|
2615
|
+
// success[name] = true;
|
|
2616
|
+
if(Object.hasOwn(f, 'result')){
|
|
2617
|
+
switch(f.result){
|
|
2618
|
+
case 255:
|
|
2619
|
+
success[name] = true;
|
|
2620
|
+
break;
|
|
2621
|
+
default:
|
|
2622
|
+
success[name] = {
|
|
2623
|
+
res: "Bad Response",
|
|
2624
|
+
result: f.result,
|
|
2625
|
+
sent: f.sent
|
|
2626
|
+
};
|
|
2627
|
+
}
|
|
2628
|
+
}else{
|
|
2629
|
+
success[name] = {
|
|
2630
|
+
res: "no result",
|
|
2631
|
+
result: null,
|
|
2632
|
+
sent: f.sent
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2495
2636
|
else{
|
|
2496
2637
|
// #OTF
|
|
2497
2638
|
node.send({topic: 'Config Results', payload: success, time: Date.now(), addr: mac});
|
|
@@ -2574,9 +2715,13 @@ module.exports = function(RED) {
|
|
|
2574
2715
|
// _send_otn_request(sensor);
|
|
2575
2716
|
// Sensors having issues seeing OTN request sent too quickly
|
|
2576
2717
|
// Added timeout to fix issue
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
}
|
|
2718
|
+
if(config.sensor_type == 1010 || config.sensor_type == 1011){
|
|
2719
|
+
_config(sensor, true);
|
|
2720
|
+
}else{
|
|
2721
|
+
var tout = setTimeout(() => {
|
|
2722
|
+
_send_otn_request(sensor);
|
|
2723
|
+
}, 100);
|
|
2724
|
+
}
|
|
2580
2725
|
}else if(config.auto_config && config.on_the_fly_enable && sensor.mode == "OTN"){
|
|
2581
2726
|
if(config.sensor_type == 101 || config.sensor_type == 102 || config.sensor_type == 202){
|
|
2582
2727
|
if(this.gateway.hasOwnProperty('fly_101_in_progress') && this.gateway.fly_101_in_progress == false || !this.gateway.hasOwnProperty('fly_101_in_progress')){
|