BACnet MSTP in Node-RED

Hello,

I am attempting to read a BACnet MSTP device in Node-RED running on a Raspberry Pi. I'm connecting to the device via an RS-485 to USB adapter. I have successfully communicated to the device using YABE (Yet Another BACnet Explorer) and am able to read the analog Values of interest just fine.

To the best of my knowledge, none of the Node-RED node packages appear to support reading from an MSTP device, they all appear to be expecting BACnet IP.

I've read through several of the threads on the forum pertaining to BACnet and few have to do with MSTP specifically. Does anyone have any ideas on how I could communicate to this device from Node-RED?

To give a little more context one of the most promising routes I've tried is using this GitHub - riptideio/misty: MS/TP Support for bacpypes
I am able to run it successfully from the terminal, but it requires manual input to read an object once a connection to the device is made so it has been difficult to replicate in Node-RED. I have tried exec, pythonshell and daemon to run the program but so far I have encountered errors with each.

Exec this is the error I get:

DEBUG:bacpypes.consolelogging.ConfigArgumentParser:__init__
DEBUG:bacpypes.consolelogging.ArgumentParser:__init__
DEBUG:bacpypes.consolelogging.ConfigArgumentParser:update_os_env
DEBUG:bacpypes.consolelogging.ArgumentParser:update_os_env
DEBUG:bacpypes.consolelogging.ArgumentParser:    - settings: {'debug': set(), 'color': False, 'debug_file': '', 'max_bytes': 1048576, 'backup_count': 5, 'route_aware': False}
DEBUG:bacpypes.consolelogging.ArgumentParser:    - os environment
DEBUG:bacpypes.consolelogging.ArgumentParser:parse_args
DEBUG:bacpypes.consolelogging.ConfigArgumentParser:expand_args Namespace(buggers=False, debug=None, color=None, route_aware=None, ini='/home/jci/misty/misty/samples/bac_client.ini')
DEBUG:bacpypes.consolelogging:    - config: <configparser.ConfigParser object at 0x7fb136bd00>
DEBUG:bacpypes.consolelogging:    - ini_obj: {'objectname': 'BACClient', 'address': '25', 'interface': '/dev/ttyUSB0', 'max_masters': '127', 'baudrate': '38400', 'maxinfo': '1', 'objectide...

Pythonshell error

exit code: 2, DEBUG:bacpypes.consolelogging.ConfigArgumentParser:__init__
DEBUG:bacpypes.consolelogging.ArgumentParser:__init__
DEBUG:bacpypes.consolelogging.ConfigArgumentParser:update_os_env
DEBUG:bacpypes.consolelogging.ArgumentParser:update_os_env
DEBUG:bacpypes.consolelogging.ArgumentParser:    - settings: {'debug': set(), 'color': False, 'debug_file': '', 'max_bytes': 1048576, 'backup_count': 5, 'route_aware': False}
DEBUG:bacpypes.consolelogging.ArgumentParser:    - os environment
DEBUG:bacpypes.consolelogging.ArgumentParser:parse_args
usage: ReadProperty.py [-h] [--buggers] [--debug [DEBUG ...]] [--color]
                       [--route-aware] [--ini INI]
ReadProperty.py: error: unrecognized arguments: read 4 analogValue:29522 presentValue

Daemon immediately says "stopped" upon deployment but doesn't return any error that I'm able to see.

I'm not Python literate enough to know how to, but I'm assuming I could just remove the part of the script that asks for input and just hard code the input to read? From the terminal I have tried feeding input directly such as:
python /home/jci/misty/misty/samples/bac_client.py --ini /home/jci/misty/misty/samples/bac_client.ini <<< "read 4 analogValue:29522 presentValue"
But this returns:

Initialized the socket
mac_address = 25 
max master = 127 
baud rate = 38400 
max info frames = 1 
RS485: Initializing /dev/ttyUSB0=success!
MS/TP MAC: 19
MS/TP Max_Master: 7F
MS/TP Max_Info_Frames: 1
mstp_path=/var/tmp/ma_37giaq6z/mstpttyUSB0 
no task manager
Cleaned up MSTP temp directory

Here is what a successful interaction looks like in the terminal:

Initialized the socket
mac_address = 25 
max master = 127 
baud rate = 38400 
max info frames = 1 
RS485: Initializing /dev/ttyUSB0=success!
MS/TP MAC: 19
MS/TP Max_Master: 7F
MS/TP Max_Info_Frames: 1
mstp_path=/var/tmp/ma_zwyq53pn/mstpttyUSB0 
> read 4 analogValue:29522 presentValue
75.14591979980469
> exit
Exiting...
Cleaned up MSTP temp directory

If there is another library or method that would be better I'm very interested to try it. Or if someone can help me troubleshoot one of the methods I've tried, any help is welcome.

BACnet not well supported.
If you can place a BACnet router to bridge MS/TP to IP then I would recommend

I have tried to avoid this as I havent found what appears to be a reliable router that isn't expensive. To some degree, that is what I was wanting the Raspberry Pi to do.

Like I said, I have been able to get the Misty wrapper for BACpypes to work, but the struggle has been getting it to work in Node-RED. Or at least automating the reads and then retrieving the information in Node-RED.

Hello,

Sorry for the hiatus but I have returned to this project.

I was able to use a MS/TP to IP router and I can use the discover devices node to see my devices. However, I have been unsuccessful in retrieving any data. I followed the instructions here to the best of my knowledge but I haven't been able to see any useful data.

I have YABE (Yet Another BACnet Explorer) installed and using it I can see all the data points I need over a BACnet IP connection.

Could someone help point me in the right direction?

I should have been a little more specific. When I use a read-single-device node and use the device ID and IP address of the router, I receive information about the router, but nothing about the devices connected or their bacnet properties. I have four devices attached to the router that are collected data (temperatures, pressures, etc). These devices show up in YABE but not on the output of discover devices.

I have tried changing the device ID's to what they show up as is YABE with the same IP address, but that didn't work either.

As this issue has strayed away from BACnet MS/TP it seems appropriate that I should start a new thread. I'm going to mark this one solved.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.