Can't play media from Plex on Sonos

I have some Sonos speakers and just set up a Plex instance on my QNAP NAS to stream music from Plex to my Sonos speakers via Home Assistant. Home Assistant finds the media on my Plex, but when I select a track and press “play” an error occurs:

Failed to call service media_play/play_media. Error calling SonosMediaPlayerEntity.play_media on media_player.buro: UPnP Error 800 received: from 192.168.188.50

I can play local media (Home Assistant internal) or Radio, but not from Plex although Home Assistant displays all media on Plex correctly.

I have linked my Plex account to my Sonos account, but I disabled remote access. I don’t want to stream my music between two local devices via AWS. Therefore the Sonos app can’t find any music on Plex. Not sure whether that has implications on Home Assistant, but since Home Assistant can find all the music, which the Sonos app can’t I guess that shouldn’t be the issue.

I’m having the same problem, unfortunately, for a few weeks now. Album information and title and artists can be retrieved but media cannot be played. Remote access is enabled here, but unfortunately the same problem.

The problem is not with Home Assistant, but with Sonos. If you open the sonos app and want to start the music from Plex, it is also not possible. Anyone have an idea?

For now, I’ve added plex integration directly to Home Assistant, and playback via Plex works fine.

I have a similar issue with two plex servers

One is internet hosted and works fine playing on two different sonos devices
The other is a local docker that I’ve configured to use the LAN IP of homeassistant using the plex.direct service. This results in the 800 error.

one difference is that the internet plex server is on an older version, but this is frustrating because the local docker plex is a new setup I’m trying to allow playing music an offline connection. So I’m not sure yet if it’s a plex version issue or a docker network issue.

Posting because I’m curious about this issue too.

Remote access for Plex is required to play on Sonos as documented here. This is simply how the “native” Plex<>Sonos integration works (separate from HA).

hmm, so even with a locally hosted music server it requires internet…That is really stupid. I regret buying Sonos!!!

My plex server is technically internet reachable because my homeassistant hostname is available and the docker plex advertises that hostname. Plex is behind a custom location in nginx proxy manager, so I can access the server from anywhere, I just don’t want to forward port 32400.

Maybe that’s the issue, the HomeAssistant PMS integration will NOT work if the server is on port 443, even if it’s the only server at that ip address. So I have to connect HA to plex on the internall 32400, but Sonos can only access on port 443…very frustrating …

For the record I can play all of my plex media directly using the “media browser” and send it to sonos without issue, but then I don’t have all of my plex playlists…

The remote access requirement is a Plex limitation, not Sonos.

Can you clarify what you mean here? First you say it fails with 800 errors, but now it works via the media browser? Plex playlists are exposed in the Plex media browser handler. I guess I’m not understanding your issue(s).

  • Plex is running as a homeassistant addon
  • I have all of my plex music in the /media folder within the “plex” subfolder
  • The Plex library is configured to use this /media/plex/Music folder
  • I can browse the local media .mp3 and .flac files in the media browser (NOT choosing plex)
  • If I play any of the files that both homeassistant and plex have access to on a sonos device, it will stream the file as long as it’s supported (no plex transcoding since it’s not playing via plex)

It’s just really stupid that either Plex or sonos (lets be honest it’s probably Plex), seems to require a cloud connection to send the media Up into the internet to Sonos’s servers, then back down to my Sonos Speaker so that it can access a URL on a server that’s 25 feet away.

I totally agree that this is completely stupid. A have built up a KNX Smart Home System to be completely local without any shitty cloud dependencies. Home Assistant is used for visualization because it supports KNX secure tunneling and I can use my Python skill for some advanced logic stuff. Plex I only installed because it seemed that that would be the best way to connect Home Assistant and Sonos.
If there’s a better option that doesn’t have the cloud dependencies I would get rid of Plex or also Home Assistant ASAP and switch over. If required I’d even replace my Sonos speakers.

The Plex integration offered in the native Sonos app (and leveraged by HA) requires a Plex cloud host for some portion of playback.

An alternative for a self-hosed and fully local Sonos music service is GitHub - simojenki/bonob: sonos SMAPI implementation allowing integrating different music sources with sonos., but there is not yet support for browsing this media source in HA.

1 Like

Thanks a lot.

[…] but there is not yet support for browsing this media source in HA.

Does that mean that this is planned?

I can confirm that Emby works as I need to some extent, at least after installing the emby sonos plugin.
It’s just detected as a DLNA server, so I am suspecting that Plex may be able to play to Sonos once I set it back up and enable the DLNA service.

I’m not too happy with how the DNLA server is working with emby, I have 1.2TB of music and the DLNA connection crashes just loading the Artist list. Hopefully the Plex DLNA service works better.

I suspect that directly playing a file via media_player.play_media will work, regardless of the DLNA browsing issue

If you host plex on another computer, or set it as a container using “host” networking (note this makes home assistant alert hassio is on an unsupported configuration) You can get it to be detected as a DLNA configuration.

Then enable DLNA on plex and set this as the client specific settings

IP=<YOUR HOMEASSISTNAT IP HERE>,DirectPlay=false,DirectStream=false,LocalResolution=1920x1080,RemoteResolution=1280x720,OnlineResolution=1280x720,LocalVideoQuality=74,RemoteVideoQuality=49,OnlineVideoQuality=49,SubtitleSize=100,AudioBoost=100,MusicBitrate=320

This will make sure that all files get transcoded to a format different devices can play, you can play around with the other settings but DirectPlay, DirectStream, and MusicBitrate are needed for Sonos.

Now you can play from Plex to Sonos locally without the cloud. Unfortunately there are no playlists or radio stations…such a shame. I may still look into other options like minidlna server since browsing Emby was not stable

I found the solution.

the Plex page for support for Sonos says the following:

NAT Loopback

Your network router must support “NAT Loopback” (sometimes called “NAT Reflection”, “Hairpin NAT”, “NAT Hairpinning”, or just “Hairpinning”). In very simplified terms, that simply means that if a device on your network (such as a Sonos) makes a network call to your public WAN address, the router knows how to handle that without the network request needing to actually go “out over the internet” and it’s instead handled within your local network.

This was not enabled on my PFsense router. Here it is called “NAT Reflection mode for port forwards” and is under System, Advanced, Firewall & NAT

After this adjustment it worked immediately