Is there anyone running a HifiBerry DAC on a Raspberry Pi HA setup?

I’m trying to use my HifiBerry DAC+ on a raspberry pi 3b Home Assistant setup (OS 8.5) and I can’t get the DAC to show up as an output no matter what I do. About a year ago I was running this exact same setup but with an older OS version (I think it was 6) and everything worked fine. I then loaded a Volumio image onto a spare sd card to see if maybe the DAC was dead, but it shows up just fine and everything works, which makes me think something must have changed in the Home Assistant OS in the subsequent updates to cause this issue. Is there anyone out there that has a working (and up-to-date) HifiBerry DAC setup that could share what they did to get it running? I would really appreciate some help!

I’m also at your situation. I have a Raspberry Pi 3 running Home Assistant OS (details below). I also have hifiberry-digi-pro and I want to attach it to the same Raspberry Pi and play audio. Is there any way to do that?

Home Assistant 2022.9.0
Supervisor 2022.08.6
Operating System 8.5
Frontend 20220907.0 - latest

Hi, i was also just looking for a solution for this, with the difference of having a pcm5102 module instead of a HAT.

I’m as far as having installed the HA-RPI GPIO integration, which was removed from the HA Core in version 2022.6.

Have you come any further?

OK, got it running:

I put the SD-Card into my laptop, mounted the hassos-boot partition (the first partition, it wasn’t automatically mounted in my case) and followed the boot/config.txt part of this guide:

Open config.txt
Uncomment (remove the # before) dtparam=i2s=on
Comment #dtparam=audio=on
Append this at the end of the file: dtoverlay=hifiberry-dac

Incidentally the pcm5102 is even the same DAC as in the hifiberry-dac.

And it works :slight_smile: The device is shown as internal audio device in HA, but that’s ok for me.

Great news! I randomly decided to attach my hifiberry to my raspberry pi running Home Assistant again after tinkering with the rest of my audio setup and it now works perfectly!? I had some standoffs supporting the hifiberry above the pi originally, but I had misplaced them somewhere and decided to just plug it in without them. Lo-and-behold, the hifiberry appeared as an “internal audio device” same as you @orangescentedmelon and spotify connect sends sound to it just fine!

I’m not really sure what happened, but if anyone runs into the same issue, try placing the hifiberry board so the header goes all the way in.

Edit: I also didn’t do anything configuration-wise besides the default steps recommended by hifiberry here:

Which HA install are you using? The supervisor version does not allow me access to the boot file so i was not able to add the dtoverlay = hifiberry-digi line in config.txt.
Probably you have HA installed in the raspbian os?

I guess in that case you can manually configurate the alsa sound sink to hifiberry.

I’m running the Home Assistant OS installed on an SSD attached to a raspberry pi 3b. I haven’t tried using a supervised install, but you should be able to access the config.txt file on any type of install though right? Have you looked here? Look under configuring access to files

yes i did try that but you end up at the /config directory which is also accessible via the Studio Code addon.
The ALSA settings are in /boot and that cannot be reached by me.

Anyone has it working? After hours trying with containers and other sollutions online I’m completely stuck.

I’m running HA OS on a RPI4 and have a HifiBerry DAC DSP connected to it.

I have toslink from my tv into the dac and output to my speakers which is working fine (however not able to control volume of the dac). Also I’d like to select the DAC as an output device on my RPI to play spotify true HA.

I’m conmpletely stuck atm and don’t know where to start. Maybe using HA Supervised instead of OS?

Have you followed the guide on the hifiberry website?

I have similar issues and have tried everything in the Hifiberry guide to get this running on my Pi 3B+ with HAOS and no luck.

This is from the HA container:

~ aplay -l
aplay: device_list:277: no soundcards found...

~ ha hw audio
  input: {}
    alsa_output.platform-soc_sound.stereo-fallback: Built-in Audio Stereo

This is from the host:

# cat /proc/asound/cards
 0 [sndrpihifiberry]: RPi-simple - snd_rpi_hifiberry_amp

# cat /proc/asound/card0/pcm0p/info
card: 0
device: 0
subdevice: 0
stream: PLAYBACK
id: HifiBerry AMP HiFi tas5713-hifi-0
name: HifiBerry AMP HiFi tas5713-hifi-0
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 0

If I drop into the audio container I get this:

# docker exec -it hassio_audio /bin/bash
hassio-audio:/# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_amp], device 0: HifiBerry AMP HiFi tas5713-hifi-0 [HifiBerry AMP HiFi tas5713-hifi-0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

If I run speaker-test from within the audio container I get no sound.

What else can I check?

Hey @kernelpanic1 - I think I had the same problem today. I am not an expert, so I am not sure about all dependencies and details. But maybe this helps:

My setup is a bit different, as I did not disable my other sound cards:

hassio-audio:/proc/asound# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
  Subdevices: 3/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 0: b1 [bcm2835 HDMI 1], device 1: bcm2835 HDMI 1 [bcm2835 HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 3/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 2: sndrpihifiberry [snd_rpi_hifiberry_digi], device 0: HiFiBerry Digi+ Pro HiFi wm8804-spdif-0 [HiFiBerry Digi+ Pro HiFi wm8804-spdif-0]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

When exec’ing into the hassio_audio container, I tried to do the following

hassio-audio:/# aplay --device="plughw:2,0" <some mp3>
aplay: main:831: audio open error: Resource busy

Similar for speaker-test

hassio-audio:/# speaker-test -c 2 --device="plughw:2,0"

speaker-test 1.2.8

Playback device is plughw:2,0
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Playback open error: -16,Resource busy

I think this has something to do with the interaction between pulseaudio and alsa. I think to circumvent pulseaudio, something like this can be used (but I am not sure)

pasuspender -- speaker-test -c 2 --device="plughw:2,0"

In the end, I stumbled over this post, installed the add_on and restarted HA.

I now get sound output through my hifiberry using the Spotify Add-on, when I select
Built-in Audio Digital Stereo (IEC958) as audio output.

Hope this helps a bit!