Hi all, relative newbie here. tl;dr - I need some pointers on how to understand what pulseaudio is doing within hassio-audio as it isn’t finding RPi devices, but I can see the alsa devices from within the hassio-audio container.
Let me start with my overall setup: I have HA running on a Raspberry PI 4, using Hassio (so I can get community add-ons). There’s a front end that is running on a small touch screen, using a chromium browser in kiosk mode.
What I’m trying to do: get a chime sound to play to the headphone jack of the RPi. My understanding is that either (a) I can try to get this to play through browser_mod, or (b) set up something that passes through hassio-audio. In essence, since HA is running inside docker there needs to be communication back to the RPi devices.
Where I’ve been:
- Originally I used browser_mod to register the chromium browser, and had it working for a bit. This seems to have stopped working after a reboot; I spent some time reconnecting the browser and making sure the no-gesture-required policy was set, long story short I feel like this is just too brittle, so I’m looking for an alternative.
- I played around with a number of the alternatives that I found in the forums, etc: setting up VLC, local VLC, and one other option that I’m forgetting. None of them could see anything but a “default” device.
- I am able to play the audio file from outside any containers using aplay (alsa). The RPi has three devices: two HDMI device and the headphone jack - it’s the latter that I want to use.
- I jumped into the hassio-audio docker and found something interesting: when I look at
pactl
the sinks listed, it only finds a dummy sink:
Sink #0
State: IDLE
Name: auto_null
Description: Dummy Output
Driver: module-null-sink.c
Sample Specification: s16le 2ch 44100Hz
Channel Map: front-left,front-right
Owner Module: 14
Mute: no
Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
Base Volume: 65536 / 100% / 0.00 dB
Monitor Source: auto_null.monitor
Latency: 1727653 usec, configured 2000000 usec
Flags: DECIBEL_VOLUME LATENCY SET_FORMATS
Properties:
device.description = "Dummy Output"
device.class = "abstract"
device.icon_name = "audio-card"
Formats:
pcm
But when I run aplay -L
from within the container I can see the RPi devices:
hassio-audio:/# aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
sysdefault
Default Audio Device
pulse
PulseAudio Sound Server
default
Default ALSA Output (currently PulseAudio Sound Server)
sysdefault:CARD=vc4hdmi0
vc4-hdmi-0, MAI PCM i2s-hifi-0
Default Audio Device
hdmi:CARD=vc4hdmi0,DEV=0
vc4-hdmi-0, MAI PCM i2s-hifi-0
HDMI Audio Output
sysdefault:CARD=vc4hdmi1
vc4-hdmi-1, MAI PCM i2s-hifi-0
Default Audio Device
hdmi:CARD=vc4hdmi1,DEV=0
vc4-hdmi-1, MAI PCM i2s-hifi-0
HDMI Audio Output
sysdefault:CARD=Headphones
bcm2835 Headphones, bcm2835 Headphones
Default Audio Device
Indeed, I can play the wave file from inside the container:
aplay --device=sysdefault:CARD=Headphones /media/chime.wav
but this just returns silence for the duration of the file (i.e. not the right device):
paplay /media/chime.wav
So, all this said, it looks to me like the auto-discovery isn’t working within the container. (I also am not quite sure why pulse audio isn’t running as a daemon, which prohibits use of pactl
.)
Any idea on how to work with pulse audio within hassio-audio to find the devices within the container?