@bitpoolos/edge-bacnet 1.2.5 → 1.2.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.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+
7
+ ---
8
+
9
+ **Describe the bug**
10
+ A clear and concise description of what the bug is.
11
+
12
+ **To Reproduce**
13
+ Steps to reproduce the behavior:
14
+ 1. Go to '...'
15
+ 2. Click on '....'
16
+ 3. Scroll down to '....'
17
+ 4. See error
18
+
19
+ **Expected behavior**
20
+ A clear and concise description of what you expected to happen.
21
+
22
+ **Screenshots**
23
+ If applicable, add screenshots to help explain your problem.
24
+
25
+ **System Information (please complete the following information):**
26
+ - OS: [e.g. iOS]
27
+ - Browser [e.g. chrome, safari]
28
+ - Version [e.g. 1.2]
29
+ - Node-RED version:
30
+ - NodeJS version:
31
+
32
+ **Are you running Node-RED in a docker container or directly on the operating system or virtual machine?**
33
+
34
+
35
+
36
+ **Please provide a dump of the Node-RED error log with the Error logging and Device Found check box options enabled (found in _gateway_ node - _Discovery_ tab) if applicable:**
37
+
38
+
39
+
40
+ **Additional context**
41
+ Add any other context about the problem here.
package/bacnet_client.js CHANGED
@@ -27,11 +27,12 @@ class BacnetClient extends EventEmitter {
27
27
  that.mutex = new Mutex();
28
28
  that.manualMutex = new Mutex();
29
29
  that.pollInProgress = false;
30
+ that.scanMatrix = [];
30
31
 
31
32
  try {
32
-
33
+
33
34
  let cachedData = JSON.parse(Read_Config_Sync());
34
- if(typeof cachedData == "object") {
35
+ if(cachedData && typeof cachedData == "object") {
35
36
  if(cachedData.renderList) that.renderList = cachedData.renderList;
36
37
  if(cachedData.deviceList) {
37
38
  cachedData.deviceList.forEach(function(device) {
@@ -41,15 +42,14 @@ class BacnetClient extends EventEmitter {
41
42
  }
42
43
  if(cachedData.pointList) that.networkTree = cachedData.pointList;
43
44
  }
45
+
46
+
44
47
 
45
48
  that.config = config;
46
49
  that.roundDecimal = config.roundDecimal;
47
50
  that.apduSize = config.apduSize;
48
51
  that.maxSegments = config.maxSegments;
49
52
  that.discover_polling_schedule = config.discover_polling_schedule;
50
- that.device_id_range_enabled = config.device_id_range_enabled;
51
- that.device_id_range_start = config.device_id_range_start;
52
- that.device_id_range_end = config.device_id_range_end;
53
53
  that.deviceId = config.deviceId;
54
54
  that.broadCastAddr = config.broadCastAddr;
55
55
  that.manual_instance_range_enabled = config.manual_instance_range_enabled;
@@ -63,8 +63,10 @@ class BacnetClient extends EventEmitter {
63
63
  maxApdu: that.apduSize
64
64
  };
65
65
 
66
- try {
66
+
67
67
 
68
+ try {
69
+
68
70
  that.client = new bacnet.Client({ apduTimeout: config.apduTimeout, interface: config.localIpAdrress, port: config.port, broadcastAddress: config.broadCastAddr});
69
71
  that.setMaxListeners(1);
70
72
 
@@ -104,15 +106,15 @@ class BacnetClient extends EventEmitter {
104
106
  }, "5000")
105
107
 
106
108
  } catch(e) {
107
- console.log("Issue initializing client: ", e)
108
109
  that.logOut("Issue initializing client: ", e)
109
110
  }
110
111
 
111
112
  //who is callback
112
113
  that.client.on('iAm', (device) => {
113
114
  if(device.address !== that.config.localIpAdrress) {
114
- if(that.device_id_range_enabled) {
115
- if(device.deviceId >= that.device_id_range_start && device.deviceId <= that.device_id_range_end) {
115
+ if(that.scanMatrix.length > 0) {
116
+ let matrixMap = that.scanMatrix.filter(ele => device.deviceId >= ele.start && device.deviceId <= ele.end);
117
+ if(matrixMap.length > 0) {
116
118
  //only add unique device to array
117
119
  let foundIndex = that.deviceList.findIndex(ele => ele.getDeviceId() == device.deviceId);
118
120
  if(foundIndex == -1) {
@@ -165,6 +167,7 @@ class BacnetClient extends EventEmitter {
165
167
  that.reinitializeClient(that.config);
166
168
  }
167
169
  });
170
+
168
171
  }
169
172
 
170
173
  logOut(param1, param2) {
@@ -398,9 +401,6 @@ class BacnetClient extends EventEmitter {
398
401
  that.apduSize = config.apduSize;
399
402
  that.maxSegments = config.maxSegments;
400
403
  that.discover_polling_schedule = config.discover_polling_schedule;
401
- that.device_id_range_enabled = config.device_id_range_enabled;
402
- that.device_id_range_start = config.device_id_range_start;
403
- that.device_id_range_end = config.device_id_range_end;
404
404
  that.deviceId = config.deviceId;
405
405
  that.broadCastAddr = config.broadCastAddr;
406
406
  that.manual_instance_range_enabled = config.manual_instance_range_enabled;
@@ -920,17 +920,6 @@ class BacnetClient extends EventEmitter {
920
920
 
921
921
  globalWhoIs() {
922
922
  let that = this;
923
- let options = {
924
- lowLimit: 0,
925
- highLimit: bacnetIdMax,
926
- 'net': 65535
927
- };
928
-
929
- if(that.device_id_range_enabled == true) {
930
- options.lowLimit = that.device_id_range_start;
931
- options.highLimit = that.device_id_range_end;
932
- }
933
-
934
923
  if(that.client) {
935
924
  that.client.whoIs({'net': 65535});
936
925
  } else {
@@ -944,7 +933,11 @@ class BacnetClient extends EventEmitter {
944
933
  let that = this;
945
934
  return new Promise(async function(resolve, reject) {
946
935
  try {
947
- resolve({renderList: that.renderList, deviceList: that.deviceList, pointList: that.networkTree, pollFrequency: that.discover_polling_schedule});
936
+ const reducedDeviceList = JSON.parse(JSON.stringify(that.deviceList));
937
+ reducedDeviceList.forEach((device) => {
938
+ delete device["pointsList"];
939
+ });
940
+ resolve({renderList: that.renderList, deviceList: reducedDeviceList, pointList: that.networkTree, pollFrequency: that.discover_polling_schedule});
948
941
  } catch(e){
949
942
  reject(e);
950
943
  }