Custom serial node

Hi everyone,

I'm using Node-red to develop an app to interact with serial devices : get data, send setpoints...
I'm using it on Raspberry Pi 4 with Raspbian Buster.

Users of this app will plug their serial devices to one of the 4 Raspberry Pi USB plugs, or to a USB hub.
For easier configuration I created udev rules to give names to these ports (usb_1 is top left, usb_2 is top right,...).
I have one Node-red flow for each device type.
For now I enable only useful flows and I have to configure the serial-request or serial-in nodes on Node-red admin interface.

My objective is to allow the user to say in the dashboard on which port he plugged which device and I'm looking for advice on the best way to do it.

It seems that it is not possible to dynamically set the serial port name.
I read (here) that by customizing 25-serial.js it was possible to add this kind of functionality.

So my questions are :

  • is this the best way to solve my problem ?
  • how to apply this to serial-in nodes ?
  • is it possible to disable unused nodes to avoid errors on node-red console ?

Then I'll try to disable UI tabs for unused devices, but this seems possible now.

Many thanks for your help,