Low-complexity (addon-less) local audio playback in automations

Hi altogether,

the current way to play local audio (e.g sound files stored in /media) to a local device (e.g. USB-connected speaker) seems to be via VLC-telnet, MPD or other add-ons. This seems to be an overkill for such a simple task, especially considering that the whole software infrastructure is already present:

  • HA Supervised (and HAOS as well I guess) starts up the hassio_audio container which correctly recognizes and grabs local sound cards using Pulse Audio
  • The main container (homeassistant) has all the necessary libraries as well as the PulseAudio client configuration present
  • There is a building block media_player integration that - by the looks of it - could be leveraged for this

The only thing that is missing in the main container are PulseAudio client binaries (pacat/paplay/pactl) in order to be able to at least set up the shell_command-type services. It seems that those binaries were present in the past, but were removed according to this comment.

The ask of this feature request is to consider implementing a “proper” local playback in automations without the need to use any add-ons. It doesn’t necessarily have to be the direct usage of client binaries. In fact, it looks like the media_player integration (specifically, implementing PulseAudio client as an entity_id) could be the proper way.

At a very minimum, however, I’d like to see PulseAudio client binaries added back to the main container (as that is where automations run and the audio playback needs to be triggered). I tried taking them from the hassio_audio container and running them in the main container, and the sound playback works exactly as expected.

On a personal note: this is my first usage of HA and my first use-case (announcements using static local audio files via a local speaker) and I was quite baffled/surprised/frustrated to discover that something as simple as this is not possible out-of-the-box.

For reference, here is a list of threads asking more or less for the same functionality:

pacat, paplay and pactl are present in my haos machine. I enter the terminal of the advanced ssh & terminal addon and they are there.

They are present in the container of that add-on, not in the main container. Try using them in some automations - you’ll get a “not found” error.

2 Likes

This would indeed be a great idea! I endorse this one!!

I’d love to have media_player with having PulseAudio as an entity

2 Likes