@ncd-io/node-red-enterprise-sensors 0.1.5 → 0.1.7

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.
@@ -79,6 +79,9 @@ module.exports = class WirelessSensor{
79
79
  }else{
80
80
  data.sensor_type = msbLsb(frame.data[3], frame.data[4]);
81
81
  }
82
+ if(data.sensor_type == 0){
83
+ data.sensor_type = msbLsb(frame.data[3], frame.data[4]);
84
+ }
82
85
  if(frame.data[7] == 79 && frame.data[8] == 84 && frame.data[9] == 78){
83
86
  mode = "OTN";
84
87
  }
@@ -123,8 +126,18 @@ module.exports = class WirelessSensor{
123
126
  }
124
127
  // mode === 'ACK' check added to allow multiple configs through front end gateway input
125
128
  if(new_mode || mode === 'ACK'){
126
- that._emitter.emit('sensor_mode', that.sensor_pool[frame.mac]);
127
- that._emitter.emit('sensor_mode-'+frame.mac, that.sensor_pool[frame.mac]);
129
+ // If RSSI is not enabled send stored values, if it is, request the RSSI and temporarily append it.
130
+ if(typeof frame.rssi == 'undefined'){
131
+ that._emitter.emit('sensor_mode', that.sensor_pool[frame.mac]);
132
+ that._emitter.emit('sensor_mode-'+frame.mac, that.sensor_pool[frame.mac]);
133
+ }else{
134
+ frame.rssi.then((v) => {
135
+ let sensor_pool_rssi = that.sensor_pool[frame.mac];
136
+ sensor_pool_rssi.rssi = v.data[0];
137
+ that._emitter.emit('sensor_mode', sensor_pool_rssi);
138
+ that._emitter.emit('sensor_mode-'+frame.mac, sensor_pool_rssi);
139
+ }).catch(console.log);
140
+ }
128
141
  }
