@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.
- package/bacnet_client.js +13 -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
|
-
|
|
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;
|