/ August 25, 2018/ Articles, Docker, Home Assistant/ 4 comments

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:

    build: /home/docker-compose/homeassistant-custom
    restart: always
      - /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
      - PULSE_SERVER=/run/user/1000/pulse/native
      - PULSE_COOKIE=/root/.config/pulse/cookie
      - /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:

- platform: vlc
  name: speaker_1
  arguments: '--alsa-audio-device=hw:0,0'

And use it in a script or automation.

Share this Post


  1. 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!

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

  2. Dockers Te veel informatie om een keuze te kunnen maken?

  3. how to install docker compose 2019

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>