plugin-audio icon indicating copy to clipboard operation
plugin-audio copied to clipboard

Add ability to add custom PulseAudio startup commands

Open ntninja opened this issue 1 month ago • 6 comments

Loads two extra “user-configurable” configuration files:

/mnt/data/supervisor/audio/override.pa … replaces the default configuration, if present.

/mnt/data/supervisor/audio/custom.pa … is appended to the default configuration, if present.

Tested and working… but kinda requires at least Advanced Terminal & SSH (if not host access) to be useful given how complicated it is to access these files.

Minimally addresses #178.

ntninja avatar Nov 18 '25 03:11 ntninja

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:

Learn more about our pull request process.

home-assistant[bot] avatar Nov 18 '25 03:11 home-assistant[bot]

Thank you for your PR. How would the user create those configuration files?

Do you have a specific use case? Maybe we could support that with an updated default configuration file.

agners avatar Nov 19 '25 09:11 agners

I had just assumed they are available through advanced terminal, but turns out I’m wrong. Is there any reason why /audio isn’t available through advanced terminal? I had assumed it is given the /mnt/data/supervisor/pulse_audio.json configuration file there.

My use-case is to logically split the streams of a single audio device, since the actual speakers wired to it are physically located in different rooms:

load-module module-remap-sink sink_name=speaker_hallway sink_properties=device.description="Hallway\ Speaker" remix=no master=alsa_output.usb-Sharkoon_Sharkoon_Gaming_DAC_Pro_S-00.analog-stereo channels=1 master_channel_map=front-right channel_map=mono
load-module module-remap-sink sink_name=speaker_main_room sink_properties=device.description="Main\ Room\ Speaker" remix=no master=alsa_output.usb-Sharkoon_Sharkoon_Gaming_DAC_Pro_S-00.analog-stereo channels=1 master_channel_map=front-left channel_map=mono

While having this available as a native option in Home Assistant would be great, it would require changes to supervisor (for API) and a corresponding integration in Core, I believe. So significant changes. Adding this to the default configuration is obviously both impossible and nonsensical.

ntninja avatar Nov 19 '25 22:11 ntninja

Also changed the approach a bit regarding the custom.pa include for reasons added as documentation inside the system configuration file.

ntninja avatar Nov 19 '25 22:11 ntninja

(Given Home Assistants limitations regarding local audio, the whole setup is quite weird anyways: Create 2 mapped subsinks in PulseAudio, Run 2 instances of SqueezeLite add-on with each targeting on of the subsinks, then have Music Assistant connect to both SqueezeLite instances to actually manage their audio… Yeah, layers…! – Really hope Music Assistant gets local audio capabilities at some point, but who know if and when… :woman_shrugging:)

ntninja avatar Nov 19 '25 22:11 ntninja

I am still a bit uncertain if we really want to add this capability. It opens a lot of flexibility, but it also feels a very not user friendly way 🤔 .

We could copy the customization file from another location on audio plug-in startup, e.g. /share.

In your current use case you don't use the override.pa, correct? Maybe we could just start with the customization file 🤔 .

Yeah, I don’t need the override.pa, but both of these are provided for advanced users needing some custom audio configuration that isn’t natively supported by Home Assistant (particularly since the HA audio support currently is rather bare-bones).

Is there some save location that is accessible through Advanced Terminal but not regular Terminal / SAMBA perhaps? That’d feel like the right place to me. (And if there isn’t: What’d be wrong with just exposing /audio into the Advanced Terminal environment?)

ntninja avatar Nov 21 '25 00:11 ntninja