Same multible USB Audio Devices

I have several USB audio devices connected to my Home Assistant.
These are all from the same vendor and therefore show the same name in the configuration screens.

Is there a way to change the names of the devices so that I can distinguish them in the configuration?

Hah, that is a good question. When plugging in something in Linux, the kernel loads the module applicable and it is (normally) doing so by the logical numbering of the ports.
I have seen examples of Ethernet ports getting a new number after an update though.

When the kernel is loading the attributes of the device, one of the fields will be a kind of a ‘description’ of what the device is/does, this is the field you are seeing in HA.

You’ll have to rewrite that if you want HA to be able to show something else.

Check out something like this: https://unix.stackexchange.com/questions/66901/how-to-bind-usb-device-under-a-static-name#66916

Hah, am I wrong and is this a simple case of an entity in HA? If so I stand corrected…

I already tried to find these USB Audio Devices in Entities and Devices under “Settings > Devices & services”.

I haven’t found any entries for these USB Devices.

Do you have any Linux experience? Feel comfortable to test what the link describes?

Yes i have experience with Linux. :wink:
What should i do in udev rules so that it takes effect on the selection of the audio device on the configuration screen of home assistant.

i tried it with ATTR{id} - no effect
i tried to add a SYMLINK - no effect

SUBSYSTEM=="sound", ATTRS{idVendor}=="0d8c", ATTRS{idProduct}=="000c", SYMLINK+="snd/mydev_%k", ATTR{id}="mydev_%k"

ATTRS{id} and SYMLINK has been set sucessfully. No error in rules.

➜  ~ udevadm info -a -p $(udevadm info -q path -n /dev/snd/MYSND_controlC0)

  looking at device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3:1.0/sound/card0/controlC0':
    KERNEL=="controlC0"
    SUBSYSTEM=="sound"
    DRIVER==""

  looking at parent device '/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3:1.0/sound/card0':
    KERNELS=="card0"
    SUBSYSTEMS=="sound"
    DRIVERS==""
    ATTRS{id}=="MYSND_card0"
    ATTRS{number}=="0"

➜  ~ ls -l /dev/snd
total 8
lrwxrwxrwx    1 root     root             9 Oct 30 15:11 MYSND_controlC0 -> controlC0
lrwxrwxrwx    1 root     root             9 Oct 30 15:11 MYSND_controlC1 -> controlC1
lrwxrwxrwx    1 root     root             8 Oct 30 15:11 MYSND_pcmC0D0c -> pcmC0D0c
lrwxrwxrwx    1 root     root             8 Oct 30 15:11 MYSND_pcmC0D0p -> pcmC0D0p
lrwxrwxrwx    1 root     root             8 Oct 30 15:11 MYSND_pcmC1D0c -> pcmC1D0c
lrwxrwxrwx    1 root     root             8 Oct 30 15:11 MYSND_pcmC1D0p -> pcmC1D0p
drwxr-xr-x    2 root     root            60 Oct 30 15:11 by-id
drwxr-xr-x    2 root     root           140 Oct 30 15:11 by-path
-rw-r--r--    1 root     root          6369 Oct 30 15:03 cdlsusb
crw-rw----    1 root     29        116,   7 Oct 30 15:11 controlC0
crw-rw----    1 root     29        116,   4 Oct 30 15:11 controlC1
crw-rw----    1 root     29        116,  10 Oct 30 15:11 controlC2
crw-rw----    1 root     29        116,  12 Oct 30 15:11 controlC3
crw-rw----    1 root     29        116,   6 Oct 30 15:11 pcmC0D0c
crw-rw----    1 root     29        116,   5 Oct 30 15:11 pcmC0D0p
crw-rw----    1 root     29        116,   3 Oct 30 15:11 pcmC1D0c
crw-rw----    1 root     29        116,   2 Oct 30 15:11 pcmC1D0p
crw-rw----    1 root     29        116,   8 Oct 30 15:11 pcmC2D0p
crw-rw----    1 root     29        116,   9 Oct 30 15:11 pcmC2D1p
crw-rw----    1 root     29        116,  11 Oct 30 15:11 pcmC3D0p
crw-rw----    1 root     29        116,   1 Jun 25 19:17 seq
crw-rw----    1 root     29        116,  33 Oct 30 15:11 timer

Well the idea is that you should be able to create a symlink OR to rename the existing ‘alias’ (not what it is actually called, my attempt to make it sound logical) of the device.
When I check the name of my ZWave stick, it is listed under ‘ID_SERIAL’, however I am not sure that will be enough.


Hello, finally i was lucky! :wink:

The following udev rule does the trick, using ENV{SOUND_DESCRIPTION}:

SUBSYSTEM=="sound", ATTRS{idVendor}="0d8c", ATTRS{idProduct}=="000c", ENV{SOUND_DESCRIPTION}="My USB Sound [%b]"

With showing the USB Port number using %b.

useful links:
https://www.man7.org/linux/man-pages/man7/udev.7.html
https://askubuntu.com/questions/1313183/how-do-i-rename-audio-devices-in-ubuntu

Thx for you help! :slight_smile:

That is great to hear! Glad for the (little) help I could provide.

Consider adding it to the cookbook section: The Home Assistant Cookbook - Index