Hello,
I am attempting to communicate to BACnet MS/TP devices through a BACnet IP router using Node-RED. I have viewed other forum posts similar to my question but I'm wondering if there is any new information. I realize BACnet is not a popular topic and support for it is limited on this forum but I thought maybe it was worth a shot.
I have used node-red-contrib-bacnet
and node-bacnet-contrib-extended
and I can get an appropriate response from the "WhoIs" command for both node packages. The router and information about the router is retrieved. However I have not been able to figure out a way to read the devices under the router. I am able to see them, and retrieve the values of interest, with YABE, and I have read on other forums there is a way to specify the network number of the router and then poll device ID's under that network. I'm just not sure how to do that with the tools available in Node-RED.
If this isn't possible, I am about ready to pursue a Python route where I can use BAC0
or BACpypes
to establish communication, and send this to Node-RED. I'm not sure which node would be best between exec
, python-function
, or pythonshell
nodes.
Would anyone be able to help with the pure Node-RED solution, or point me in the right direction of which of the python methods would be best?
I'm not sure I'm going to get any hits on this topic so I thought I would post what solution I went with. I was never able to figure out how to get any of the Node-RED packages to see the devices connected to the MS/TP router.
I ended up using the BAC0 library which is built on BACpypes. I modified some existing examples of a python program to read the properties of interest, and then print them to std out. I then used an exec
node in spawn mode to call the python program. This has worked very well for the past 12 days.
This section is a little extra information for anyone interested in trying to get the existing Node-RED packages to emulate what I did in BAC0. Essentially when discovering devices on the BACnet network, the router will show up as a device and there will be a secondary network of devices associated with a network number. Then you can poll the devices to retrieve the properties you are interested in. There might be a way to do this with the Node-RED nodes but I have not spent much time investigating since I got my project up and running. If anyone makes any progress feel free to post here so we can all learn. I will do the same myself.
It is certainly not a bad idea to have some services running outside of NR and then communicate the result back. Some could also be ready to accept command from NR. I have done this myself since long, mainly since I already had really well working Python modules I early used with another solution. Today I think I have some 25-30 various Python scripts running as services for various reasons & missions. Some I did migrate to javascripts, most of them I just kept but I added support to MQTT in all; this gives full flexibility and makes it so simple to integrate with NR (and other solutions that supports MQTT).
So my suggestion, even though what you have is working fine, is that you add MQTT to your Python script. You would then be able to receive events (or change of properties) as they happen, no polling needed. MQTT also has support for QoS to guarantee that events are received correctly. In addition it would be a simple task also to add support for commands (in case you would need that)
That is a good suggestion that I will most likely implement. Thank you.