# Set a USB device to always be /dev/ttyUSB1

**URL:** https://discourse.nodered.org/t/set-a-usb-device-to-always-be-dev-ttyusb1/61860
**Category:** General
**Created:** [27 April 2022 09:43 UTC](https://discourse.nodered.org/t/set-a-usb-device-to-always-be-dev-ttyusb1/61860 "2022-04-27T09:43:19Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![swanside](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/swanside/32/28781_2.png) [@swanside](https://discourse.nodered.org/u/swanside)
#### Post date: [27 April 2022 09:43 UTC](https://discourse.nodered.org/t/set-a-usb-device-to-always-be-dev-ttyusb1/61860/1 "2022-04-27T09:43:20Z")

</div>

Hello.  
I have 2 USB devices on my Raspberry PI, both Modbus as 1 reads my Solar equipment and the other reads an energy meter. At midnight my Pi reboots, and every so often I have to go into Node Red to change the /dev/ttyUSB1 to /dev/ttyUSB0 for my Solar equipment and then /dev/ttyUSB0 to /dev/ttyUSB1 for my energy meter. Is there a way that I can make /dev/ttyUSB1 to always be the same device please?  
Thanks  
Paul

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [27 April 2022 10:56 UTC](https://discourse.nodered.org/t/set-a-usb-device-to-always-be-dev-ttyusb1/61860/2 "2022-04-27T10:56:35Z")

</div>

Have a look here:  
[https://www.domoticz.com/wiki/PersistentUSBDevices](https://www.domoticz.com/wiki/PersistentUSBDevices)

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [27 April 2022 10:59 UTC](https://discourse.nodered.org/t/set-a-usb-device-to-always-be-dev-ttyusb1/61860/3 "2022-04-27T10:59:50Z")

</div>

A question - Why do you reboot at midnight?

---

<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: [27 April 2022 12:23 UTC](https://discourse.nodered.org/t/set-a-usb-device-to-always-be-dev-ttyusb1/61860/4 "2022-04-27T12:23:00Z")

</div>

I don't know if this applies.

but if these are serial devices - they will have a static entry in `/dev/serial/by-id`  
so rather then pointing to `/dev/ttyUSBX` point it to its  
corresponding ID. `/dev/serial/by-id/xx-xx-xx`

These ID's don't change and they are symlinks to `/dev/ttyUSBX`

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [27 April 2022 14:14 UTC](https://discourse.nodered.org/t/set-a-usb-device-to-always-be-dev-ttyusb1/61860/5 "2022-04-27T14:14:31Z")

</div>

That was going to be my recommendation as well. That's how I've set up my two USB serial devices. Much easier and saves you faffing with setup.

---

<div class="post-metadata">

### Author: ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)
#### Post date: [27 April 2022 14:44 UTC](https://discourse.nodered.org/t/set-a-usb-device-to-always-be-dev-ttyusb1/61860/6 "2022-04-27T14:44:29Z")

</div>

> [@marcus-j-davies](#):
>
> I don't know if this applies.

It does! I had forgotten this! Works fine with me.

---

<div class="post-metadata">

### Author: ![swanside](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/swanside/32/28781_2.png) [@swanside](https://discourse.nodered.org/u/swanside)
#### Post date: [27 April 2022 14:46 UTC](https://discourse.nodered.org/t/set-a-usb-device-to-always-be-dev-ttyusb1/61860/7 "2022-04-27T14:46:11Z")

</div>

Thanks all. Will help me out that.  
I just have a midnight boot on it as sometimes it becomes really slow to access remotely and found a reboot helps it out

---

<div class="post-metadata">

### Author: ![ncherry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ncherry/32/27_2.png) [@ncherry](https://discourse.nodered.org/u/ncherry)
#### Post date: [27 April 2022 15:06 UTC](https://discourse.nodered.org/t/set-a-usb-device-to-always-be-dev-ttyusb1/61860/8 "2022-04-27T15:06:01Z")

</div>

A word of warning on USB devices. Some cheap clone serial donges don't have a serial number (and I think that can't add one either) so they just get added by the Linux sub-system in the order they respond. Real serial dongle have a serial number and each is unique so they can be properly handled by the USB subsystem.

Note: serial number != serial port. 🙂

---

<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: [26 June 2022 15:06 UTC](https://discourse.nodered.org/t/set-a-usb-device-to-always-be-dev-ttyusb1/61860/9 "2022-06-26T15:06:47Z")

</div>

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