<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.domoticz.com/index.php?action=history&amp;feed=atom&amp;title=PersistentUSBDevices</id>
	<title>PersistentUSBDevices - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.domoticz.com/index.php?action=history&amp;feed=atom&amp;title=PersistentUSBDevices"/>
	<link rel="alternate" type="text/html" href="https://wiki.domoticz.com/index.php?title=PersistentUSBDevices&amp;action=history"/>
	<updated>2026-09-20T03:28:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://wiki.domoticz.com/index.php?title=PersistentUSBDevices&amp;diff=18545&amp;oldid=prev</id>
		<title>Walter vl: /* Find IDs of the USB devices */</title>
		<link rel="alternate" type="text/html" href="https://wiki.domoticz.com/index.php?title=PersistentUSBDevices&amp;diff=18545&amp;oldid=prev"/>
		<updated>2024-04-16T07:02:48Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Find IDs of the USB devices&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;If you have multiple USB devices connected to a Linux system, sometimes after a reboot the device order is changed (/dev/ttyUSB0 becomes /dev/ttyUSB1, or the other way around). The consequence of this is that Domoticz will have the incorrect devices selected in its setup.&lt;br /&gt;
&lt;br /&gt;
=Use /dev/serial/by-id devices.=&lt;br /&gt;
&amp;lt;nowiki&amp;gt;**&amp;lt;/nowiki&amp;gt; &amp;#039;&amp;#039;&amp;#039;Don&amp;#039;t use /dev/ttyUSBx **&amp;#039;&amp;#039;&amp;#039;  but /dev/serial/by-id !&lt;br /&gt;
&lt;br /&gt;
In Domoticz you should also be able to choose the serial port by ID. These by-id devices do not change even if you put the USB stick in another port.&lt;br /&gt;
&lt;br /&gt;
We do this by issuing the following command to find out the attached USB devices:&lt;br /&gt;
 ls /dev/serial/by-id&lt;br /&gt;
You should see one or multiple serial devices, for example it&amp;#039;s: &amp;#039;&amp;#039;&amp;#039;usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
This solution should also be preferred even if you have only a single USB device.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If your system does not have /dev/serial/by-id, you can continue reading below to find a sollution&lt;br /&gt;
&lt;br /&gt;
=Find IDs of the USB devices when no by-id devices are present=&lt;br /&gt;
Make sure all the usb devices are plugged in.&lt;br /&gt;
&lt;br /&gt;
Run the following command: &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo lsusb -v | grep &amp;#039;idVendor\|idProduct\|iProduct\|iSerial&amp;#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and write down the:&lt;br /&gt;
&lt;br /&gt;
 *idVendor&lt;br /&gt;
 *idProduct&lt;br /&gt;
 *iSerial (if this is zero, you can ignore it)&lt;br /&gt;
&lt;br /&gt;
=Or use this command=&lt;br /&gt;
&amp;lt;code&amp;gt;dmesg&amp;lt;/code&amp;gt; &amp;lt;br&amp;gt;&lt;br /&gt;
And search the list&lt;br /&gt;
&lt;br /&gt;
=Examples=&lt;br /&gt;
The RFXtrx433 is reported as:&lt;br /&gt;
&lt;br /&gt;
  idVendor           0x0403 Future Technology Devices International, Ltd&lt;br /&gt;
  idProduct          0x6001 FT232 USB-Serial (UART) IC&lt;br /&gt;
  iProduct                2 RFXtrx433&lt;br /&gt;
  iSerial                 3 07VYAR1X&lt;br /&gt;
&lt;br /&gt;
Aeon ZWave USB stick is reported as:&lt;br /&gt;
&lt;br /&gt;
  idVendor           0x10c4 Cygnal Integrated Products, Inc.&lt;br /&gt;
  idProduct          0xea60 CP210x UART Bridge / myAVR mySmartUSB light&lt;br /&gt;
&lt;br /&gt;
Future Technology EnOcean USB300 stick is reported as:&lt;br /&gt;
&lt;br /&gt;
  idVendor           0x0403 Future Technology Devices International, Ltd&lt;br /&gt;
  idProduct          0x6001 FT232 USB-Serial (UART) IC&lt;br /&gt;
  iProduct                2 EnOcean USB 300 DB&lt;br /&gt;
  iSerial                 3 FTAZ2SI&lt;br /&gt;
