Plex Integration returns deleted users within 'Monitored Users'

Having the following issue with Plex integration returning ‘deleted’ users.

Plex allows you to share your server with ‘friends’ / ‘shared users’. In the Home Assistant integration, it calls these folks Monitored users : A list of accounts with access to the Plex server.

However, the HA integration also returns users that do NOT have access, including deleted users.

Example, Here is how it looks in the log, with the 5 accounts in bold already deleted from plex:

2021-02-22 13:56:11 DEBUG (SyncWorker_1) [homeassistant.components.plex.server] Linked accounts: {‘eschrxxxx’, ‘solocxxxxx’, ‘casblxx’, “Y’xxxL”, ‘Watcxxxx’, ‘Philfw’, ‘schrxxxx’, ‘rosxxxxxx’}

I’m attaching a screen shot of the the five users as they appear during integration setup:

Is there an opportunity to modify the code to only return active and non-deleted users? Its was a bit disconcerting to see the list of monitored users return with folks deleted from Plex years ago.

For reference I also opened this topic with Plex to see if they could handle this on their side.

Thanks,
Ed

Last I checked the Plex API didn’t have a way to tell if shared users were deleted or access had been revoked.

Edit: But I’m sure there’s a way. Will need to find time to explore what’s available.

1 Like

Thanks! FWIW,
That info is exposed via https://plex.tv/api/users/?X-Plex-Token=xxxxxxx ;
This shows in my case only the two:

reference

class plexapi.myplex.MyPlexAccount
users() Returns a list of all MyPlexUser objects connected to your account. This includes both friends and pending invites. You can reference the user.friend to distinguish between the two.

Yes, but we tried to rely on a local call to the Plex server which doesn’t need to reach out to plex.tv. That might be unavoidable here as the local list of users also includes all users that previously had access.

Can you provide an example for local call you use ? Thanks again for your responsiveness.

https://<PLEX_SERVER>:32400/accounts?X-Plex-Token=xxxxxxx

Perfect, thanks.
Yup - Those ‘deleted’ accounts appear there and I agree there is no indication that they are inactive (let alone deleted).
I think that is something for Plex to look at, as seems they should not leave orphan accounts there after they are deleted through the web application.

Addressed in https://github.com/home-assistant/core/pull/46971.

1 Like

Perfect! Thanks!