Select default audio device

How do you set the default audio device in HA?
I have these devices.

**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC236 Analog [ALC236 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The default seems to be card 0, subdevice 0, but I need it to be card 0, subdevice 1.

1 Like

okay after hours and finding dozens of un-answered responses I’ve figured this out for my scenario.
I’m leaving this reply here in hopes it helps. I’m using a Jabra 410 USB speaker connected directly to H.A. running on rpi. I was able to get audio output from the rhasspy dashboard (wordy intro for google to scrape)

1 - install the Terminal & ssh add-on then ssh in
2 - run ha audio info, you will get a list of devices (like OP has above)
3 - ha audio default output--name <device name from cmd above>
4 - ha audio default input --name <device name from cmd above>

in my case it was this

ha audio default output --name alsa_output.usb-0b0e_Jabra_SPEAK_410_USB_745C4B17807Cx010900-00.analog-stereo
ha audio default input --name alsa_input.usb-0b0e_Jabra_SPEAK_410_USB_745C4B17807Cx010900-00.mono-fallback
[core-ssh ~]$ ha info
arch: aarch64
channel: stable
docker: 20.10.19
homeassistant: 2022.12.7
machine: raspberrypi4-64
operating_system: Home Assistant OS 9.4
supervisor: 2022.11.2
5 Likes

Were you able to find a way to make non-built in connections work with this as well? I’ve got a wireless SONOS speaker that isn’t able to be set as default via the UI and doesn’t show in the above results either.

If it is wifi connected you mean with wireless, then it is not related to this topic.
This is about sound output directly from a sound card in the device you run HA on and Sonos have its own sound card built-in.

Sorry to bump this, but this thread shows up as the first result when I google for this problem and I have something to add:

The problem:

Sometimes, your device will show up, but it won’t have the correct profile selected:

[core-ssh ~]$ ha audio info
audio:
  application: []
  card:
  - driver: module-alsa-card.c
    index: 0
    name: alsa_card.usb-0d8c_USB_Sound_Device-00
    profiles:
    - active: false
      description: Analog Stereo Input
      name: input:analog-stereo
    - active: false
      description: Digital Stereo (IEC958) Input
      name: input:iec958-stereo
    - active: false
      description: Analog Stereo Output
      name: output:analog-stereo
    - active: false
      description: Analog Stereo Duplex
      name: output:analog-stereo+input:analog-stereo
    - active: true <------------------------------------------- !! THIS IS THE WRONG PROFILE !!
      description: Analog Stereo Output + Digital Stereo (IEC958) Input
      name: output:analog-stereo+input:iec958-stereo
    - active: false
      description: Analog Surround 2.1 Output
      name: output:analog-surround-21
    - active: false
      description: Analog Surround 2.1 Output + Analog Stereo Input
      name: output:analog-surround-21+input:analog-stereo
    - active: false
      description: Analog Surround 2.1 Output + Digital Stereo (IEC958) Input
      name: output:analog-surround-21+input:iec958-stereo
    - active: false
      description: Analog Surround 4.0 Output
      name: output:analog-surround-40
    - active: false
      description: Analog Surround 4.0 Output + Analog Stereo Input
      name: output:analog-surround-40+input:analog-stereo
    - active: false
      description: Analog Surround 4.0 Output + Digital Stereo (IEC958) Input
      name: output:analog-surround-40+input:iec958-stereo
    - active: false
      description: Analog Surround 4.1 Output
      name: output:analog-surround-41
    - active: false
      description: Analog Surround 4.1 Output + Analog Stereo Input
      name: output:analog-surround-41+input:analog-stereo
    - active: false
      description: Analog Surround 4.1 Output + Digital Stereo (IEC958) Input
      name: output:analog-surround-41+input:iec958-stereo
    - active: false
      description: Analog Surround 5.0 Output
      name: output:analog-surround-50
    - active: false
      description: Analog Surround 5.0 Output + Analog Stereo Input
      name: output:analog-surround-50+input:analog-stereo
    - active: false
      description: Analog Surround 5.0 Output + Digital Stereo (IEC958) Input
      name: output:analog-surround-50+input:iec958-stereo
    - active: false
      description: Analog Surround 5.1 Output
      name: output:analog-surround-51
    - active: false
      description: Analog Surround 5.1 Output + Analog Stereo Input
      name: output:analog-surround-51+input:analog-stereo
    - active: false
      description: Analog Surround 5.1 Output + Digital Stereo (IEC958) Input
      name: output:analog-surround-51+input:iec958-stereo
    - active: false
      description: Analog Surround 7.1 Output
      name: output:analog-surround-71
    - active: false
      description: Analog Surround 7.1 Output + Analog Stereo Input
      name: output:analog-surround-71+input:analog-stereo
    - active: false
      description: Analog Surround 7.1 Output + Digital Stereo (IEC958) Input
      name: output:analog-surround-71+input:iec958-stereo
    - active: false
      description: Digital Stereo (IEC958) Output
      name: output:iec958-stereo
    - active: false
      description: Digital Stereo (IEC958) Output + Analog Stereo Input
      name: output:iec958-stereo+input:analog-stereo
    - active: true
      description: Digital Stereo Duplex (IEC958)
      name: output:iec958-stereo+input:iec958-stereo
    - active: false <------------------------------------------- !! I WANT THAT ONE !!
      description: "Off"
      name: "off"
  - driver: module-alsa-card.c
    index: 1
    name: alsa_card.platform-bcm2835_audio
    profiles:
    - active: true
      description: Stereo Output
      name: output:stereo-fallback
    - active: false
      description: Mono Output
      name: output:mono-fallback
    - active: false
      description: Multichannel Output
      name: output:multichannel-output
    - active: false
      description: "Off"
      name: "off"
  input:
  - applications: []
    card: 0
    default: true
    description: USB Sound Device         Digital Stereo (IEC958)
    index: 1
    mute: false
    name: alsa_input.usb-0d8c_USB_Sound_Device-00.iec958-stereo
    volume: 1
  output:
  - applications: []
    card: 0
    default: false
    description: USB Sound Device         Digital Stereo (IEC958)
    index: 0
    mute: false
    name: alsa_output.usb-0d8c_USB_Sound_Device-00.iec958-stereo
    volume: 1
  - applications: []
    card: 1
    default: true
    description: Built-in Audio Stereo
    index: 1
    mute: false
    name: alsa_output.platform-bcm2835_audio.stereo-fallback
    volume: 0.857696533203125
host: 172.30.32.4
update_available: false
version: 2022.07.0
version_latest: 2022.07.0

One would assume that

ha audio default output -- DEVICE_NAME.CORRECT_PROFILE
ha audio default input -- DEVICE_NAME.CORRECT_PROFILE

would fix this, but this will only give you an error saying that the device path was not found (or something), since we can only select a device path with an enabled profile.

Specific example for my case: I bought a USB sound card (based on a Cmedia CM6206-LX chip if anyone’s wondering) with optical in- and outputs which I want to use. HA automatically selects the analog duplex profile, though (due to a quirk of the card, any analog output still gets routed through the optical output as well, so I only had to set the input, but that’s beside the point).

How to change the profile of a sound device

Thanks to this page from the Arch wiki, I was able to change the profile using pactl. The syntax is as follows:
pactl set-card-profile <symbolic-name> <profilename>

In my case, I had to use this command:
pactl set-card-profile alsa_card.usb-0d8c_USB_Sound_Device-00 output:iec958-stereo+input:iec958-stereo

After that, you need to run ha audio reload for the changes to apply.
Checking with ha audio info again yields the following:

audio:
  application: []
  card:
  - driver: module-alsa-card.c
    index: 0
    name: alsa_card.usb-0d8c_USB_Sound_Device-00
    profiles:
    - active: false
      description: Analog Stereo Input
      name: input:analog-stereo
    - active: false
      description: Digital Stereo (IEC958) Input
      name: input:iec958-stereo
    - active: false
      description: Analog Stereo Output
      name: output:analog-stereo
    - active: false
      description: Analog Stereo Duplex
      name: output:analog-stereo+input:analog-stereo
    - active: false <------------------------------------------- !! THIS IS NOW SET TO FALSE !!
      description: Analog Stereo Output + Digital Stereo (IEC958) Input
      name: output:analog-stereo+input:iec958-stereo
    - active: false
      description: Analog Surround 2.1 Output
      name: output:analog-surround-21
    - active: false
      description: Analog Surround 2.1 Output + Analog Stereo Input
      name: output:analog-surround-21+input:analog-stereo
    - active: false
      description: Analog Surround 2.1 Output + Digital Stereo (IEC958) Input
      name: output:analog-surround-21+input:iec958-stereo
    - active: false
      description: Analog Surround 4.0 Output
      name: output:analog-surround-40
    - active: false
      description: Analog Surround 4.0 Output + Analog Stereo Input
      name: output:analog-surround-40+input:analog-stereo
    - active: false
      description: Analog Surround 4.0 Output + Digital Stereo (IEC958) Input
      name: output:analog-surround-40+input:iec958-stereo
    - active: false
      description: Analog Surround 4.1 Output
      name: output:analog-surround-41
    - active: false
      description: Analog Surround 4.1 Output + Analog Stereo Input
      name: output:analog-surround-41+input:analog-stereo
    - active: false
      description: Analog Surround 4.1 Output + Digital Stereo (IEC958) Input
      name: output:analog-surround-41+input:iec958-stereo
    - active: false
      description: Analog Surround 5.0 Output
      name: output:analog-surround-50
    - active: false
      description: Analog Surround 5.0 Output + Analog Stereo Input
      name: output:analog-surround-50+input:analog-stereo
    - active: false
      description: Analog Surround 5.0 Output + Digital Stereo (IEC958) Input
      name: output:analog-surround-50+input:iec958-stereo
    - active: false
      description: Analog Surround 5.1 Output
      name: output:analog-surround-51
    - active: false
      description: Analog Surround 5.1 Output + Analog Stereo Input
      name: output:analog-surround-51+input:analog-stereo
    - active: false
      description: Analog Surround 5.1 Output + Digital Stereo (IEC958) Input
      name: output:analog-surround-51+input:iec958-stereo
    - active: false
      description: Analog Surround 7.1 Output
      name: output:analog-surround-71
    - active: false
      description: Analog Surround 7.1 Output + Analog Stereo Input
      name: output:analog-surround-71+input:analog-stereo
    - active: false
      description: Analog Surround 7.1 Output + Digital Stereo (IEC958) Input
      name: output:analog-surround-71+input:iec958-stereo
    - active: false
      description: Digital Stereo (IEC958) Output
      name: output:iec958-stereo
    - active: false
      description: Digital Stereo (IEC958) Output + Analog Stereo Input
      name: output:iec958-stereo+input:analog-stereo
    - active: true <------------------------------------------- !! THIS IS NOW SET TO TRUE !!
      description: Digital Stereo Duplex (IEC958)
      name: output:iec958-stereo+input:iec958-stereo
    - active: false
      description: "Off"
      name: "off"
  - driver: module-alsa-card.c
    index: 1
    name: alsa_card.platform-bcm2835_audio
    profiles:
    - active: true
      description: Stereo Output
      name: output:stereo-fallback
    - active: false
      description: Mono Output
      name: output:mono-fallback
    - active: false
      description: Multichannel Output
      name: output:multichannel-output
    - active: false
      description: "Off"
      name: "off"
  input:
  - applications: []
    card: 0
    default: true
    description: USB Sound Device         Digital Stereo (IEC958)
    index: 1
    mute: false
    name: alsa_input.usb-0d8c_USB_Sound_Device-00.iec958-stereo
    volume: 1
  output:
  - applications: []
    card: 0
    default: false
    description: USB Sound Device         Digital Stereo (IEC958)
    index: 0
    mute: false
    name: alsa_output.usb-0d8c_USB_Sound_Device-00.iec958-stereo
    volume: 1
  - applications: []
    card: 1
    default: true
    description: Built-in Audio Stereo
    index: 1
    mute: false
    name: alsa_output.platform-bcm2835_audio.stereo-fallback
    volume: 0.857696533203125
host: 172.30.32.4
update_available: false
version: 2022.07.0
version_latest: 2022.07.0

An option to do this in the GUI would be greatly appreciated; a new user might find this a bit tricky.

5 Likes

@bluevalien Thanks for your post. I am trying to setup the same Jabra 410 USB device. When I follow your instructions, I get this error:

Any suggestions?

@TermiNader :
Look under the Profiles for your card (USB device) and set one that has both input and output active. (I just figured this out for myself, but this page was very helpful getting me there).
Here is my built-in card and its profiles.

card:
  - driver: module-alsa-card.c
    index: 0
    name: alsa_card.pci-0000_00_10.0
    profiles:
    - active: false
      description: Analog Stereo Input
      name: input:analog-stereo
    - active: false
      description: Analog Stereo Output
      name: output:analog-stereo

- active: true
description: Analog Stereo Duplex
name: output:analog-stereo+input:analog-stereo

    - active: false
      description: "Off"
      name: "off"

(Sorry for my poor markdown skills)
The bold profile was activated by:
ha audio profile --card alsa_card.pci-0000_00_10.0 --name output:analog-stereo+input:analog-stereo

and I also had to unmute the input:
ha audio volume input --index 1 --unmute

I hope this helps you figure it out. I’m a fair newb at this too, so sorry if it didn’t.

1 Like