Bacnet code inside function not working using bacstack library

AS bacnet node was not working for me so, I used bacstack library. I am trying to read the data from a bacnet simulator. But I am getting below error

err:  Error: ERR_TIMEOUT
    at Timeout._onTimeout (C:\Users\EpsilonPrime\node_modules\bacstack\lib\client.js:75:16)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)

Below is the nodejs code written using bacstack library which I wanted to include in function node.

const bacnet = require('bacstack');

// Initialize BACStack
const client = new bacnet({apduTimeout: 3000});



// Discover Devices
client.on('iAm', (device) => {
  console.log('address----------> ', device.address);
  console.log('deviceId---------->  ', device.deviceId);
  console.log('maxApdu---------->  ', device.maxApdu);
  console.log('segmentation---------->  ', device.segmentation);
  console.log('vendorId---------->  ', device.vendorId);
  console.log('object type---------->  ', device.vendorId);
  console.log('vendorId---------->  ', device.vendorId);


// Read Device Object
client.readProperty('', {type: 8, instance: 2195695}, 28, (err, value) => {
  console.log('value: ', value);
  console.log('err: ', err);

I am getting the below reponse:

Below is the simulator snap, I am using Yabe simulator:
enter image description here

enter image description here

It is discovering the device but not able to read the value, is there any IP related issue.

And does it work in nodejs directly (without node-red)?

Its is working, it is discovering the device but it is not reading the value of that device....just see above post you will get to know

anyone who can help us out through it?

Well, this isn't a support forum for the bacnet npm module you are trying to use, so you may not get very far.

@VIKRAMAS have you reported the issues you have with the bacnet node to its author?

In the screenshot, before the err:, it shows value: undefined
Is there something missing ?

we have checked everything......we need some guidance we are almost there, because if this issue is solved then we dont have to write a nodejs function as the bacnet node is also giving same exception it can be resolved if this problem is resolved.

As @bakman2 suggested, have you tried this in node js (i.e. outside of node red)?

Also, have you tried communicating to localhost or

Have you tried using another bacnet tool to see if you can read values from that simulator? To verify it actually permits read operations for your virtual device.

Lastly, if you get the same error in pure node js, you might get more help if you post an issue on the bacstack repo

I have tried in nodejs itself, I am able to discover the device but not able read its objects, and i had also posted an issue in bacstack repo

I am totally new to node-red but seasoned in BACnet. I apologize but the debug information is not easy to understand but I would suggest to use a monitoring tool like WireShark to actual see what get send and what comes back. This tool can decode BACnet messages into clear text and might help in understanding what is going on. This should help to isolate the problem.

1 Like

Good afternoon.

I am working with bacnet nodes, and it is presenting me with this error message:

Error: BacnetError Class: SERVICES (5) Code: REJECT_UNRECOGNIZED_SERVICE (67)