Play audio from HA on docker bridge

Hello
I’m running HA behind a reverse-proxy (Traefik). HA is attached to a docker bridge network (not host). It’s working fine. I managed to get it to discover my Sonos speaker. However, I am unable to stream audio files from HA.

I can control the speaker from HA.

How can I diagnose this? What port, protocol and type of traffic would HA be using to stream the audio to the speaker?

Where is audio file?

Does your router show network logs? Check to see they are able to communicate. ha logs may show some error.

What integration/method are you using to stream audio? Can Sonos access the file directly?

Although the doc is not consistent (it speaks of host but then provides an example without)…see below… I have tried many integrations with/out ‘host’ and mostly ‘host’ resolved the issues. One can ofcourse trace all the ports and all but the question would be ‘why-not-host’ … likely dozens of people are against but also HA recommends host. try it?

Alternative - Home Assistant

I’m using the Sonos integration. I can stream audio using upnp from an app on my phone but not from HA. The file has been manually uploaded to HA via the UI and is under Media.

I also tried Music Assistant. I added my Navidrome installation as a source using the Subsonic API and I can see the music as well as the Sonos but when I hit play nothing happens. No error messages in the log for neither HA nor MA

Not an option. I want to keep HA running in the docker network rather than the host network.

Macvlan is a great alternative.
Bridge for container to container since you can use hostnames and avoid ip changes

Upnp likely won’t work with bridge. My guess.
It will likely work with macvlan but I never tried.
VLans will further complicate this

Hi guys. I could not get the Sonos to play anything from neither HA nor MA using all sorts of settings including macvlan for MA to no avail. Kept getting an error

Failed to perform the action media_player/play_media. Error calling SonosMediaPlayerEntity._play_media on media_player.symfonisk_01: UPnP Error 701 received: Transition not available from

I gave up and returned the Sonos.

I looked at trying to pair my HA running on RPi 5 to pair with a BT speaker and use that. That was even harder than getting the Sonos to work.

Did you only use macvlan for MA?
OR
Macvlan for MA and HA?

File is on HA server and ultimately that is what it will connect to.

Sorry but it occur to me that HA will pass the “local network” address to device for reteieving file. You needed to ensure Sonos or any device can access the file.

Normally there is some log that will show you where exactly Sonos is failing. My guess is it cannot reach network address provided and the log would show that.

Ultimately you return Sonos so I only put this for anyone who may have similar problem.

I put the MA on the macvlan and connected it directly to my Navidrome instance to stream data directly from its macvlan LAN address in the 192.168.x.x range and I still got the same 701 error from the Sonos.

It’s a huge disappointment as all the searches I made seemed to indicate a problem with the Sonos not being able to play the file somehow.

Here’s the issue raised by someone on Github albeit under HA but it’s the exact same error that I’m getting from both HA and MA even when MA was connected to the macvlan.

I didn’t see it. Did you post your automation or command for playing

Ultimately it seems like you just need to give Sonos more time before attempt ti play. Not sur if this apply to you

I’m the maintainer for the Sonos integration. Post your automation.

It’s not an automation. In HA, I’m simply going to Media → My Media → Playing file to Symfonisk instead of Browser.

In MA, I’m connected to Navidrome and using the Subsonic API to play a song to Symfonisk which is added after being discovered by MA.

That error usually indicates that the speaker is unable access the URL to play the media. If you are using the Sonos Integration, turn on debug logging and the integration will log the URL that is being sent to the speaker to play. From that we can determine what the problem is. It’s likely a network configuration issue.

Hi all,
Many thanks for all your help.

I really liked my IKEA Symfonisk speaker and wanted to give it another go so I bought them again and actually managed to get it to work albeit with Music Assistant.

Would it be OK to post the solution here despite it being for Music Assistant and not strictly Home Assistant? I am using the Music Assistant integration to music playback on the Symfonisk.

Yes. Please post your solution

I went back to basis and removed Traefik and the IoT network out of the equation to see if it would work with Music Assistant.

It worked brilliantly.

Then it was a case of trial and error to see what does and doesn’t work behind Traefik. The solution was to add a new entrypoint to Traefik and have a router associating the Music Assistant container labels.

I also set up an mdns repeater container to forward mdns traffic to the MA docker bridge.

mDNS Bridge:

# Service used to bridge mdns between LAN and docker bridge
  mdns:
    image: yuxzhu/mdns-reflector:latest
    restart: unless-stopped
    hostname: mdns
    network_mode: host
    command: mdns-reflector -fnl info -- eth0 br-e5250e7ab921

Music Assistant Streaming docker labels:

      ## HTTP Stream Routers/Service - Streaming Services
      - "traefik.http.routers.mass-stream-rtr.entrypoints=stream-ep"
      - "traefik.http.routers.mass-stream-rtr.tls=false"
      - "traefik.http.routers.mass-stream-rtr.rule=PathPrefix(`/`)"
      - "traefik.http.routers.mass-stream-rtr.service=mass-stream-svc"
      - "traefik.http.services.mass-stream-svc.loadbalancer.server.port=8098"

In Music Assistant, I configured the Streaming server to use 8098 (default) and to advertise the host IP i.e 192.168.1.10 (not the container IP)

I also moved the Symfonisk to my IoT subnet and used avahic-daemon in my router to forward mDNS traffic between them and then allowed the Symfonisk IP to access the Music Assistant host IP on the following ports:

319 320 1400 1901 2869 6969 8098 10280-10284 30000-65535

I hope this helps someone.

1 Like