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

**URL:** <https://discourse.nodered.org/t/any-possibility-to-choose-the-serial-com-port-in-the-dashboard/78517>\
**Category:** Dashboard\
**Created:** [18 May 2023 18:43 UTC](https://discourse.nodered.org/t/any-possibility-to-choose-the-serial-com-port-in-the-dashboard/78517 "2023-05-18T18:43:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![JorgeTorres01](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jorgetorres01/32/79909_2.png) [@JorgeTorres01](https://discourse.nodered.org/u/JorgeTorres01)\
**Post date:** [18 May 2023 18:43 UTC](https://discourse.nodered.org/t/any-possibility-to-choose-the-serial-com-port-in-the-dashboard/78517/1 "2023-05-18T18:43:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [18 May 2023 19:19 UTC](https://discourse.nodered.org/t/any-possibility-to-choose-the-serial-com-port-in-the-dashboard/78517/2 "2023-05-18T19:19:30Z")

</div>

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

```auto
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`

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 May 2023 19:53 UTC](https://discourse.nodered.org/t/any-possibility-to-choose-the-serial-com-port-in-the-dashboard/78517/3 "2023-05-18T19:53:43Z")

</div>

What node are you using to perform the serial communications?

---

<div class="post-metadata">

**Author:** ![JorgeTorres01](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jorgetorres01/32/79909_2.png) [@JorgeTorres01](https://discourse.nodered.org/u/JorgeTorres01)\
**Post date:** [18 May 2023 20:10 UTC](https://discourse.nodered.org/t/any-possibility-to-choose-the-serial-com-port-in-the-dashboard/78517/4 "2023-05-18T20:10:55Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d4880e01c3b4c0d6a8ab123ee09675abcf22d985.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 May 2023 20:16 UTC](https://discourse.nodered.org/t/any-possibility-to-choose-the-serial-com-port-in-the-dashboard/78517/5 "2023-05-18T20:16:43Z")

</div>

> [@JorgeTorres01](#):
>
> I have installed : "node-red-node-serialport"

@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.

---

<div class="post-metadata">

**Author:** ![JorgeTorres01](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jorgetorres01/32/79909_2.png) [@JorgeTorres01](https://discourse.nodered.org/u/JorgeTorres01)\
**Post date:** [18 May 2023 20:32 UTC](https://discourse.nodered.org/t/any-possibility-to-choose-the-serial-com-port-in-the-dashboard/78517/6 "2023-05-18T20:32:30Z")

</div>

Hello @Colin

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

Thank you

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [19 May 2023 10:39 UTC](https://discourse.nodered.org/t/any-possibility-to-choose-the-serial-com-port-in-the-dashboard/78517/7 "2023-05-19T10:39:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 June 2023 10:40 UTC](https://discourse.nodered.org/t/any-possibility-to-choose-the-serial-com-port-in-the-dashboard/78517/8 "2023-06-18T10:40:31Z")

</div>

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