&lt;br /&gt;
You need the part behind the &amp;#039;0x&amp;#039;. So you don&amp;#039;t have to write down &amp;#039;0x0403&amp;#039; but &amp;#039;0403&amp;#039;. When we deal with hexadecimal numbers, they are written with a 0x in front of them so we don&amp;#039;t confuse them with base 10 numbers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Creating rules file=&lt;br /&gt;
Create a rules file, with the following example content:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sudo nano /etc/udev/rules.d/99-usb-serial.rules&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note: values in the following code are examples; put in the actual values for your system between the quotes (e.g. replace them with the idVendor, idProduct and iSerial corresponding to your USB device.&lt;br /&gt;
&lt;br /&gt;
===RFX-433===&lt;br /&gt;
&lt;br /&gt;
Put the following content in the file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SUBSYSTEM==&amp;quot;tty&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;123YAOOW&amp;quot;, SYMLINK+=&amp;quot;ttyUSB-RFX433-A&amp;quot;&lt;br /&gt;
&lt;br /&gt;
SUBSYSTEM==&amp;quot;tty&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;123YX78C&amp;quot;, SYMLINK+=&amp;quot;ttyUSB-RFX433-B&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some devices don&amp;#039;t show a serial, you can remove that part in the file, so it looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;SUBSYSTEM==&amp;quot;tty&amp;quot;, ATTRS{idVendor}==&amp;quot;1a86&amp;quot;, ATTRS{idProduct}==&amp;quot;7523&amp;quot;, SYMLINK+=&amp;quot;ttyUSB-RFX433&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Names should be ttyUSB-UNIQUENAME so you can easily identify them within Domoticz.&lt;br /&gt;
&lt;br /&gt;
===AeoTec Z-Stick===&lt;br /&gt;
Gen2:&lt;br /&gt;
&amp;lt;code&amp;gt;SUBSYSTEM==&amp;quot;tty&amp;quot;, ATTRS{idVendor}==&amp;quot;10c4&amp;quot;, ATTRS{idProduct}==&amp;quot;ea60&amp;quot;, SYMLINK+=&amp;quot;ttyUSB-ZStick-2G&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Gen5:&lt;br /&gt;
&amp;lt;code&amp;gt;SUBSYSTEM==&amp;quot;tty&amp;quot;, ATTRS{idVendor}==&amp;quot;0658&amp;quot;, ATTRS{idProduct}==&amp;quot;0200&amp;quot;, SYMLINK+=&amp;quot;ttyUSB-ZStick-5G&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Future Technology EnOcean USB300 stick===&lt;br /&gt;
&amp;lt;code&amp;gt;SUBSYSTEM==&amp;quot;tty&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;FTAZ2SI&amp;quot;, SYMLINK+=&amp;quot;ttyUSB-EnOcean&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Opentherm Gateway===&lt;br /&gt;
&amp;lt;code&amp;gt; SUBSYSTEM==&amp;quot;tty&amp;quot;, ATTRS{idVendor}==&amp;quot;067b&amp;quot;, ATTRS{idProduct}==&amp;quot;2303&amp;quot;,SYMLINK+=&amp;quot;ttyUSB-OTG&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===P1 smartmeter===&lt;br /&gt;
&amp;lt;code&amp;gt; SUBSYSTEM==&amp;quot;tty&amp;quot;, ATTRS{idVendor}==&amp;quot;0403&amp;quot;, ATTRS{idProduct}==&amp;quot;6001&amp;quot;, ATTRS{serial}==&amp;quot;A7XKCMHJ&amp;quot;, SYMLINK+=&amp;quot;ttyUSB-P1&amp;quot; &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=When you see no device=&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
 sudo mknod /dev/ttyUSB0 c 188 0&lt;br /&gt;
 sudo mknod /dev/ttyUSB1 c 188 1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
And do the steps again.&lt;br /&gt;
&lt;br /&gt;
=Reboot your Linux system and check results=&lt;br /&gt;
Restart (sudo reboot) with&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo shutdown -r now&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
After the reboot you should have two new serial ports (ttyUSB21 and ttyUSB22), and they will always be assigned to the devices you have configured in the rules file.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use the new ports, in Domoticz go to the Setup -&amp;gt; Hardware webpage, highlight the RFXtrx433, and in the Serial Port dropdown list select the new Port &amp;#039;ttyUSB21&amp;#039;. &amp;lt;br&amp;gt;&lt;br /&gt;
Then save.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Alternatively, you can reload the udev rules without rebooting by running the following command:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;sudo  udevadm control --reload&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Then disconnect and reconnect the USB device, to see if it works.&lt;br /&gt;
&lt;br /&gt;
=Alternative filtering via Devpath=&lt;br /&gt;
When there is a situation with two or more devices with the same vendor ID and productID and there is no serial number, then you can use the options below to add some other way of filtering. In this case we&amp;#039;ll use the dev path, which is the IDs the devices have gotten in the USB hierarchy. The downside of using the devpath is that the devices will always have to stay plugged into the same physical port.&lt;br /&gt;
&lt;br /&gt;
Like above, find the &amp;#039;&amp;#039;idVendor&amp;#039;&amp;#039; and &amp;#039;&amp;#039;idProduct&amp;#039;&amp;#039; codes by typing &amp;lt;code&amp;gt;lsusb -v&amp;lt;/code&amp;gt;. Next, find the devices place in USB hierarchy. You can see this hierarchy by typing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lsusb -t&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This gives an example output of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M&lt;br /&gt;
  |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M&lt;br /&gt;
      |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M&lt;br /&gt;
      |__ Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=ch341, 12M&lt;br /&gt;
      |__ Port 5: Dev 6, If 0, Class=Vendor Specific Class, Driver=ch341, 12M&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The devpath is the port hierachy. So in this specific example, using two cheap Chinese Arduino clones without proper serial numbers on a Raspberry Pi 3, we might add this to the USB Serial Rules file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;SUBSYSTEM==&amp;quot;tty&amp;quot;, ATTRS{idVendor}==&amp;quot;1a86&amp;quot;, ATTRS{idProduct}==&amp;quot;7523&amp;quot;, ATTRS{devpath}==&amp;quot;1.2&amp;quot;, SYMLINK+=&amp;quot;ttyUSB-arduino1&amp;quot;&lt;br /&gt;
SUBSYSTEM==&amp;quot;tty&amp;quot;, ATTRS{idVendor}==&amp;quot;1a86&amp;quot;, ATTRS{idProduct}==&amp;quot;7523&amp;quot;, ATTRS{devpath}==&amp;quot;1.5&amp;quot;, SYMLINK+=&amp;quot;ttyUSB-arduino2&amp;quot;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Alternative filtering via other attributes=&lt;br /&gt;
Another option to distinguish the devices, is to look for other dissimilarities with the udevadm tool:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;udevadm info -a -n /dev/ttyUSBX&amp;lt;/code&amp;gt; ..where you should replace the X with a number. You can find that number by typing &amp;lt;code&amp;gt;ls /dev&amp;lt;/code&amp;gt; and looking for entries starting with ttyUSB.&lt;br /&gt;
&lt;br /&gt;
Udevadm info starts with the device specified by the devpath and then walks up the chain of parent devices. It prints for every device found, all possible attributes in the udev rules key format. A rule to match, can be composed by the attributes of the device and the attributes from one single parent device.&lt;br /&gt;
&lt;br /&gt;
Now compare the output of both devices and find some non-simulare attributes. Then add a rule based on that to the 99-usb-serial.rules file&lt;br /&gt;
&lt;br /&gt;
[[Category:Domoticz]]&lt;br /&gt;
[[Category:Manual]]&lt;br /&gt;
[[Category:Setup]]&lt;br /&gt;
[[Category:433]]&lt;br /&gt;
[[Category:Z-Wave]]&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:Raspberry Pi]]&lt;/div&gt;</summary>
		<author><name>Walter vl</name></author>
	</entry>
</feed>