Persistant USB names

So it turned out to be an ArchLinux issue in my case. A reboot solved it.

I’m facing a similar issue with the exception of I’m running HASSIO on top of docker. With this setup, /dev/serial/by-id isn’t passed into the hassio container, nor are any symlinks that I can tell.

Has anyone gotten persistant USB names when using HASSIO and docker?

thanks

I actually do have it with hassio on x86 on arch linux based.

I’ve been dealing with this and I finally got to solve it. It is as simple as:

Most of the Chinese cheap devices that come with an USB to serial chip like CH340/CH341, do share the same device info: Next follows a dump for my Wemos mini which is exactly the same as a RS485 to USB adapter and an Arduino nano clone.

Name: None
Description: USB-SERIAL CH340 (COM12)
hwid: USB VID:PID=1A86:7523 SER=5 LOCATION=1-1
serial_number: 5
location: 1-1
manufacturer: wch.cn
product: None
interface: None

That makes second and next devices to be attached to my RPI not recognizable by id.
Editing usb-serial.rules within development root ssh console does not solve the problem as there’s no way to differentiate them, even by serial number, as it is exactly the same.
The only way is to find alternative devices that do not share the same device data, then they’ll appear in /dev/serial/by-id/ with diferent names. I simply changed my Arduino Nano clone for a Arduino Micro clone that uses another chip and then I got:

  • /dev/serial/by-id/usb-Arduino_LLC_Arduino_Micro-if00
  • /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0

I hope this helps!

1 Like

So what is the soultion under hassos to get the USB I’d ?

You can get the ID from Supervisor > System > Hardware. It will be under the serial section

and how do i use this path to define settings in HA?

What device are you trying to use?

I have two RS485 to USB converters,

  1. should run server for SDM device
    https://github.com/gonium/gosdm630

  2. https://github.com/dimagoltsman/rpi_sdm this file i cannot run

  3. second converter is for modbus switches

Not too sure about this integration. But it looks like it could be this section

[Unit]
Description=SDM630 via HTTP API
After=syslog.target
[Service]
ExecStart=/usr/local/bin/sdm630 -s /dev/ttyAMA0
Restart=always
[Install]
WantedBy=multi-user.target

The second link didn’t seem to give any info for running

thanks

try this one

the main issue here is there is a file which use to run the server , but i cannot get it to work from terminal only can get it to work from raspbian

I have an Elelabs usb device that was working perfectly. But after a rooboot it look like hassio did not create de symlink between
/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 and /dev/ttyUSB0

doing ls -l /dev/serial/by-id I should get something like
/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 -> /dev/ttyUSB0
but the symlink is not created by udev or it is not available to HA and I just have
/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
That prevent my usb device to be connected by ZHA

Anyone have the same problem ?

I am here in 2022 and have the same problem with usb connections shuffeling around after a host reboot on rpi4. Is there an easy fix now?

Today I used IDs instead of Device path and it seems to be working for Modbus and Z2M

I’m using HAOS and in one container (vzlogger), there is no /dev/serial device folder. The serial devices by-id are not passed on and it does not seem possible to share them as device. I need some solution because vzlogger is driving me crazy - after each reboot its another ttyUSB number. I tried a USB drive which is named CONFIG and contains a udev rule to create a symlink, but that does not seem to work as the symlink never appears. This is where debugging the udev rules also ends with my skillset. I also tried a udev rule in the vzlogger container and created an image to make it permanent but it is not executed as well.
Any help much appreciated.

Edit: well, d’oh. It occurred to me while writing this post that instead of sharing the device I could try sharing the /dev/serial/by-id folder and that works. But the solution is still not perfect, as I tried using a by-path device in another container and I did not get all the colons “:” in the name to work with YAML, the by-id names are not self-explanatory, and I still would prefer giving names to symlinks. I wonder if HAOS is actually a bad choice?

saved my day - THX