node-bacstack
node-bacstack copied to clipboard
Using with MSTP Router
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
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 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.
@NateZimmer this is my bacnet router's configuration:
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.
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);
});
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.
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?
@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.
Bingo. Using wireshark I was able to see what the issue was.
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!
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
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.
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.
@mwitt1337 Can you please try the fork https://github.com/BiancoRoyal/node-bacstack !?
I did get the WHOIS to work.
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
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?
Can you please show your code? (And when you use a fork then maybe better continuing in an issue there)
I will open an issues under the fork https://github.com/BiancoRoyal/node-bacstack