How to get Sound and Microphone to work with newest version of hass.io docker

Today I finally got around and installed rhasspy. I have a RaspberryPi 3 B+ with a Respeaker 4 Mic Array and an USB sound card for audio output. Installed previously was hass.io running in a docker so rhasspy was installed in a docker, too. For some reason I am one of those people that never get something to work and out of the box so I have been fighting to get my sound and mic to work for an hour.

The audio and mic worked fine on my host system (or so I thought) and I tested that a few days ago when I installed the drivers for my respeaker 4 array. So when I opened up the rhasspy web interface, pressed the test button for the mic and got (no audio) on all devices I was a bit annoyed. When I could not get any sound output I started reading through this forum. Regardless what I selected before I saved, audio device was always default and not working.

After a while I found this which helped to get my device selected but it was still not working…

 "sounds": {
    "aplay": {
        "device": "sysdefault:CARD=Device"
    }
}

At this point I tried to use aplay on my host and found out that my device is busy. I had tested everything a while ago and it worked so I removed rhasspy for further tests but the problem persisted.
So rhasspy was not at fault, it had to be something else. I restarted my Pi and it worked for a while. Further testing let me to believe that it was hass.io audio that was hogging my device and it only worked until all the dockers where running. After a bit of research I found a way to stop it from hogging my devices. This was adapted for my pi and after I removed the hass.io audio docker and let the supervisor reinstall it I could use my audio again.

docker pull homeassistant/amd64-hassio-audio:8
docker image rm -f homeassistant/armv7-hassio-audio:9
docker image tag homeassistant/armv7-hassio-audio:8 homeassistant/armv7-hassio-audio:9
docker stop hassio_audio

Now I reinstalled rhasspy, selected my audio devices and the mic worked without any problem. For the speaker I had to manually add the sounds section again but after that is was working fine.

Since it took me a while and other people running hass.io in a docker I thought I would document the progress so no one else that is just stating out with rhasspy will have to do an hour of research just for the small satisfaction of hearing rhasspy speak a sentence.

Daenara

EDIT: cleaned up some stuff and added the code I got from the external links for easy reading

It’s funny to read your post here. I’ve just been having the exact same problem. Is your solution still working after a reboot?

Actually we just need to get rid of the hassio audio docker container as far as I’ve pointed the problem out.

The problem is that the supervisor will always restart/redownload the audio container. So the workaround is to make it think the old version is the current one. The supervisor log inside hass actually recoglizes that it is the older version but it doesn’t care about it.

I just did a restart and it is still the old version. Supervisor just takes the current docker image which is an older image renamed as the new one and problem solved (until the next hass update at least)

1 Like

Ok. Thanks for the explanation. So each time hass.io brings an update we need to fix this again. Annoying!

Well, hopefully the audio container will not hog the audio devices in a future update. For now it is a workaround.

Is someone running home assistant verison 2021.04.0 and rhasspy on the same system successfully? Each time I reboot the pi home assistant pulls the correct image again…

Has anyone figured out a workaround?

EDIT:
Looks like this Home Assistant Addon fixes the issue for me. Even after a restart of the pi it takes some seconds for all to startup but then it works.

I run 2021.6.4 and Rhasspy as Addon without any issues.
I have audio recording disabled however