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

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) => {
@@ -4058,7 +4096,7 @@ function sensor_types(parent){
4058
4096
  },
4059
4097
 
4060
4098
  '84': {
4061
- name: 'Type 84 - Vibration on a stick',
4099
+ name: 'Type 84 - Standalone Smart Vibration Sensor',
4062
4100
  parse: (payload, parsed, mac) => {
4063
4101
  if(payload[7] >> 1 != 0){
4064
4102
  console.log('Error found');
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.6",
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,
@@ -404,7 +411,7 @@
404
411
  "81": "81 - Two Channel Vibration Plus",
405
412
  "82": "82 - Condition Based/Predictive Maintenance Sensor",
406
413
  "84": "84 - Standalone Smart Vibration Sensor",
407
- "89": "89 - 2 Channel Ustrasound Vibration Sensor",
414
+ "89": "89 - 2 Channel Ultrasound Vibration Sensor",
408
415
  "92": "92 - Sound Sensor",
409
416
  "101": "101 - Pro Vibration",
410
417
  "102": "102 - Strain Gauge",
@@ -519,10 +526,10 @@
519
526
  $('.ncd-config-toggle').each(function(){
520
527
  var handleClick = function(){
521
528
  // if($(this).prop('checked') && $(this).data('target-id')) {
522
- // $('#'+$(this).data('target-id')).prop('disabled', false);
529
+ // $('#'+$(this).data('target-id')).prop('disabled', false);
523
530
  // }
524
531
  // else{
525
- // $('#'+$(this).data('target-id')).prop('disabled', true);
532
+ // $('#'+$(this).data('target-id')).prop('disabled', true);
526
533
  // }
527
534
 
528
535
  if($(this).prop('checked')){
@@ -913,7 +920,7 @@
913
920
  </select>
914
921
  </div>
915
922
  </div>
916
- <div class="ncd-dependent" data-sensor-40>
923
+ <div class="ncd-dependent" data-sensor-40>
917
924
  <div class="form-row">
918
925
  <label for="node-input-filtering"><i class="icon-tag"></i> Data Filtering</label>
919
926
  <select id="node-input-filtering">
@@ -1444,7 +1451,7 @@
1444
1451
  </div>
1445
1452
  </div>
1446
1453
 
1447
- <div class="ncd-dependent" data-sensor-14 data-sensor-45 data-sensor-48 data-sensor-52>
1454
+ <div class="ncd-dependent" data-sensor-14 data-sensor-45 data-sensor-48 data-sensor-52 data-sensor-89>
1448
1455
  <div class="form-row ncd-active-check">
1449
1456
  <strong>Sensor Boot Time</strong>
1450
1457
  <p class="caption">
@@ -1462,6 +1469,42 @@
1462
1469
  </div>
1463
1470
  </div>
1464
1471
 
1472
+ <div class="ncd-dependent" data-sensor-3 data-sensor-14 data-sensor-45 data-sensor-48 data-sensor-52 data-sensor-89 data-sensor-200>
1473
+ <div class="form-row ncd-active-check">
1474
+ <strong>Low Calibration Point</strong>
1475
+ <div>
1476
+ <label for="node-input-low_calibration_420ma_active">Active:</label>
1477
+ <input type="checkbox" id="node-input-low_calibration_420ma_active" class="ncd-config-toggle" data-target-id="node-input-low_calibration_420ma" value="1">
1478
+ </div>
1479
+ <div>
1480
+ <label for="node-input-low_calibration_420ma"><i class="icon-tag"></i>Value:</label>
1481
+ <input type="text" id="node-input-low_calibration_420ma" placeholder="68805" value="68805">
1482
+ </div>
1483
+ </div>
1484
+ <div class="form-row ncd-active-check">
1485
+ <strong>Mid Calibration Point</strong>
1486
+ <div>
1487
+ <label for="node-input-mid_calibration_420ma_active">Active:</label>
1488
+ <input type="checkbox" id="node-input-mid_calibration_420ma_active" class="ncd-config-toggle" data-target-id="node-input-mid_calibration_420ma" value="1">
1489
+ </div>
1490
+ <div>
1491
+ <label for="node-input-mid_calibration_420ma"><i class="icon-tag"></i>Value:</label>
1492
+ <input type="text" id="node-input-mid_calibration_420ma" placeholder="68724" value="68724">
1493
+ </div>
1494
+ </div>
1495
+ <div class="form-row ncd-active-check">
1496
+ <strong>High Calibration Point</strong>
1497
+ <div>
1498
+ <label for="node-input-high_calibration_420ma_active">Active:</label>
1499
+ <input type="checkbox" id="node-input-high_calibration_420ma_active" class="ncd-config-toggle" data-target-id="node-input-high_calibration_420ma" value="1">
1500
+ </div>
1501
+ <div>
1502
+ <label for="node-input-high_calibration_420ma"><i class="icon-tag"></i>Value:</label>
1503
+ <input type="text" id="node-input-high_calibration_420ma" placeholder="68714" value="68714">
1504
+ </div>
1505
+ </div>
1506
+ </div>
1507
+
1465
1508
  <div class="ncd-dependent" data-sensor-80 data-sensor-81 data-sensor-505 data-sensor-506>
1466
1509
  <div class="form-row ncd-active-check">
1467
1510
  <strong>Channel 1 Current Calibration Value</strong>
@@ -1606,7 +1649,7 @@
1606
1649
  </script>
1607
1650
 
1608
1651
  <script type="text/x-red" data-help-name="ncd-wireless-node">
1609
- <h3>Wireless Node</h3>
1652
+ <h3>Wireless Node</h3>
1610
1653
  <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
1654
  <h4>Serial Devices</h4>
1612
1655
  <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 +1662,37 @@
1619
1662
  <h4>Output</h4>
1620
1663
  <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
1664
  <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
- }
1665
+ msg = {
1666
+ topic: "sensor_data",
1667
+ payload: {
1668
+ humidity: 45.51,
1669
+ temperature: 23.91,
1670
+ }
1671
+ data: {
1672
+ nodeId: 0,
1673
+ firmware: 3,
1674
+ battery: 3.2940600000000004,
1675
+ counter: 37,
1676
+ sensor_type: 1,
1677
+ sensor_data: {
1678
+ humidity: 45.51,
1679
+ temperature: 23.91,
1680
+ },
1681
+ type: "sensor_data",
1682
+ addr: "00:13:a2:00:41:07:18:81",
1683
+ original: {
1684
+ mac: "00:13:a2:00:41:07:18:81",
1685
+ receive_options: {
1686
+ ack: 0,
1687
+ broadcast: 0,
1688
+ type: ""
1689
+ }
1690
+ },
1691
+ data: [127,0,3,3,255,37,0,1,0,17,199,9,87],
1692
+ type: "receive_packet"
1693
+ },
1694
+ _msgid: "391caba.5a19454"
1695
+ }
1653
1696
  </pre>
1654
1697
  </script>
1655
1698