@bitpoolos/edge-bacnet 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.
Files changed (2) hide show
  1. package/bacnet_client.js +13 -2
  2. package/package.json +1 -1
package/bacnet_client.js CHANGED
@@ -323,7 +323,18 @@ class BacnetClient extends EventEmitter {
323
323
  devicesToRead.forEach(function(key, index) {
324
324
  let device = that.deviceList.find(ele => `${that.getDeviceAddress(ele)}-${ele.getDeviceId()}` == key);
325
325
  let deviceName = device.getDeviceName();
326
- bacnetResults[deviceName] = readConfig.pointsToRead[key];
326
+ let deviceKey = (typeof device.getAddress() == "object") ? device.getAddress().address + "-" + device.getDeviceId() : device.getAddress() + "-" + device.getDeviceId();
327
+ let deviceObject = that.networkTree[deviceKey];
328
+ if(!bacnetResults[deviceName]) bacnetResults[deviceName] = {};
329
+ if(deviceObject) {
330
+ for(const pointName in readConfig.pointsToRead[key]) {
331
+ let bac_obj = that.getObjectType(readConfig.pointsToRead[key][pointName].objectID.type);
332
+ let objectId = pointName + "_" + bac_obj + '_' + readConfig.pointsToRead[key][pointName].objectID.instance;
333
+ let point = deviceObject[objectId];
334
+ bacnetResults[deviceName][pointName] = point;
335
+ }
336
+ }
337
+
327
338
  if(index == devicesToRead.length - 1) that.emit('values', bacnetResults, outputType, objectPropertyType);
328
339
  });
329
340
  } catch(e) {
@@ -331,7 +342,7 @@ class BacnetClient extends EventEmitter {
331
342
  }
332
343
  }
333
344
 
334
- getDeviceAddress(device){
345
+ getDeviceAddress(device) {
335
346
  switch(typeof device.getAddress()) {
336
347
  case "object":
337
348
  return device.getAddress().address;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitpoolos/edge-bacnet",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A bacnet gateway for node-red",
5
5
  "dependencies": {
6
6
  "async-mutex": "^0.4.0",