node-bacstack icon indicating copy to clipboard operation
node-bacstack copied to clipboard

Using with MSTP Router

Open dushyantbangal opened this issue 5 years ago • 14 comments

Node Version: 8

Node BACstack Version: "0.0.1-beta.13"

  • [ ] Bug Report
  • [x] Feature Request
  • [x] Question

Note: Make sure you have read the FAQs before logging this issue.

Feature Request / Question

I have a bacnet router that is connecting MSTP to IP. Is it possible to read the data from the devices under it? I am able to read the properties of the router, but not the devices under it.

I am able to read the data from YABE

image

dushyantbangal avatar Aug 10 '19 10:08 dushyantbangal

See #48 , I have a fork that does this but its not well tested nor fully complete. Needs proper tests & vetting of all the services before its up to spec with the rest of this repo for a PR.

NateZimmer avatar Aug 10 '19 15:08 NateZimmer

@NateZimmer I had a look at your fork, even tried using it before posting this issue. But I think I was doing something wrong with the net and adr. I didnt fully understand it, as I'm new to bacnet. I was just about to post the issue there, I think you've disabled posting issues.

dushyantbangal avatar Aug 12 '19 06:08 dushyantbangal

@NateZimmer this is my bacnet router's configuration: image

What should be my settings? I see the devices do have unique instance ids across the network, but the properties inside the devices have unique instance ids only under that device, and not across the whole network.

So far I have been able to read only the properties on the router device.

dushyantbangal avatar Aug 12 '19 07:08 dushyantbangal

Hey @dushyantbangal, first you should use that fork and perform a who-is on the same subnet as that router.

If you have MSTP devices on that router & the router is functioning properly, you should get a response back from the router with those devices.

 client.whoIs({'address':{'net':0xFFFF,'ip':'xxx.xxx.xxx.255'}});

Device iAM responses from the router should have a net and adr.

You can then read objects from those devices like so:

client.readProperty( {'ip':'192.168.1.166','net':2000,'adr':[9]} , {type: 8, instance: 532663}, 85, (err, value) => {
  console.log('value: ', value);
});

NateZimmer avatar Aug 13 '19 00:08 NateZimmer

Device iAM responses from the router should have a net and adr.

Great!

But for some weird reason, on Ubuntu Virtual Box inside Windows, I was not getting any response on who-is. I was getting response to readProperty, on the router properties and other direct BACnet IP devices.

While on Windows, I was just getting responses for who-is and nothing on readProperty. Are you aware of anything like this?

I'll have to try it again once I get access to the network.

dushyantbangal avatar Aug 13 '19 15:08 dushyantbangal

In this a little late. I am able to get the read request working through the router, but am unable to get the write properties to work. I am defining it exactly as in the read requests, but no luck. I can write to the values in the router just fine, just not the controller on the other side. Any ideas?

RyeBot33 avatar Feb 14 '20 21:02 RyeBot33

@RBrothersBSI use wireshark to capture the who-is responses from the router as well as the write property request being sent to the router. Wireshark can help verify if the packet is being formatted correctly as well as a clue as to what might be going wrong.

NateZimmer avatar Feb 15 '20 21:02 NateZimmer

Bingo. Using wireshark I was able to see what the issue was. priorityZero By default it was attempting to write at priority zero and I wasn't providing it any options. In the write property method in client.js I added || 16 to settings.priority to give it a fallback if not provided. Thank you, sir!

RyeBot33 avatar Feb 16 '20 18:02 RyeBot33

These changes should also be incorporated int https://github.com/BiancoRoyal/node-bacstack, please try this package and open issues at https://github.com/BiancoRoyal/node-bacstack/issues if it does not work as expected

Apollon77 avatar May 26 '20 23:05 Apollon77

client.whoIs({'address':{'net':0xFFFF,'ip':'xxx.xxx.xxx.255'}});

Nate I tried this with your fork and it throws a RTE

dgram.js:396 throw new ERR_INVALID_ARG_TYPE('address', ['string', 'falsy'], address); ^

TypeError [ERR_INVALID_ARG_TYPE]: The "address" argument must be one of type string or falsy. Received type object at Socket.send (dgram.js:396:11) at module.exports.self.send (C:\zimmer-bacstack\node-bacstack\node_modules\bacstack\lib\transport.js:38:12) at EventEmitter.self.whoIs (C:\zimmer-bacstack\node-bacstack\node_modules\bacstack\lib\client.js:403:15) at Object. (C:\zimmer-bacstack\node-bacstack\index.js:38:8) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)

I am trying to read the properties of an MS/TP device and so far I've had no luck with multiple forks.

YABE gives me an error when trying to read the child objects. image

mwitt1337 avatar Jul 20 '20 15:07 mwitt1337

@mwitt1337 Can you please try the fork https://github.com/BiancoRoyal/node-bacstack !?

Apollon77 avatar Jul 20 '20 15:07 Apollon77

I did get the WHOIS to work.

image

Device 156 is the MS/TP to IP router I am trying to get through. I'm not seeing the "NET" and "ADR". The readproperties of 156 did work but there isn't much there. Here is the JSON visualized

image

I'm just stuck at how do I get the NET and ADR info so that I can access the devices beyond the MS/TP router? Is there something I'm not seeing in this information?

This is from a BACNET explorer. It shows "NET 1" and a long MAC Address is this the info I need? What ADR would I use? image

mwitt1337 avatar Jul 21 '20 17:07 mwitt1337

Can you please show your code? (And when you use a fork then maybe better continuing in an issue there)

Apollon77 avatar Jul 21 '20 19:07 Apollon77

I will open an issues under the fork https://github.com/BiancoRoyal/node-bacstack

mwitt1337 avatar Jul 21 '20 19:07 mwitt1337