Somehow when it was configured that was the “best” address provided by Plex.
Let’s see what they give us now. You’ll need to sanitize this XML response a bit more. Feel free to PM it to me if you’d prefer: $ curl 'https://plex.tv/api/resources?includeHttps=1&includeRelay=1&X-Plex-Token=<YOUR_TOKEN_HERE>
Turns out the address using port 8443 was a Plex cloud relay service. There must have been an issue connecting directly to the Plex server during setup, and the relay was the only method that worked. Since it sometimes worked it stored it and reused the address for later.
Removing the integration and re-adding got things working properly again.
I recently reformatted my main Mac, which also houses my Plex install. Fresh install of the OS, then restored the Plex install from a backup. Plex all seems to work normally, but in Home Assistant the Plex integration now removes media_players that haven’t been active for a while (or since the last HA startup maybe?). It didn’t used to do this.
I have about 15 friends and family using my server which resulted in 70+ media_player entities. They were always permanent entities. Now they seem to disappear after not being used for a short while. At the moment I have about 20 Plex entities, all unavailable except the one actually playing something. About half of them are ‘restored’ and unavailable, the other half are completely unavailable.
Plex clients are marked unavailable when they are no longer seen over the Plex APIs. Controllable Plex clients are discovered in a few different ways:
Reported by the Plex server. This requires GDM to be enabled in the Plex server config, and also requires the Plex client to be on the same subnet as the Plex server.
Reported by plex.tv. This requires the Plex client is directly reachable from the HA instance. This requires the Plex client to be reachable by its local IP.
Found by a HA GDM scan. This requires the Plex client to be on the same subnet as the HA instance.
There are also instances when the Plex clients simply time out and go inactive where we can’t see them anymore. This is most common with Plex Web clients.
If the client cannot be discovered by the above methods, it will not be controllable (no play/pause/seek/etc abilities) and will only report status when it is actively playing media.
Plex seems to be working normally, remote users can access it fine. The plex.sensor in HA works normally, I assume that means Plex is directly reachable from HA? They are on the same subnet.
I’ve definitely got clients on the same subnet that are becoming unavailable, I guess something is wrong with GDM. I’ll see what I can figure out. It’s enabled in Plex server settings.
Can you think of any reason that Plex would previously never forgot a media_player? I mean up until last week it kept everything, a single play from a mobile phone 12 months ago and the entity was still there (not restored) in HA.
The sensor will always be available unless the Plex server itself goes down. The same subnet only becomes a factor with the Plex clients as the primary method to discover them is based on broadcast packets which don’t traverse subnets (without extra help).
If a Plex client has new activity it should “wake up” the existing media_player. It should only create a new one for the same device if you’ve logged out of your Plex account on the Plex server or client.