0

i am trying to connect to a bacnet network using nodejs. am able to update the date using the code

    const bacnet = require('node-bacnet');
    const client = new bacnet();

    client.timeSync('192.168.74.9', new Date('2020/08/23'));

but am not able to get values from

   client.whoIs("192.168.74.9");

  client.on('iAm', (msg) => {
    console.log(
    'address: ', msg.header.address,
    ' - deviceId: ', msg.payload.deviceId,
    ' - maxApdu: ', msg.payload.maxApdu,
    ' - segmentation: ', msg.payload.segmentation,
    ' - vendorId: ', msg.payload.vendorId
   );
 });

1 Answers1

0

Could it be the lack of specifying the correct (non-default?) port # (- although that might not explain why the date sync works); e.g. if the target device is operating upon a port other than the default port # of 47808/0xBAC0 (- such as '47810' in the following example) :

    client.whoIs("192.168.74.9:47810");

Or has the target device got 'I-Am' disabled - that can commonly be the case (in my limited experience).

Is your client binding to a NIC (Network Interface Card) that has a public (/non-private) IP address assigned/set (- instead of a 192.168.n.h address)?

For me - with the following 2 changes, your code works:

    client.whoIs("127.1.2.2:47810");

&

    'address: ', msg.header.sender.address,

And gives me the output:

address:  127.1.2.2:47810  - deviceId:  999  - maxApdu:  1476  - segmentation:  3  - vendorId:  260
DennisVM-D2i
  • 416
  • 3
  • 8