-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwireless.html
4616 lines (4477 loc) · 207 KB
/
wireless.html
1
2
3
4
5
6
7
8
9
10
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<script type="text/javascript">
RED.nodes.registerType('ncd-gateway-node',{
category: 'NCD',
color: '#a6bbcf',
icon: "serial.png",
paletteLabel: "Wireless Gateway",
outputLabels: ["Parsed","Unknown"],
defaults: {
name: {value: ""},
connection: {value: "", type: "ncd-gateway-config"},
unknown_devices: {value:0},
outputs:{value:1}
},
inputs: 1,
outputs: 1,
label: function() {
return this.name || "Wireless Gateway";
},
oneditsave: function(){
this.outputs = $("#node-input-unknown_devices").is(':checked') ? 2 : 1;
},
button: {
enabled: function() {
return true;
},
onclick: function() {
if (this.changed) {
return RED.notify(RED._("notification.warning", {message:RED._("notification.warnings.undeployedChanges")}),"warning");
}
var label = this.name;
if (label.length > 30) {
label = label.substring(0,50)+"...";
}
label = label.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
if (this.payloadType === "date") { label = this._("inject.timestamp"); }
if (this.payloadType === "none") { label = this._("inject.blank"); }
var node = this;
$.ajax({
url: "ncd/wireless/gateway/config/"+this.id,
type:"POST",
success: function(resp) {
RED.notify(node._("Modem "+resp,{label:label}),"success");
},
error: function(jqXHR,textStatus,errorThrown) {
RED.notify(node._("common.notification.error",{message:node._("common.notification.errors.not-deployed")}),"error");
}
});
}
},
});
</script>
<script type="text/x-red" data-template-name="ncd-gateway-node">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-connection"><i class="icon-tag"></i> Serial Device</label>
<select id="node-input-connection"></select>
</div>
<div class="form-row">
<label for="node-input-unknown_devices"><i class="icon-tag"></i> Output data from Unknown Devices</label>
<input type="checkbox" id="node-input-unknown_devices" value="1">
</div>
</script>
<style>
.ncd-active-check strong{
width: 100%;
}
.form-row.ncd-active-check{
margin: 12px 0px;
border: 1px solid #eee;
padding: 12px;
border-radius: 8px;
}
.form-row.ncd-active-check > div{
padding: 4px;
}
.form-row.ncd-active-check > div > input[type='checkbox']{
width: inherit;
}
.form-row .caption{
font-size: .95em;
padding-left: 1em;
margin-top: .25em;
}
#register_list_539 > div{
display: none;
}
</style>
<script type="text/x-red" data-help-name="ncd-gateway-node">
<h3>Gateway Node</h3>
<p>This node is primarily useful for debugging and configuring sensors. This node is equipped with a button on the flow that switches the modem between configuration and listening mode.</p>
<h3>Output</h3>
<p>Any time sensor data is received from any sensor on the network, this node will output a message containing all pertinant information as in the example below.</p>
<h3>Input</h3>
<p>The Input connection to this Gateway node allows for sending data to devices. The input connection expects the payload to be an object containging an address and data variable. Address is a string representation of the destination device. Data is a byte array of data to be transmitted as payload to that device. Example "payload":{"address":"00:13:A2:00:01:02:03:04",data:[254,108,1]}</p>
<pre>
msg = {
topic: "sensor_data",
payload: {
nodeId: 0,
firmware: 3,
battery: 3.2940600000000004,
counter: 37,
sensor_type: 1,
sensor_data: {
humidity: 45.51,
temperature: 23.91,
},
type: "sensor_data",
addr: "00:13:a2:00:41:07:18:81",
original: {
mac: "00:13:a2:00:41:07:18:81",
receive_options: {
ack: 0,
broadcast: 0,
type: ""
}
},
data: [127,0,3,3,255,37,0,1,0,17,199,9,87],
type: "receive_packet"
},
_msgid: "391caba.5a19454"
}
</pre>
</script>
<script type="text/javascript">
NCD_validators = {
number_range: function(l, h, base, property_name = false){
if(!base) base = 10;
if(property_name === 'smart_threshold_110'){
return function(v){
var int = parseInt(v, base);
if(this.smart_threshold_110 == 0){
console.log('ERROR: Invalid property detect. Setting smart_threshold_110 to default value');
$("#node-input-smart_threshold_110").val(1);
return true;
} else if(v == undefined){
return true;
}
return int >= l && int <= h;
}
}
if(property_name === 'acceleration_interrupt_threshold_84'){
return function(v){
var int = parseInt(v, base);
if(this.acceleration_interrupt_threshold_84 == 0){
console.log('ERROR: Invalid property detect. Setting smart_threshold_110 to default value');
$("#node-input-acceleration_interrupt_threshold_84").val(0);
return true;
} else if(v == undefined){
return true;
}
return int >= l && int <= h;
}
}
if(base == 'decimal'){
return function(v){
var n = parseFloat(v);
return n >= l && n <= h;
}
}else{
return function(v){
var int = parseInt(v, base);
// Added to remove new settings from interfering with old nodes
if(v == undefined){
return true;
}
return int >= l && int <= h;
}
}
}
}
RED.nodes.registerType('ncd-wireless-node',{
category: 'NCD',
color: '#a6bbcf',
icon: "serial.png",
paletteLabel: "Wireless Device",
defaults: {
name: {value: ""},
connection: {value: "", type: "ncd-gateway-config"},
config_comm: {value: "", type: "ncd-gateway-config", required: false},
addr: {value: ""},
sensor_type: {value: ""},
auto_config: {value: ""},
on_the_fly_enable: {value: ""},
node_id_delay_active: {value: ""},
node_id: {value: 0, validate: NCD_validators.number_range(0, 255)},//0 - 255
delay: {value: 300, validate: NCD_validators.number_range(0, 16777215)},//1 - 16777215
form_network: {value: ""},
destination_active: {value: ""},
destination: {value: '0000FFFF', validate: NCD_validators.number_range(0, 0xFFFFFFFF, 16)},//(0 - 0xFFFFFFFF)
power_active: {value: ""},
power: {value: 4},//(0 - 4)
retries_active: {value: ""},
retries: {value: 10, validate: NCD_validators.number_range(0, 16)},//(0 - 16)
pan_id_active: {value: ""},
pan_id: {value: '7FFF', validate: NCD_validators.number_range(0, 0x7FFF, 16)},//(0 - 0x7FFF)
change_detection_t3_active: {value: ""},
change_enabled: {value: ""},
change_pr: {value: "0", validate: NCD_validators.number_range(0, 255)},
change_interval: {value: "0", validate: NCD_validators.number_range(0, 16712198)},
change_detection_ch2_active: {value: ""},
change_enabled_ch2: {value: ""},
change_pr_ch2: {value: "0", validate: NCD_validators.number_range(0, 255)},
change_interval_ch2: {value: "0", validate: NCD_validators.number_range(0, 16712198)},
change_detection_ch3_active: {value: ""},
change_enabled_ch3: {value: ""},
change_pr_ch3: {value: "0", validate: NCD_validators.number_range(0, 255)},
change_interval_ch3: {value: "0", validate: NCD_validators.number_range(0, 16712198)},
current_calibration_13_active: {value: ""},
current_calibration_13: {value: "60600", validate: NCD_validators.number_range(0, 42949672)},
current_calibration_13_dep_active: {value: ""},
current_calibration_13_dep: {value: "60600", validate: NCD_validators.number_range(0, 65535)},
current_calibration_ch2_19_active: {value: ""},
current_calibration_ch2_19: {value: "60600", validate: NCD_validators.number_range(0, 42949672)},
current_calibration_ch2_19_dep_active: {value: ""},
current_calibration_ch2_19_dep: {value: "60600", validate: NCD_validators.number_range(0, 65535)},
current_calibration_ch3_28_active: {value: ""},
current_calibration_ch3_28: {value: "60600", validate: NCD_validators.number_range(0, 42949672)},
current_calibration_ch3_28_dep_active: {value: ""},
current_calibration_ch3_28_dep: {value: "60600", validate: NCD_validators.number_range(0, 65535)},
bp_altitude: {value: "0", validate: NCD_validators.number_range(0, 65535)},
bp_pressure: {value: "0", validate: NCD_validators.number_range(0, 14000)},
bp_temp_prec: {value: "0"},
bp_press_prec: {value: "0"},
amgt_accel: {value: "0"},
amgt_mag: {value: "0"},
amgt_gyro: {value: "0"},
impact_accel_active: {value: ""},
impact_accel: {value: "0"},
impact_data_rate_active: {value: ""},
impact_data_rate: {value: "4"},
impact_threshold_active: {value: ""},
impact_threshold: {value: 25, validate: NCD_validators.number_range(1, 127)},
impact_duration_active: {value: ""},
impact_duration: {value: 1, validate: NCD_validators.number_range(1, 127)},
activ_interr_x: {value: 1, validate: RED.validators.number()},
activ_interr_y: {value: 2, validate: RED.validators.number()},
activ_interr_z: {value: 4, validate: RED.validators.number()},
activ_interr_op: {value: 8, validate: RED.validators.number()},
force_calibration_co2_auto_config: {value: ""},
force_calibration_co2: {value: 400, validate: NCD_validators.number_range(400, 2000)},
force_calibration_co2_535_active: {value: ""},
temperature_offset_44_active: {value: ""},
temperature_offset_44: {value: 4, validate: NCD_validators.number_range(0, 25)},
filtering: {value: 0, validate: RED.validators.number()},
data_rate: {value: 5, validate: RED.validators.number()},
time_series: {value: 0, validate: RED.validators.number()},
reading_type: {value: 1, validate: RED.validators.number()},
mode_80_active: {value: ""},
mode_80: {value: 0},
periodic_check_rate_76_active: {value: ""},
periodic_check_rate_76: {value: 60, validate: NCD_validators.number_range(60, 255)},
ppm_threshold_76_active: {value: ""},
ppm_threshold_76: {value: 100, validate: NCD_validators.number_range(0, 1000)},
alert_duration_76_active: {value: ""},
alert_duration_76: {value: 0, validate: NCD_validators.number_range(0, 255)},
ppm_threshold_76_active: {value: ""},
ppm_threshold_76: {value: 100, validate: NCD_validators.number_range(0, 1000)},
sensor_boot_time_76_active: {value: ""},
sensor_boot_time_76: {value: 30, validate: NCD_validators.number_range(0, 255)},
measurement_mode_80_active: {value: ""},
measurement_mode_80: {value: 0},
on_request_timeout_80_active: {value: ""},
on_request_timeout_80: {value: 1, validate: NCD_validators.number_range(1, 10, 10, 'on_request_timeout_80')},
sensor_boot_time_420ma_active: {value: ""},
sensor_boot_time_420ma: {value: 0, validate: NCD_validators.number_range(0, 255)},
sensor_boot_time_78_active: {value: ""},
sensor_boot_time_78: {value: 0, validate: NCD_validators.number_range(0, 255)},
deadband_80_active: {value: ""},
deadband_80: {value: 0, validate: NCD_validators.number_range(0, 255)},
auto_check_interval_88_active: {value: ""},
auto_check_interval_88: {value: 60, validate: NCD_validators.number_range(0, 65535)},
auto_check_threshold_88_active: {value: ""},
auto_check_threshold_88: {value: 20, validate: NCD_validators.number_range(0, 100)},
filter_80_active: {value: ""},
filter_80: {value: 0},
output_data_rate_p1_81_active: {value: ""},
output_data_rate_p1_81: {value: 0},
output_data_rate_p2_81_active: {value: ""},
output_data_rate_p2_81: {value: 0},
sampling_duration_p1_81_active: {value: ""},
sampling_duration_p1_81: {value: 0},
sampling_duration_p2_81_active: {value: ""},
sampling_duration_p2_81: {value: 0},
led_alert_mode_84_active: {value: ""},
led_alert_mode_84: {value: 0},
led_accelerometer_threshold_84_active: {value: ""},
led_accelerometer_threshold_84: {},
led_velocity_threshold_84_active: {value: ""},
led_velocity_threshold_84: {},
set_rtc_101:{value:0},
set_rtc_202:{value:0},
current_calibration_82:{Value:0},
current_calibration_82_active:{Value:""},
current_calibration_c1_80:{value:178, validate: NCD_validators.number_range(0, 655)},
current_calibration_c1_80_active:{value:""},
current_calibration_c2_80:{value:178, validate: NCD_validators.number_range(0, 655)},
current_calibration_c2_80_active:{value:""},
current_calibration_c3_80:{value:178, validate: NCD_validators.number_range(0, 655)},
current_calibration_c3_80_active:{value:""},
current_calibration_c2_82:{Value:0, validate: NCD_validators.number_range(0, 655)},
current_calibration_c2_82_active:{Value:""},
current_calibration_c3_82:{Value:0, validate: NCD_validators.number_range(0, 655)},
current_calibration_c3_82_active:{Value:""},
output_data_rate_101_active: {value: ""},
output_data_rate_101: {value: 0},
output_data_rate_101_m2_active: {value: ""},
output_data_rate_101_m2: {value: 0},
sampling_duration_101_active: {value: ""},
sampling_duration_101: {value: 1, validate: NCD_validators.number_range(1, 255)},
sampling_interval_101_active: {value: ""},
sampling_interval_101: {value: 1},
sampling_interval_202_active: {value: ""},
sampling_interval_202: {value: 1},
probe_boot_time_202_active: {value: ""},
probe_boot_time_202: {value: 30, validate: NCD_validators.number_range(0, 255)},
full_scale_range_101_active: {value: ""},
full_scale_range_101: {value: 1},
full_scale_range_101_m2_active: {value: ""},
full_scale_range_101_m2: {value: 1},
x_axis_101: {value: ""},
y_axis_101: {value: ""},
z_axis_101: {value: ""},
low_pass_filter_80_active: {value:""},
low_pass_filter_80: {value:0},
high_pass_filter_80_active: {value:""},
high_pass_filter_80: {value:0},
low_pass_filter_81_p2_active: {value:""},
low_pass_filter_81_p2: {value:0},
high_pass_filter_81_p2_active: {value:""},
high_pass_filter_81_p2: {value:0},
roll_angle_threshold_47:{value:0, validate: NCD_validators.number_range(0, 255)},
roll_angle_threshold_47_active:{value:""},
pitch_angle_threshold_47:{value:0, validate: NCD_validators.number_range(0, 255)},
pitch_angle_threshold_47_active:{value:""},
accelerometer_state_108:{value:0},
accelerometer_state_108_active:{value:""},
clear_timers_108_active:{value:""},
clear_timers_108:{value:7},
accelerometer_threshold_108:{value:10, validate: NCD_validators.number_range(0, 255)},
accelerometer_threshold_108_active:{value:""},
debounce_time_108:{value:10, validate: NCD_validators.number_range(0, 255)},
debounce_time_108_active:{value:""},
input_one_108:{value:1},
input_one_108_active:{value:""},
input_two_108:{value:1},
input_two_108_active:{value:""},
input_three_108:{value:0},
input_three_108_active:{value:""},
counter_threshold_108:{value:1000, validate: NCD_validators.number_range(0, 65534)},
counter_threshold_108_active:{value:""},
shift_one_108_active:{value:""},
shift_one_minutes_108:{value:0, validate: NCD_validators.number_range(0, 59)},
shift_one_hours_108:{value:0, validate: NCD_validators.number_range(0, 23)},
shift_two_108_active:{value:""},
shift_two_minutes_108:{value:0, validate: NCD_validators.number_range(0, 59)},
shift_two_hours_108:{value:0, validate: NCD_validators.number_range(0, 23)},
shift_three_108_active:{value:""},
shift_three_minutes_108:{value:0, validate: NCD_validators.number_range(0, 59)},
shift_three_hours_108:{value:0, validate: NCD_validators.number_range(0, 23)},
shift_four_108_active:{value:""},
shift_four_minutes_108:{value:0, validate: NCD_validators.number_range(0, 59)},
shift_four_hours_108:{value:0, validate: NCD_validators.number_range(0, 23)},
counter_threshold_35:{value:50, validate: NCD_validators.number_range(0, 65534)},
counter_threshold_35_active:{value:""},
payload_length_80_active:{value:""},
payload_length_80:{value:3, validate: NCD_validators.number_range(0, 3)},
motion_threshold_46_active:{value:""},
motion_threshold_46:{value: 100, validate: NCD_validators.number_range(0, 4294967295)},
low_calibration_420ma_active:{value:""},
low_calibration_420ma:{value: 68805, validate: NCD_validators.number_range(0, 4294967295)},
mid_calibration_420ma_active:{value:""},
mid_calibration_420ma:{value: 68724, validate: NCD_validators.number_range(0, 4294967295)},
high_calibration_420ma_active:{value:""},
high_calibration_420ma:{value: 68714, validate: NCD_validators.number_range(0, 4294967295)},
thermocouple_type_23_active:{value:""},
thermocouple_type_23:{value: 0},
debounce_time_2_active:{value:""},
debounce_time_2:{value: 10, validate: NCD_validators.number_range(0, 255)},
stay_on_mode_539_active: {value:""},
stay_on_mode_539: {value:0},
baudrate_539_active:{value:""},
baudrate_539:{value: 9600},
rx_timeout_539_active:{value:""},
rx_timeout_539:{value: 10, validate: NCD_validators.number_range(0, 255)},
bootup_time_539_active:{value:""},
bootup_time_539:{value: 10, validate: NCD_validators.number_range(0, 255)},
sensor_add_539_active:{value:""},
sensor_add_539:{value: 10, validate: NCD_validators.number_range(0, 255)},
sub_device_type_539_active:{value:""},
sub_device_type_539:{value: 10, validate: NCD_validators.number_range(0, 255)},
number_of_regs_to_rd_539_active:{value:""},
number_of_regs_to_rd_539:{value: 1, validate: NCD_validators.number_range(0, 32)},
register_value_0_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_1_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_2_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_3_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_4_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_5_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_6_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_7_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_8_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_9_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_10_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_11_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_12_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_13_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_14_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_15_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_16_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_17_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_18_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_19_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_20_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_21_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_22_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_23_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_24_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_25_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_26_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_27_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_28_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_29_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_30_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
register_value_31_539: {value: 0, validate: NCD_validators.number_range(0, 65535)},
number_of_read_retries_539_active:{value:""},
number_of_read_retries_539:{value: 1, validate: NCD_validators.number_range(1, 3)},
read_parameter_539_active:{value:""},
read_parameter_539:{value: 3},
//config_set_reg_active_539:{value:""},
//config_set_reg_539:{value:50, validate: NCD_validators.number_range(0, 65534)},
mode_110_active: {value: ""},
mode_110: {value: 0},
auto_raw_interval_110_active:{value:""},
auto_raw_interval_110: {value: 0, validate: NCD_validators.number_range(0, 255)},
auto_raw_destination_110_active:{value:""},
auto_raw_destination_110: {value: '0000FFFF', validate: NCD_validators.number_range(0, 0xFFFFFFFF, 16)},//(0 - 0xFFFFFFFF)
clear_probe_uptimers_110: {value:0},
smart_interval_110_active:{value:""},
smart_interval_110: {value: 0, validate: NCD_validators.number_range(0, 255)},
smart_threshold_110_active:{value:""},
smart_threshold_110: {value: 1, validate: NCD_validators.number_range(1, 65534, 10, "smart_threshold_110")},
smart_threshold_p2_110_active:{value:""},
smart_threshold_p2_110: {value: 1, validate: NCD_validators.number_range(1, 65534, 10, "smart_threshold_110")},
rx485_timeout_1011_active:{value:""},
rx485_timeout_1011:{value: 0, validate: NCD_validators.number_range(0, 255)},
mode_1011_active:{value:""},
mode_1011:{value: 0},
auto_address_timeout_1011_active:{value:""},
auto_address_timeout_1011:{value:0, validate: NCD_validators.number_range(0, 65534)},
mode_531_active: {value: ""},
mode_531: {value: 0},
max_range_58_active:{value: ""},
max_range_58: {value: 0, validate: NCD_validators.number_range(0, 16500)},
calibration_58: {value: 0},
factory_reset_tank_probe_58:{value:0},
push_notification_108_active:{value: ""},
push_notification_108: {value: 0},
push_notification_33_active:{value: ""},
push_notification_33:{value: 0},
clear_counter_33:{value:0},
input_two_33:{value:1},
input_two_33_active:{value:""},
stop_bit_1011_active:{value: ""},
stop_bit_1011:{value:0},
set_parity_1011_active:{value: ""},
set_parity_1011:{value:0},
reboot_1011:{value:0},
fly_interval_110_active:{value: ""},
fly_interval_110:{value: 60},
scd_skip_samples_44_active:{value: ""},
scd_skip_samples_44:{value: 1, validate: NCD_validators.number_range(1, 10)},
sps_skip_samples_32_active:{value: ""},
sps_skip_samples_32:{value: 1, validate: NCD_validators.number_range(1, 10)},
sampling_interval_110_active:{value: ""},
sampling_interval_110: {value: 1, validate: NCD_validators.number_range(0, 8)},
deactivate_activate_accelero_108_active: {value: ""},
deactivate_activate_accelero_108: {value: 0},
reset_timeout_108_active:{value: ""},
reset_timeout_108: {value: 60, validate: NCD_validators.number_range(60, 65535)},
reset_mode_to_disabled_108_active: {value: ""},
reset_mode_to_disabled_108: {value: 0},
transmission_interval_108_active: {value: ""},
transmission_interval_108: {value: 0},
rtc_108:{value:0},
change_otf_interval_active:{value: ""},
change_otf_interval:{value: 60},
sampling_rate_duration_active:{value: ""},
sampling_rate_duration:{value: 30, validate: NCD_validators.number_range(30, 20000)},
stop_sampling:{value:0},
extend_otf_timeout:{value:0},
end_cfg:{value:0},
rtd_type_39_active:{value: ""},
rtd_type_39:{value:0},
rtd_range_39_active:{value: ""},
rtd_range_39:{value:0},
pressure_sensor_fs_ch1_118_active:{value: ""},
pressure_sensor_fs_ch1_118:{value:0},
pressure_sensor_fs_ch2_118_active:{value: ""},
pressure_sensor_fs_ch2_118:{value:0},
auto_check_interval_118_active:{value: ""},
auto_check_interval_118:{value: 0, validate: NCD_validators.number_range(0, 65000)},
press_auto_check_percent_118_active:{value: ""},
press_auto_check_percent_118:{value: 0, validate: NCD_validators.number_range(0, 100)},
temp_auto_check_percent_118_active:{value: ""},
temp_auto_check_percent_118:{value: 0, validate: NCD_validators.number_range(0, 100)},
raw_length_97_active:{value: ""},
raw_length_97:{value:3, validate: NCD_validators.number_range(0, 3)},
raw_timeout_97_active:{value: ""},
raw_timeout_97:{value: 0, validate: NCD_validators.number_range(0, 10)},
fly_rate_97_active:{value: ""},
fly_rate_97:{value: 0},
boot_up_time_97_active:{value: ""},
boot_up_time_97:{value: 0, validate: NCD_validators.number_range(0, 255)},
filter_thermocouple_active:{value: ""},
filter_thermocouple:{value:0},
cold_junction_thermocouple_active:{value: ""},
cold_junction_thermocouple:{value:0},
sample_resolution_thermocouple_active:{value: ""},
sample_resolution_thermocouple:{value:0},
number_of_samples_thermocouple_active:{value: ""},
number_of_samples_thermocouple:{value:0},
measurement_type_thermocouple_active:{value: ""},
measurement_type_thermocouple:{value:0},
mode_97_active: {value: ""},
mode_97: {value: 0},
pressure_sensor_type_21_active: {value: ""},
pressure_sensor_type_21: {value: 0},
thermocouple_type_112_active: {value:""},
thermocouple_type_112: {value: 0},
filter_thermocouple_112_active: {value: ""},
filter_thermocouple_112: {value:0},
cold_junction_thermocouple_112_active: {value: ""},
cold_junction_thermocouple_112: {value:0},
sample_resolution_thermocouple_112_active: {value: ""},
sample_resolution_thermocouple_112: {value:0},
number_of_samples_thermocouple_112_active: {value: ""},
number_of_samples_thermocouple_112: {value:0},
operation_mode_thermocouple_112_active: {value: ""},
operation_mode_thermocouple_112: {value: 0},
measurement_type_thermocouple_112_active: {value: ""},
measurement_type_thermocouple_112: {value:0},
enable_rpm_calculate_status_110_active: {value: ""},
enable_rpm_calculate_status_110: {value:0},
odr_p1_110_active: {value: ""},
odr_p1_110: {value:0},
odr_p2_110_active: {value: ""},
odr_p2_110: {value:0},
sampling_duration_p1_110_active: {value: ""},
sampling_duration_p1_110: {value: 1, validate: NCD_validators.number_range(1, 100)},
sampling_duration_p2_110_active: {value: ""},
sampling_duration_p2_110: {value: 1, validate: NCD_validators.number_range(1, 100)},
low_pass_filter_p1_110_active: {value: ""},
low_pass_filter_p1_110: {value:0},
low_pass_filter_p2_110_active: {value: ""},
low_pass_filter_p2_110: {value:0},
high_pass_filter_p1_110_active: {value: ""},
high_pass_filter_p1_110: {value:0},
high_pass_filter_p2_110_active: {value: ""},
high_pass_filter_p2_110: {value:0},
acceleration_interrupt_threshold_84_active: {value: ""},
acceleration_interrupt_threshold_84: {value: 0, validate: NCD_validators.number_range(0, 40, 10, 'acceleration_interrupt_threshold_84')},
motion_detect_threshold_p1_110_active: {value: ""},
motion_detect_threshold_p1_110: {value: 0, validate: NCD_validators.number_range(0, 40)},
motion_detect_threshold_p2_110_active: {value: ""},
motion_detect_threshold_p2_110: {value: 0, validate: NCD_validators.number_range(0, 40)},
quality_of_service_108_active: {value: ""},
quality_of_service_108: {value: 0},
max_raw_sample_110_active: {value: ""},
max_raw_sample_110: {value: 0},
always_on_120: {value:0},
sensor_reset_120: {value:0},
sensor_calib_120: {value:0},
alert_threshold_120_active: {value: ""},
alert_threshold_120: {value: 0, validate: NCD_validators.number_range(0, 40)},
tare_the_scale_217: {value:0},
weight_calib_217_active: {value: ""},
weight_calib_217: {value: 0},
fly_interval_108_active: {value: ""},
fly_interval_108: {value: 0},
sample_rate_108_active: {value: ""},
sample_rate_108: {value: 0}
},
inputs: 0,
outputs: 1,
label: function() {
if(this.name) return this.name;
if(this.addr) return this.addr.split(":").slice(4).join(':');
if(this.sensor_type){
var types = {
"1": "1 - Temperature/Humidity",
"2": "2 - 2ch Push Notification/Voltage Detection",
"3": "3 - ADC/4-20 mA/DC Voltage",
"4": "4 - Thermocouple",
"5": "5 - Gyro/Magneto/Temperature",
"6": "6 - Temperature/Barometeric Pressure",
"7": "7 - Impact Detection",
"8": "8 - Vibration",
"9": "9 - Proximity and Light",
"10": "10 - Light",
"12": "12 - 3 Channel Thermocouple",
"13": "13 - Current Monitor",
"14": "14 - 1 Channel 4-20mA Receiver",
"15": "15 - 1 Channel 0-10V Receiver",
"16": "16 - 1 Channel Soil Moisture Sensor",
"17": "17 - 1 Channel AC Voltage Sensor",
"18": "18 - Pulse Frequency",
"19": "19 - 2 Channel Current Sensor",
"20": "20 - High Precision Pressure Sensor",
"21": "21 - Differential Bidirectional Pressure Sensor",
"22": "22 - 0-24V AC/DC Optically Isolated Inputs",
"23": "23 - 2 Channel Thermocouple Sensor",
"24": "24 - Activity Detection",
"25": "25 - Asset Monitor",
"26": "26 - Pressure Sensor",
"27": "27 - Environmental Sensor",
"28": "28 - 3-Phase Current Sensor",
"29": "29 - Linear Displacement Sensor",
"30": "30 - Structural Monitoring Sensor",
"31": "31 - Air Quality TVOC eCO2 Temperature and Humidity Sensor",
"32": "32 - Particulate Matter Sensor",
"33": "33 - AC Current Detect Sensor",
"34": "34 - Tank Level Sensor",
"35": "35 - 1 Channel Counter",
"36": "36 - 2 Channel Counter",
"37": "37 - 7 Channel Push Notification",
"39": "39 - 3 Wire RTD Temperature Sensor",
"40": "40 - Enterprise Vibration Sensor",
"41": "41 - RPM Proximity Sensor",
"42": "42 - 0-24VDC Voltage Monitor",
"43": "43 - Dual Temperature Humidity Current Detection Sensor",
"44": "44 - CO2 Gas Sensor",
"45": "45 - 4-20mA 16-Bit Input Transmitter",
"46": "46 - Motion Detection Sensor",
"47": "47 - Wireless Tilt Sensor",
"48": "48 - 4-20mA 16-Bit Input Transmitter",
"49": "49 - 6 Channel Thermocouple Sensor",
"50": "50 - Predictive Maintenance Sensor",
"51": "51 - 6 Channel Current Sensor",
"52": "52 - 2 Channel 4-20mA Receiver",
"53": "53 - Air Quality CO2 and PM Sensor",
"54": "54 - 3 Channel RTD",
"56": "56 - 2 Channel 0-10VDC Receiver",
"58": "58 - Tank Level v3",
"60": "60 - Air Velocity, Pressure, & Temperature Sensor",
"61": "61 - pH Temperature Sensor",
"62": "62 - ORP Temperature Sensor",
"63": "63 - pH and ORPTemperature Sensor",
"64": "64 - EC Salinity TDS and Temperature Sensor",
"65": "65 - DO and Temperature Sensor",
"66": "66 - DO EC Salinity TDS and Temperature Sensor",
"67": "67 - PAR Sensor",
"69": "69 - Soil Moisture Temperature and EC Sensor",
// "70": "70 - 2 Channel Soil Moisture Temperature and EC Sensor",
"71": "71 - 3 Channel Soil Moisture Temperature and EC Sensor",
"72": "72 - SDI Soil Moisture Temperature Moisture Probe",
"74": "74 - Wireless Temp Humidity Pressure Air quality Sensor V2",
"75": "75 - Siemens Air Velocity Probe",
"76": "76 - Wireless CO Gas Sensor",
"77": "77 - 3 Channel SDI Soil Moisture Temperature Moisture Probe",
"78": "78 - Oil Particulate Counter Sensor",
"79": "79 - Oil Analysis Sensor",
"80": "80 - One Channel Vibration Plus",
"81": "81 - Two Channel Vibration Plus",
"82": "82 - Condition Based/Predictive Maintenance Sensor",
"84": "84 - Standalone Smart Vibration Sensor",
"87": "87 - One Channel Current v4",
"88": "88 - 1 Channel Ultrasound Vibration Sensor",
"89": "89 - 2 Channel Ultrasound Vibration Sensor",
"90": "90 - DC Current Sensor",
"91": "91 - Wireless Air Velocity Sensor HVAC",
"92": "92 - Sound Sensor",
"95": "95 - 16-Bit 1-Channel 0-24VDC Receiver",
"96": "96 - 16-Bit 1-Channel 0-48VDC Receiver",
"97": "97 - One channel Dynamic Ultrasound vibration Sensor",
"98": "98 - Two channel Dynamic Ultrasound vibration Sensor",
"101": "101 - Pro Vibration",
"102": "102 - Strain Gauge",
"105": "105 - 1 Channel Automatic Luber With Ultrasound Vibration Sensor",
"106": "106 - 2 Channel Automatic Luber With Ultrasound Vibration Sensor",
"107": "107 - 4 Channel 4-20mA Receiver",
"108": "108 - Machine Uptime Monitoring Sensor",
"109": "109 - Wireless Custom Solar Sensor",
"110": "110 - One Channel Vibration Plus v4",
"111": "111 - Two Channel Vibration Plus v4",
"112": "112 - Condition Based/Predictive Maintenance Sensor v4",
"114": "114 - Standalone Smart Vibration Sensor v4",
"118": "118 - Dual Pressure and Temperature Sensor",
"120": "120 - Wireless H2S Sensor",
"180": "180 - C1D2 One Channel Vibration Plus",
"181": "181 - C1D2 Two Channel Vibration Plus",
"200": "200 - 4-20mA Pass Through",
"202": "202 - Weather Station",
"217": "217 - Wireless Weight Scale",
"502": "502 - C_50-27",
"505": "505 - Custom_SAP_Current_1C",
"506": "506 - Custom_SAP_Current_3C",
"507": "507 - Custom_SAP_Current_7C",
"510": "510 - GreenLight",
"515": "515 - Custom_SAP_Current_48C",
"518": "518 - Custom Air Velocity",
"519": "519: Custom Vibration 1",
"520": "520: Custom 6 Channel Current Temperature & Humidity",
"521": "521 - Custom 3 Channel Light Sensor",
"524": "524 - SDI Multi Soil Probe",
"531": "531 - Custom Noise Sensor",
"535": "535 - Custom CO2 Sensor",
"537": "537 - Custom Standalone Smart Vibration Sensor",
"538": "538 - Custom One Channel Vibration Plus",
"539": "539 - RS485 Modbus Wireless Converter",
"540": "540 - Wireless Ultrasonic Flow Meter FD-Q32C",
"1010": "1010 - RS232 Wireless Converter 1010",
"1011": "1011 - RS485 Wireless Converter 1011",
"10000": "10000 - 4-Channel Relay",
"10006": "10006 - 4-Channel 4-20 mA Input",
"10007": "10007 - 4-Channel Current Monitor",
"10012": "10012 - 2-Relay + 2-Input",
}
return types[this.sensor_type];
}
return 'Wireless Device';
},
oneditprepare: function() {
var that = this;
try {
$("#node-config-input-addr").autocomplete( "destroy" );
} catch(err) {}
$('.ncd-dependent[sensor_type]').hide();
// loops through all settings that need validation and sets default values
// Solves library upgrades that add new properties
for(let prop in this._def.defaults){
if(typeof this._def.defaults[prop].validate == 'function'){
if(this[prop] == undefined || this[prop] == ""){
$('#node-input-'+prop).val(this._def.defaults[prop].value);
}
}
}
$('#node-input-number_of_regs_to_rd_539').change(function(){
let registers = $(this).val();
$('#register_list_539 > div:nth-child(-n+'+registers+')').show();
$('#register_list_539 > div:nth-last-child(-n+'+(32-registers)+')').hide();
});
// $('#node-input-number_of_regs_to_rd_539_active').change(function(){
// if($(this).prop('checked')){
// if($(this).data('target-id')){
// $('#'+$(this).data('target-id')).prop('disabled', false);
// }
// if($(this).data('target-class')){
// $('.'+$(this).data('target-class')).prop('disabled', false);
// }
// }
// else{
// if($(this).data('target-id')){
// $('#'+$(this).data('target-id')).prop('disabled', true);
// }
// if($(this).data('target-class')){
// $('.'+$(this).data('target-class')).prop('disabled', true);
// }
// }
// });
$('#node-input-connection').change(function(){
$.getJSON('ncd/wireless/needs_input/'+$(this).val(),function(data) {
if(data.is_raw){
that.needs_input = 1;
}
});
});
$('#node-input-sensor_type').change(() => {
var type = $('#node-input-sensor_type').val();
$('.ncd-dependent').hide();
$('.ncd-dependent[data-sensor-'+type+']').show();
if(parseInt(type) >= 10000){
var current = $('#node-input-auto_config').prop('checked');
if(!current) $('#node-input-auto_config').click();
$('#node-input-auto_config').data('_checked', current).closest('.form-row').hide();
this.inputs = 1;
}else{
$("#node-input-auto_config").closest('.form-row').show();
if (typeof $("#node-input-auto_config").data('_checked') !== 'undefined'){
$('#node-input-auto_config').prop('checked', $("#node-input-auto_config").data('_checked')).click().removeData('_checked');
}
}
});
$("#node-lookup-sensors").click(function() {
$("#node-lookup-sensors").addClass('disabled');
var connection = RED.nodes.node($('#node-input-connection').val())
$.getJSON('ncd/wireless/sensors/list/'+$('#node-input-connection').val(),function(data) {
$("#node-lookup-sensors").removeClass('disabled');
var macs = [];
var sensors = {};
$.each(data, function(i, sensor) {
macs.push(sensor.mac);
sensors[sensor.mac] = sensor;
});
$("#node-input-addr").autocomplete({
source:macs,
minLength:0,
close: function( event, ui ) {
$("#node-input-addr").autocomplete( "destroy" );
},
select: function(e, ui){
$('#node-input-sensor_type option[value="'+sensors[ui.item.value].type+'"]').prop('selected', true);
$('#node-input-sensor_type').change();
$('#node-input-node_id').val(sensors[ui.item.value].nodeId);
}
}).autocomplete("search","");
});
});
$('.section .section-control').each(function(){
var handleClick = function(){
$(this).closest('.section').find('input, select').not('.section-control').prop('disabled', !$(this).is(':checked'));
}
$(this).click(handleClick);
handleClick.apply(this);
});
$('#config_sensor').click(function(){
if($(this).prop('disabled')) return;
$(this).prop('disabled', true).text('Configuring...');
$('#config_response').empty();
$.getJSON('ncd/wireless/sensors/configure/'+that.id,function(data) {
var clean = true;
for(var i in data){
if(data[i] !== true){
clean = false;
$('#config_response').append('<div>Problem setting '+i+': '+data[i]);
}
}
if(clean){
$('#config_response').append('<div>All configurations successfully set</div>');;
}
$('#config_sensor').prop('disabled', false).text('Configure Now');
});
});
$('.ncd-config-toggle').each(function(){
var handleClick = function(){
// if($(this).prop('checked') && $(this).data('target-id')) {
// $('#'+$(this).data('target-id')).prop('disabled', false);
// }
// else{
// $('#'+$(this).data('target-id')).prop('disabled', true);
// }
if($(this).prop('checked')){
if($(this).data('target-id')){
$('#'+$(this).data('target-id')).prop('disabled', false);
}
if($(this).data('target-class')){
$('.'+$(this).data('target-class')).prop('disabled', false);
}
}
else{
if($(this).data('target-id')){
$('#'+$(this).data('target-id')).prop('disabled', true);
}
if($(this).data('target-class')){
$('.'+$(this).data('target-class')).prop('disabled', true);
}
// $('#'+$(this).data('target-id')).prop('disabled', true);
}
}
$(this).click(handleClick);
handleClick.apply(this);
});
},
});
</script>
<script type="text/x-red" data-template-name="ncd-wireless-node">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-connection"><i class="icon-tag"></i> Serial Device</label>
<select id="node-input-connection"></select>
</div>
<div class="form-row">
<label for="node-input-config_comm"><i class="icon-tag"></i> Serial Device for Config</label>
<select id="node-input-config_comm"></select>
</div>
<div class="form-row">
<label for="node-input-addr"><i class="fa fa-random"></i> Mac Address</label>
<input type="text" id="node-input-addr" style="width:60%;" >