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.