I wanted to have direct 3.5mm pulse audio from Home Assistant container via the host with 3,5mm jack.
I added the following code in the docker-compose:
homeassistant:
build: /home/docker-compose/homeassistant-custom
restart: always
volumes:
- /dev:/dev
- /tmp/.X11-unix:/tmp/.X11-unix
- ~/.config/pulse/cookie:/root/.config/pulse/cookie
- /run/user/1000/pulse:/run/user/1000/pulse
- /var/run:/var/run
- /run/dbus/:/run/dbus/:rw
- /dev/shm:/dev/shm
environment:
- PULSE_SERVER=/run/user/1000/pulse/native
- PULSE_COOKIE=/root/.config/pulse/cookie
devices:
- /dev/snd:/dev/snd
This code is added on top of your normal docker-compose lines. Furthermore i created the home-assistant-custom dir and add the following in dockerfile
FROM homeassistant/home-assistant:latest
RUN apt-get update && \
apt-get install -y vlc-nox apt-utils alsa-utils nano pulseaudio && \
usermod -a -G audio root && \
usermod -a -G pulse-access root
Now you can get TTS pulse audio from HA, just add a media_player:
media_player:
- platform: vlc
name: speaker_1
arguments: '--alsa-audio-device=hw:0,0'
And use it in a script or automation.
Thanks for sharing that! Its exactly what I’m trying to do. I installed hassio on a generic Ubuntu-machine and everything works great using Frenck’s script. Where do I find the docker-compose file and where did you create the hoem-assistant-custom-dir?
Thanks for helping me out!
Niklas
Please read docs to use custom docker containers with a dockerfile and Docker Compose. Then you can use my Docker Compose file. In the meantime i migrated to Google tts and not using this any more.
Dockers Te veel informatie om een keuze te kunnen maken?
how to install docker compose 2019
https://waterfallmagazine.com
An impressive share! I have just forwarded this onto a colleague who had
been doing a little research on this. And he actually bought me lunch simply because
I stumbled upon it for him… lol. So let me reword this….
Thank YOU for the meal!! But yeah, thanx for spending some time to discuss this topic here
on your web page.