Hello everyone,
I am struggling with the proper configuration of the node-serialport node.
While it generally works very well, I have not been able to make it serve a binary buffer.
The result doesn't change, it seems to be still string:
What is being sent are indeed bytes of a file that contains text, but some binary header is put in front of it and I need to be able to get that all as a binary buffer.
Start node-red in a terminal and post the log here (it should have the Welcome to node red message in it). That will let us see what versions of the various tools are in use. Also which version of the serial node are you using?
What hardware and operating system are you using?
13 Nov 08:40:30 - [info] Node-RED version: v1.0.2
13 Nov 08:40:30 - [info] Node.js version: v8.10.0
13 Nov 08:40:30 - [info] Linux 4.15.0-66-generic x64 LE
13 Nov 08:40:30 - [info] Loading palette nodes
13 Nov 08:40:31 - [info] Settings file : /home/hydrologis/.node-red/settings.js
13 Nov 08:40:31 - [info] Context store : 'default' [module=memory]
13 Nov 08:40:31 - [info] User directory : /home/hydrologis/.node-red
13 Nov 08:40:31 - [warn] Projects disabled : editorTheme.projects.enabled=false
13 Nov 08:40:31 - [info] Flows file : /home/hydrologis/.node-red/flows_hydrotick.json
13 Nov 08:40:31 - [info] Starting flows
13 Nov 08:40:31 - [info] Started flows
13 Nov 08:40:31 - [info] Server now running at http://127.0.0.1:1880/
13 Nov 08:40:31 - [info] serial port /dev/ttyACM0 opened at 115200 baud 8N1
The version of node-red-node-serialport is 0.8.8.
I am running xubuntu 18.04.3 LTS.
The hardware is a BM70 bluetooth LE chip configured to work in UART mode.
Well I can't see anything wrong there, your version of node.js (8.x) is old and going out of support at the end of next month but it is still a supported version. It might be worth upgrading that to 12.x. Other than that I think maybe it needs @dceejay to comment.
[edit] If you do upgrade nodejs then after doing that re-install node red (sudo npm install -g --unsafe-perm node-red) and go into your .node-red folder and run npm install. That rebuilds everything for the new version.
I am using the exact same flow as yours. Just the baudrate changes.
But the payload of my debug is a String, no matter what I try to do.
Actually, what makes things really strange, is that if yours is a GPS, then the stream si actually a NMEA strings stream, so I would rather expect yours to fail in conversion, not mine
I am not sure what is going on and sadly I am not able to give you something to reproduce the issue.
I will now try to replicate the same configuration with node outside of node-red, to see if I find something.
If I find something worth to mention, I will be back.
Hi @dceejay,@Colin, I think I found the issue.
I would have not if I didn't import @dceejay's flow. Which made me notice that when importing a flow, the serial port configuration is added to the list of available configs.
Even if the name of the serial port setting and name is the same (whilst the input/output configuration not), it is added with the same "name".
I think this might bring some conflict. In my case one of the two was configured with String (a leftover from previous tests) and the one I was using instead as binary. But it still was returning Strings.
Once I removed all serial port config but one and set that to binary, the stream finally got binary.
Now I am asking: does this reconstruction of events even make sense?