129
142
  if(mode != 'FLY'){
130
143
  var send_events = function(){
@@ -995,6 +1008,31 @@ module.exports = class WirelessSensor{
995
1008
  return this.config_send(sensor_mac, packet);
996
1009
  }
997
1010
 
1011
+ config_set_low_calibration_420ma(sensor_mac, value){
1012
+ console.log('config_set_low_calibration_420ma');
1013
+ let packet = [244, 66, 0, 0, 45, 1];
1014
+ let calibration = int2Bytes((value), 4);
1015
+ packet.push(...calibration);
1016
+ console.log(packet);
1017
+ return this.config_send(sensor_mac, packet);
1018
+ }
1019
+ config_set_mid_calibration_420ma(sensor_mac, value){
1020
+ console.log('config_set_mid_calibration_420ma');
1021
+ let packet = [244, 66, 0, 0, 45, 2];
1022
+ let calibration = int2Bytes((value), 4);
1023
+ packet.push(...calibration);
1024
+ console.log(packet);
1025
+ return this.config_send(sensor_mac, packet);
1026
+ }
1027
+ config_set_high_calibration_420ma(sensor_mac, value){
1028
+ console.log('config_set_high_calibration_420ma');
1029
+ let packet = [244, 66, 0, 0, 45, 3];
1030
+ let calibration = int2Bytes((value), 4);
1031
+ packet.push(...calibration);
1032
+ console.log(packet);
1033
+ return this.config_send(sensor_mac, packet);
1034
+ }
1035
+
998
1036
  config_get_delay(sensor_mac){
999
1037
  return new Promise((fulfill, reject) => {
1000
1038
  this.config_send(sensor_mac, [247, 21, 0, 0, 0]).then((res) => {
@@ -2176,6 +2214,29 @@ function sensor_types(parent){
2176
2214
  };
2177
2215
  }
2178
2216
  },
2217
+ '78': {
2218
+ name: 'Oil Particulate Counter Sensor',
2219
+ parse: (d) => {
2220
+ return {
2221
+
2222
+ ferro_particles_lt_50_um: d.slice(0, 2).reduce(msbLsb),
2223
+ ferro_particles_50_100_um: d.slice(2, 4).reduce(msbLsb),
2224
+ ferro_particles_100_200_um: d.slice(4, 6).reduce(msbLsb),
2225
+ ferro_particles_200_400_um: d.slice(6, 8).reduce(msbLsb),
2226
+ ferro_particles_400_800_um: d.slice(8, 10).reduce(msbLsb),
2227
+ ferro_particles_gt_800_um: d.slice(10, 12).reduce(msbLsb),
2228
+ ferro_particles_total: d.slice(12, 14).reduce(msbLsb),
2229
+ non_ferro_particles_150_200_um: d.slice(14, 16).reduce(msbLsb),
2230
+ non_ferro_particles_200_400_um: d.slice(16, 18).reduce(msbLsb),
2231
+ non_ferro_particles_400_800_um: d.slice(18, 20).reduce(msbLsb),
2232
+ non_ferro_particles_800_1600_um: d.slice(20, 22).reduce(msbLsb),
2233
+ non_ferro_particles_gt_1600_um: d.slice(22, 24).reduce(msbLsb),
2234
+ non_ferro_particles_total: d.slice(24, 26).reduce(msbLsb),
2235
+ ferro_particles_total_24h: d.slice(26, 28).reduce(msbLsb),
2236
+ non_ferro_particles_total_24h: d.slice(28, 30).reduce(msbLsb)
2237
+ };
2238
+ }
2239
+ },
2179
2240
  '79': {
2180
2241
  name: 'Oil Analysis Sensor',
2181
2242
  parse: (d) => {
@@ -4058,7 +4119,7 @@ function sensor_types(parent){
4058
4119
  },
4059
4120
 
4060
4121
  '84': {
4061
- name: 'Type 84 - Vibration on a stick',
4122
+ name: 'Type 84 - Standalone Smart Vibration Sensor',
4062
4123
  parse: (payload, parsed, mac) => {
4063
4124
  if(payload[7] >> 1 != 0){
4064
4125
  console.log('Error found');
@@ -4613,6 +4674,16 @@ function sensor_types(parent){
4613
4674
  }
4614
4675
  }
4615
4676
  },
4677
+ '88': {
4678
+ name: '1 Channel Ultrasound Vibration Sensor',
4679
+ parse: (d) => {
4680
+ return {
4681
+ raw_adc: d.slice(0, 2).reduce(msbLsb),
4682
+ ma: d.slice(2, 4).reduce(msbLsb) / 100,
4683
+ db: d.slice(4, 6).reduce(msbLsb) / 100
4684
+ };
4685
+ }
4686
+ },
4616
4687
  '89': {
4617
4688
  name: '2 Channel Ultrasound Vibration Sensor',
4618
4689
  parse: (d) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ncd-io/node-red-enterprise-sensors",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wireless.html CHANGED
@@ -65,63 +65,63 @@
65
65
  </script>
66
66
 
67
67
  <style>
68
- .ncd-active-check strong{
69
- width: 100%;
70
- }
71
- .form-row.ncd-active-check{
72
- margin: 12px 0px;
73
- border: 1px solid #eee;
74
- padding: 12px;
75
- border-radius: 8px;
76
- }
77
- .form-row.ncd-active-check > div{
78
- padding: 4px;
79
- }
80
- .form-row.ncd-active-check > div > input[type='checkbox']{
81
- width: inherit;
82
- }
83
- .form-row .caption{
84
- font-size: .95em;
68
+ .ncd-active-check strong{
69
+ width: 100%;
70
+ }
71
+ .form-row.ncd-active-check{
72
+ margin: 12px 0px;
73
+ border: 1px solid #eee;
74
+ padding: 12px;
75
+ border-radius: 8px;
76
+ }
77
+ .form-row.ncd-active-check > div{
78
+ padding: 4px;
79
+ }
80
+ .form-row.ncd-active-check > div > input[type='checkbox']{
81
+ width: inherit;
82
+ }
83
+ .form-row .caption{
84
+ font-size: .95em;
85
85
  padding-left: 1em;
86
86
  margin-top: .25em;
87
- }
87
+ }
88
88
  </style>
89
89
 
90
90
  <script type="text/x-red" data-help-name="ncd-gateway-node">
91
- <h3>Gateway Node</h3>
91
+ <h3>Gateway Node</h3>
92
92
  <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>
93
93
  <h3>Output</h3>
94
94
  <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>
95
- <h3>Input</h3>
96
- <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>
97
- <pre>
98
- msg = {
99
- topic: "sensor_data",
100
- payload: {
101
- nodeId: 0,
102
- firmware: 3,
103
- battery: 3.2940600000000004,
104
- counter: 37,
105
- sensor_type: 1,
106
- sensor_data: {
107
- humidity: 45.51,
108
- temperature: 23.91,
109
- },
110
- type: "sensor_data",
111
- addr: "00:13:a2:00:41:07:18:81",
112
- original: {
113
- mac: "00:13:a2:00:41:07:18:81",
114
- receive_options: {
115
- ack: 0,
116
- broadcast: 0,
117
- type: ""
118
- }
119
- },
120
- data: [127,0,3,3,255,37,0,1,0,17,199,9,87],
121
- type: "receive_packet"
122
- },
123
- _msgid: "391caba.5a19454"
124
- }
95
+ <h3>Input</h3>
96
+ <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>
97
+ <pre>
98
+ msg = {
99
+ topic: "sensor_data",
100
+ payload: {
101
+ nodeId: 0,
102
+ firmware: 3,
103
+ battery: 3.2940600000000004,
104
+ counter: 37,
105
+ sensor_type: 1,
106
+ sensor_data: {
107
+ humidity: 45.51,
108
+ temperature: 23.91,
109
+ },
110
+ type: "sensor_data",
111
+ addr: "00:13:a2:00:41:07:18:81",
112
+ original: {
113
+ mac: "00:13:a2:00:41:07:18:81",
114
+ receive_options: {
115
+ ack: 0,
116
+ broadcast: 0,
117
+ type: ""
118
+ }
119
+ },
120
+ data: [127,0,3,3,255,37,0,1,0,17,199,9,87],
121
+ type: "receive_packet"
122
+ },
123
+ _msgid: "391caba.5a19454"
124
+ }
125
125
  </pre>
126
126
  </script>
127
127
 
@@ -323,6 +323,13 @@
323
323
 
324
324
  motion_threshold_46_active:{value:""},
325
325
  motion_threshold_46:{value: 100, validate: NCD_validators.number_range(0, 4294967295)},
326
+
327
+ low_calibration_420ma_active:{value:""},
328
+ low_calibration_420ma:{value: 68805, validate: NCD_validators.number_range(0, 4294967295)},
329
+ mid_calibration_420ma_active:{value:""},
330
+ mid_calibration_420ma:{value: 68724, validate: NCD_validators.number_range(0, 4294967295)},
331
+ high_calibration_420ma_active:{value:""},
332
+ high_calibration_420ma:{value: 68714, validate: NCD_validators.number_range(0, 4294967295)},
326
333
  },
327
334
  inputs: 0,
328
335
  outputs: 1,
@@ -399,12 +406,14 @@
399
406
  "75": "75 - Siemens Air Velocity Probe",
400
407
  "76": "76 - Wireless CO Gas Sensor",
401
408
  "77": "77 - 3 Channel SDI Soil Moisture Temperature Moisture Probe",
409
+ "78": "78 - Oil Particulate Counter Sensor",
402
410
  "79": "79 - Oil Analysis Sensor",
403
411
  "80": "80 - One Channel Vibration Plus",
404
412
  "81": "81 - Two Channel Vibration Plus",
405
413
  "82": "82 - Condition Based/Predictive Maintenance Sensor",
406
414
  "84": "84 - Standalone Smart Vibration Sensor",
407
- "89": "89 - 2 Channel Ustrasound Vibration Sensor",
415
+ "88": "88 - 1 Channel Ultrasound Vibration Sensor",
416
+ "89": "89 - 2 Channel Ultrasound Vibration Sensor",
408
417
  "92": "92 - Sound Sensor",
409
418
  "101": "101 - Pro Vibration",
410
419
  "102": "102 - Strain Gauge",
@@ -519,10 +528,10 @@
519
528
  $('.ncd-config-toggle').each(function(){
520
529
  var handleClick = function(){
521
530
  // if($(this).prop('checked') && $(this).data('target-id')) {
522
- // $('#'+$(this).data('target-id')).prop('disabled', false);
531
+ // $('#'+$(this).data('target-id')).prop('disabled', false);
523
532
  // }
524
533
  // else{
525
- // $('#'+$(this).data('target-id')).prop('disabled', true);
534
+ // $('#'+$(this).data('target-id')).prop('disabled', true);
526
535
  // }
527
536
 
528
537
  if($(this).prop('checked')){
@@ -640,11 +649,13 @@
640
649
  <option value="75">75 - Siemens Air Velocity Probe</option>
641
650
  <option value="76">76 - Wireless CO Gas Sensor</option>
642
651
  <option value="77">77 - 3 Channel SDI Soil Moisture Temperature Moisture Probe</option>
652
+ <option value="78">78 - Oil Particulate Counter Sensor</option>
643
653
  <option value="79">79 - Oil Analysis Sensor</option>
644
654
  <option value="80">80 - One Channel Vibration Plus</option>
645
655
  <option value="81">81 - Two Channel Vibration Plus</option>
646
656
  <option value="82">82 - Condition Based/Predictive Maintenance Sensor</option>
647
657
  <option value="84">84 - Standalone Smart Vibration Sensor</option>
658
+ <option value="88">88 - 1 Channel Ultrasound Vibration Sensor</option>
648
659
  <option value="89">89 - 2 Channel Ultrasound Vibration Sensor</option>
649
660
  <option value="92">92 - Sound Sensor</option>
650
661
  <option value="101">101 - Pro Vibration</option>
@@ -672,7 +683,7 @@
672
683
  <label for="node-input-auto_config"><i class="icon-tag"></i> Auto Config</label>
673
684
  <input class="section-control" type="checkbox" id="node-input-auto_config" value="1">
674
685
  </div>
675
- <div class="form-row ncd-dependent" data-sensor-80 data-sensor-81 data-sensor-82 data-sensor-84 data-sensor-89 data-sensor-101 data-sensor-102 data-sensor-519 data-sensor-520>
686
+ <div class="form-row ncd-dependent" data-sensor-80 data-sensor-81 data-sensor-82 data-sensor-84 data-sensor-88 data-sensor-89 data-sensor-101 data-sensor-102 data-sensor-519 data-sensor-520>
676
687
  <hr>
677
688
  <label for="node-input-on_the_fly_enable"><i class="icon-tag"></i> OTF Config*</label>
678
689
  <input type="checkbox" id="node-input-on_the_fly_enable" value="1">
@@ -913,7 +924,7 @@
913
924
  </select>
914
925
  </div>
915
926
  </div>
916
- <div class="ncd-dependent" data-sensor-40>
927
+ <div class="ncd-dependent" data-sensor-40>
917
928
  <div class="form-row">
918
929
  <label for="node-input-filtering"><i class="icon-tag"></i> Data Filtering</label>
919
930
  <select id="node-input-filtering">
@@ -1444,7 +1455,7 @@
1444
1455
  </div>
1445
1456
  </div>
1446
1457
 
1447
- <div class="ncd-dependent" data-sensor-14 data-sensor-45 data-sensor-48 data-sensor-52>
1458
+ <div class="ncd-dependent" data-sensor-14 data-sensor-45 data-sensor-48 data-sensor-52 data-sensor-88 data-sensor-89>
1448
1459
  <div class="form-row ncd-active-check">
1449
1460
  <strong>Sensor Boot Time</strong>
1450
1461
  <p class="caption">
@@ -1462,6 +1473,42 @@
1462
1473
  </div>
1463
1474
  </div>
1464
1475
 
1476
+ <div class="ncd-dependent" data-sensor-3 data-sensor-14 data-sensor-45 data-sensor-48 data-sensor-52 data-sensor-88 data-sensor-89 data-sensor-200>
1477
+ <div class="form-row ncd-active-check">
1478
+ <strong>Low Calibration Point</strong>
1479
+ <div>
1480
+ <label for="node-input-low_calibration_420ma_active">Active:</label>
1481
+ <input type="checkbox" id="node-input-low_calibration_420ma_active" class="ncd-config-toggle" data-target-id="node-input-low_calibration_420ma" value="1">
1482
+ </div>
1483
+ <div>
1484
+ <label for="node-input-low_calibration_420ma"><i class="icon-tag"></i>Value:</label>
1485
+ <input type="text" id="node-input-low_calibration_420ma" placeholder="68805" value="68805">
1486
+ </div>
1487
+ </div>
1488
+ <div class="form-row ncd-active-check">
1489
+ <strong>Mid Calibration Point</strong>
1490
+ <div>
1491
+ <label for="node-input-mid_calibration_420ma_active">Active:</label>
1492
+ <input type="checkbox" id="node-input-mid_calibration_420ma_active" class="ncd-config-toggle" data-target-id="node-input-mid_calibration_420ma" value="1">
1493
+ </div>
1494
+ <div>
1495
+ <label for="node-input-mid_calibration_420ma"><i class="icon-tag"></i>Value:</label>
1496
+ <input type="text" id="node-input-mid_calibration_420ma" placeholder="68724" value="68724">
1497
+ </div>
1498
+ </div>
1499
+ <div class="form-row ncd-active-check">
1500
+ <strong>High Calibration Point</strong>
1501
+ <div>
1502
+ <label for="node-input-high_calibration_420ma_active">Active:</label>
1503
+ <input type="checkbox" id="node-input-high_calibration_420ma_active" class="ncd-config-toggle" data-target-id="node-input-high_calibration_420ma" value="1">
1504
+ </div>
1505
+ <div>
1506
+ <label for="node-input-high_calibration_420ma"><i class="icon-tag"></i>Value:</label>
1507
+ <input type="text" id="node-input-high_calibration_420ma" placeholder="68714" value="68714">
1508
+ </div>
1509
+ </div>
1510
+ </div>
1511
+
1465
1512
  <div class="ncd-dependent" data-sensor-80 data-sensor-81 data-sensor-505 data-sensor-506>
1466
1513
  <div class="form-row ncd-active-check">
1467
1514
  <strong>Channel 1 Current Calibration Value</strong>
@@ -1606,7 +1653,7 @@
1606
1653
  </script>
1607
1654
 
1608
1655
  <script type="text/x-red" data-help-name="ncd-wireless-node">
1609
- <h3>Wireless Node</h3>
1656
+ <h3>Wireless Node</h3>
1610
1657
  <p>This node is used to filter sensor data coming from a modem. It can filter by mac address, or sensor type, and can be used to configure wireless devices automatically when they enter configuration mode.</p>
1611
1658
  <h4>Serial Devices</h4>
1612
1659
  <p>The Serial Device field refers to the modem that will be recieving the packets from the device. The Serial Device for Config field refers to a modem that is always set to the config network ID (0x7BCD), this is the recommended setup as it allows you to configure nodes without missing potentially important sensor data, however, the config button on the Wireless Gateway node may be used if a single modem will be acting as both the listener, and config endpoints, making the second selection optional.</p>
@@ -1619,37 +1666,37 @@
1619
1666
  <h4>Output</h4>
1620
1667
  <p>This node will output detailed information about incoming sensor data, and the device identity and status including. The payload will contain an object containing sensor data, an example can be seen below:</p>
1621
1668
  <pre>
1622
- msg = {
1623
- topic: "sensor_data",
1624
- payload: {
1625
- humidity: 45.51,
1626
- temperature: 23.91,
1627
- }
1628
- data: {
1629
- nodeId: 0,
1630
- firmware: 3,
1631
- battery: 3.2940600000000004,
1632
- counter: 37,
1633
- sensor_type: 1,
1634
- sensor_data: {
1635
- humidity: 45.51,
1636
- temperature: 23.91,
1637
- },
1638
- type: "sensor_data",
1639
- addr: "00:13:a2:00:41:07:18:81",
1640
- original: {
1641
- mac: "00:13:a2:00:41:07:18:81",
1642
- receive_options: {
1643
- ack: 0,
1644
- broadcast: 0,
1645
- type: ""
1646
- }
1647
- },
1648
- data: [127,0,3,3,255,37,0,1,0,17,199,9,87],
1649
- type: "receive_packet"
1650
- },
1651
- _msgid: "391caba.5a19454"
1652
- }
1669
+ msg = {
1670
+ topic: "sensor_data",
1671
+ payload: {
1672
+ humidity: 45.51,
1673
+ temperature: 23.91,
1674
+ }
1675
+ data: {
1676
+ nodeId: 0,
1677
+ firmware: 3,
1678
+ battery: 3.2940600000000004,
1679
+ counter: 37,
1680
+ sensor_type: 1,
1681
+ sensor_data: {
1682
+ humidity: 45.51,
1683
+ temperature: 23.91,
1684
+ },
1685
+ type: "sensor_data",
1686
+ addr: "00:13:a2:00:41:07:18:81",
1687
+ original: {
1688
+ mac: "00:13:a2:00:41:07:18:81",
1689
+ receive_options: {
1690
+ ack: 0,
1691
+ broadcast: 0,
1692
+ type: ""
1693
+ }
1694
+ },
1695
+ data: [127,0,3,3,255,37,0,1,0,17,199,9,87],
1696
+ type: "receive_packet"
1697
+ },
1698
+ _msgid: "391caba.5a19454"
1699
+ }
1653
1700
  </pre>
1654
1701
  </script>
1655
1702