Where I am curious about is, what is the case between it? Maybe you can change your approach and instead of port select the serial device by ID. See /dev/serial/by-id in your linux machine.
I was previously using by-path, so it should work to use by-id - I just need to wrap my head around selecting this setting from a dashboard and seeing if it can be done...
No but if you want to change the input make a flow with a switch that looks to a global variable. And connect all devices on a seperate input node, but let the switch only pass the ones that are selected based on the value of the global variable.
Ah, got you! - in my "simple terms" - set up a bunch of "default" configuration serial nodes referring to usb0/usb1/usb2 etc and just limit/enable the comms to those nodes via "switch control" ..... that might just work for me!!
Tnx
E
Edit: I would rather go the "port" route than by name/id - If I can remember, the name/id changes according to the hardware type installed - would make the maintenance a bit easier for me in the long run, especially with my "lightning strike" track history ATM...
That is exactly why I asked you to give some more information about what en why you to achieve something. It can give people more insight to have a alternative solution. For me the id was the best solution because the device in was always the same, only the port changed sometimes.
Here's the "alternative solution" I have settled on, thanks for the pointer into this direction!
Depending on a global variable written to disk in the parameters, the switch nodes only allow writing to a particular usb port and reading from that same usb port....
If you only ever have one serial usb device plugged in the you could use a udev rule to map any serial device plugged in to a fixed virtual device to, for example, /dev/serial. Configure node red to use that device and it should work with any device. you might even be able to hot plug them, I am not sure.
Wont work for me.... Multiple devices, but might help someone else indeed!
But interestingly, regarding the hotplugging, I don't think it will... It seems that while an i/o can be pointed to the correct usb while "live", Node Red doesn't seem to pick it up until it is restarted with the device in place, or indeed, if node red is redeployed with a change to the usb config made to forcibly redeploy the port...
There probably is a setting/method that can be employed to rescan the ports without redeploying NR, but I will need to look around to see if I can find anything...