Skip to content

Add ability to add custom PulseAudio startup commands#197

Open
ntninja wants to merge 2 commits intohome-assistant:masterfrom
ntninja:patch-1
Open

Add ability to add custom PulseAudio startup commands#197
ntninja wants to merge 2 commits intohome-assistant:masterfrom
ntninja:patch-1

Conversation

@ntninja
Copy link
Copy Markdown

@ntninja ntninja commented Nov 18, 2025

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.

Copy link
Copy Markdown

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ntninja

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant home-assistant bot marked this pull request as draft November 18, 2025 03:42
@home-assistant
Copy link
Copy Markdown

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

Learn more about our pull request process.

@ntninja ntninja marked this pull request as ready for review November 18, 2025 03:46
@agners
Copy link
Copy Markdown
Member

agners commented Nov 19, 2025

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.

@ntninja
Copy link
Copy Markdown
Author

ntninja commented Nov 19, 2025

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
Copy link
Copy Markdown
Author

ntninja commented Nov 19, 2025

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

@ntninja
Copy link
Copy Markdown
Author

ntninja commented Nov 19, 2025

(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… 🤷‍♀️)

Copy link
Copy Markdown
Member

@agners agners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤔 .

Comment thread rootfs/etc/pulse/system.pa Outdated
#
# Using nofail has two effects here:
# 1) Causes PulseAudio to log a message at startup if the user configuration
# is not present to increase visible of the corresponding configuration
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By that you mean so users learn about the possibility?

Seems weird to me to do that through an error 😅 . I'd rather go with ifexists here, and document the capabilities somewhere.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, its just a warning. When I started digging into: How do I get this to work? One of the first things I did was look through the commands exposed by ha audio, including the ha audio logs sub-command. I’ve intentionally included an example of the message logged there, so that it’d eventually end up in online searches.

Obviously we want to document this, but the idea would be that the documentation includes that messages as an “this means no config was loaded” example that would then also show up in searches.

In that way, I think its quite useful, also to give you feedback on whether your custom configuration has been picked up or not.

@ntninja
Copy link
Copy Markdown
Author

ntninja commented Nov 21, 2025

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
Copy link
Copy Markdown
Author

ntninja commented Jan 23, 2026

What’s the status on this? Hand-patching the PulseAudio container after HAOS updates is kinda annoying honestly…

@agners
Copy link
Copy Markdown
Member

agners commented Feb 10, 2026

One concern is that it is a rather implementation specific way of configuring things. This especially comes problematic if we want to move away from PulseAudio, e.g. moving to PipeWire.

I'd definitely prefer if we'd keep this minimal, so simply support custom.pa since that is what you require currently.

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.
@ntninja
Copy link
Copy Markdown
Author

ntninja commented Feb 10, 2026

Alright, I dropped the override. I don’t think its a problem to have it, but its fine not to have it too. Hope this version is acceptable, until PipeWire happens at least!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants