Any possibility to choose the serial COM port in the dashboard?

Hi,

Can I choose the serial COM port on the dashboard?

I have a dashboard (node-dashboard) that checks an electronic system by serial com (using an FTDI).
But if a change the FTDI the COM number change and I need to change with Node-Red Editor.
So I would like to define the COM number inside the dashboard interface.

Thank you,
Jorge

Welcome to the forums @JorgeTorres01

let me give you the tools to accomplish it.
I prefer providing the tools, that way you can apply what you learnt to other things.

  • In a function node
    • Add the serialport package using the setup tab.
    • Then in the function block its self add the (below) code
    • Attach this function node to a dashboard dropdown node
serialport.list().then(function(ports) {
    const portsArray = ports.map((p) => p.path);
    node.send({
        payload: portsArray
    })
});

You will need to use the value that is then passed in from the dropdown node = your selected com/serial port

Hint: the serialport package has a function (list) that returns a promise returning all identified ports

EDIT
Untested of course, but like 99% sure this should work.

I cant remember if all methods are at the root of the package or needs to be serialport.SerialPort.list

What node are you using to perform the serial communications?

Hello @marcus-j-davies

I have installed : "node-red-node-serialport"

I tried to paste the code in function node... This is right? sorry I'm beginning with JS

@marcus-j-davies has described how you can select a serial port in the dashboard, which is what you asked for, but the problem is that the serial node does not allow the port to be dynamically selected.

Hello @Colin

But is there any possibility to choose the COM port through the Dashboard?

Thank you

No, the only way to change which port the serial-port node is bound to is by editing the flow.

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