Unable to see Plex Media Player on remote network

So - this is possibly a bit confusing, but here’s what I’ve got:

Location A: Mac Mini running Plex server. SonicWALL in place with VPN activated.

Location B: (Currently OS X / Later will be a Pi) Running Home Assistant. Connected to VPN so I can ping Plex Server.

I have been able to get the Plex sensor to be recognized and notice when things are playing and not. However, I am unable to get the Plex media player to show up.

For the sensor, I have the code below:

sensor:
  - platform: plex
    host: 10.0.1.200
    port: 32400
    username: REDACTED
    password: REDACTED

For the Media Player, I have

media_player:
  - platform: plex

I have created /Users/username/.homeassistant/plex.conf which contains the following:

{"10.0.1.200:32400": {"token": "REDACTED"}}

However, it does not seem to show up still. I got the token by opening my web browser, going to plex server, viewing the xml data of a file, etc.

It DID show up as a media player when I opened chrome and had the plex site opened - however - I am attempting to use the Plex app on my AppleTV.

Any thoughts on where to start with this (if ports need to be forwarded or something, or logs to look at specifically, etc.). I would appreciate it!

Do you have a plex.conf file in your HA root? Does it contain a token that matches the one in your Plex server?

Console Output: https://paste.ee/r/H5gGT

As I stated above, I have created /Users/username/.homeassistant/plex.conf which contains the following:

{"10.0.1.200:32400": {"token": "REDACTED"}}

I assume it is the proper token.

If it wasn’t, the error would have shown in your output and I didn’t see it there. In fact, it looked like it was setting up without any errors.

Have you tried manually specifying it in your configuration.yaml - like this:

#
# Media Players
#
media_player:
  platform: plex

Yup - I do have that in there. It wasn’t discovering it on it’s own (not sure if it’s due to it being on the VPN network and not the local network?)

I think this is an issue with the Plex player on AppleTV, it doesn’t register in the server as a client.
You can check if you see your Plex player at this url (just open in your browser):
http://10.0.1.200:32400/clients?X-Plex-Token=REDACTED

If while playing something on your AppleTV you receive the following XML:
<MediaContainer size="0"></MediaContainer>
The problem is not on HASS.

This is how it should look like:

<Server name="Samsung TV" host="192.168.0.112" address="192.168.0.126" port="32400" machineIdentifier="xxxxxxxxxxxxxx" version="2.12.5" protocol="plex" product="Samsung TV" deviceClass="tv" protocolVersion="1" protocolCapabilities="timeline,playback,navigation,mirror,playqueues"/>

OK - What I see (regardless of what token I put in there) is
<MediaContainer size="0"></MediaContainer>

With that in mind - is there a fix for that to correct it?

I think that this is due to AppleTV and not something you can fix in HA. I run Plex from my FireTV and it does show up in the media player when Plex is active.

Maybe this is something to bring up over at the Plex forums. There may be a work around or config hack for it.

I have the same problem with the plex iOS app on iPhone / iPad - this is definitely a problem with plex - the iOS app does not register with the server and is not visible in the web app and in the xml, so that’s why HASS cannot see it.

I’ve raised the issue here but still haven’t gotten a response.

When the server and the iOS are on the same network the server detects it via plex’s internal discovery protocol and it does show up.

You need to ask AppleTV for a fix. They must have a bug in the client.

I can’t get this working either. I tried 3 different players and always get back

<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="0">
</MediaContainer>

It seems to me this is more of a problem with the lack of documentation?

After banging on this for awhile it seems there are some strange features to the plex api.

I finally got a client to appear but only if it was on the same subnet as the plex server.

I’m not interested in doing a bunch of network trickery so I guess this component isn’t going to work.