2

I am trying to read the data from a bacnet simulator. But I am getting 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.

const bacnet = require('bacstack');

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

console.log(client);

//console.log(client.EventEmitter)


// 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);
});


client.whoIs();

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

I am getting the below reponse: enter image description here

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

enter image description here

ashok
  • 1,078
  • 3
  • 20
  • 63

2 Answers2

0

First off, I'm wondering whether - to start with, if you should be switching to this follow-on project instead (?):

https://www.npmjs.com/package/node-bacnet

But secondly, you might be able to use the 'loopback' (Class A) range of addresses, if you want to run more than one BACnet/IP service upon the same (* local *) machine - as long as they're (e.g. client & server) are running upon/using the same port #, or at least both aware & able to communicate with the other port #.

E.g. 127.1.1.2 for the (BACnet/IP) 'client' service and 127.1.2.2 server for the 'server' service (- maybe for simplicity both running upon port # 47810).

DennisVM-D2i
  • 416
  • 3
  • 8
0

Currently (30.6.2022), bacstack and node-bacnet does not support connecting to simulated devices running on same computer (with same IP). Yabe has this feature.

Details: in Yabe\BACnetTransport.cs are two UDP clients - m_shared_conn and m_exclusive_conn. m_shared_conn listens on default bacnet broadcast port 47808, while m_exclusive_conn uses randomly assigned port for sending data (and receiving non broadcast messages).

Same approach can be added to node-bacnet/lib/transport.js, but it is not there now.

Bachor
  • 828
  • 12
  • 17