PlexDevices - Custom Media Player Component

Hi guys,

Thanks for the updated component.

Is there a way I can merge Plex instances together? I have both “Apple TV” and “Living Room TV” displaying the same episode. “Living Room TV” is simply the ATV’s name.

Thanks for any help!

Do you mean you have two plex components that are really the same device or you have one plex component and one Apple TV component that are the same device? You shouldn’t have the former (if so, ensure it’s not really another component in disguise like the Apple TV component). I have the later and use the universal media player to solve this issue.

On that note: the universal media player doesn’t fully do it for me as it doesn’t blend the two devices fully. I plan on submitting a change to do that later in the week.

1 Like

You can also hide players not been used as another option.

Ah yes you’re exactly right, I’m seeing the ATV component and the Plex component. Sorry for the bother. Thanks @JesseWebDotCom !

I was thinking about using the Universal Media component but I think I’ll just base my automations on the ATV as that’s what we watch everything through. Relatedly, is it normal that the ATV component reacts before the Plex component does? There is a good 2-4 second lag between the ATV updating and showing the current media and the Plex component doing the same.

Yes, the atv is push based / near realtime. Plex is poll based, worst case 10 second lag

1 Like

So I have automations based on my plex media players so I have used the custom id. However it does not seem to work. HA is showing roku and roku_2 rather than the ID. It was working not to long ago but now seems to have stopped.

media_player:

  - platform: plex
    entity_namespace: 'plex'
    include_non_clients: true
    scan_interval: 5
    show_all_controls: true
    use_custom_entity_ids: true
    use_episode_art: true

I don’t have a roku to test. I recommend rebooting your HA instance.

Hi, seem to have a bit of a problem configuring the plex component.

When trying to enter my X-Plex-Token I’m getting the following error:

17-04-23 17:06:46 ERROR (Thread-9) [plexapi] http://192.168.1.66: junk after document element: line 10, column 0

Both the plex server and HA are both on the same machine.

Any suggestions / ways to debug?

Tried that. When the plex component first came out i had unique ids one day they just vanished. Maybe when I upgrade to 0.43 it will work again.

Seems with the new update the unique IDs are back. Hopefully they stick around.

today, i faced a weird problem. my media players’ entity name have lost their entity_namespace. In my config, I have entity_namespace: 'plex'. But in the Developer Tools > States, it only shows… media_player.rasplex. It suppose to be media_player.plex_rasplexlr. It causes all my automations that are using this entity to stop working. It is back to normal after I restart HA.

i am using HA 0.43.0.

I’ve been having an odd issue lately and hoping for some assistance.

It seems that once the media player has stopped playing something, the artwork doesn’t clear or the media player doesn’t go away from the front-end. So when you look at the front end it looks like things are still playing.

Does anyone else have this issue?

I can confirm with 0.42.4. I’m using the Plex App on my smartphone for playing music at work. Now I’m home for 6 hours and it’s still showing the artwork and the pause-button, as if the media was still playing. The Plex-App via browser is not showing any current activity.

I think I see the cause. I’m testing a fix.

1 Like

See my recent reply - I think I see the cause. I’m testing a fix.

Awesome! Thank you!

There hasn’t been any update to the component to cause that behavior. Make sure your config contains the following exactly under media_player / plex:

use_custom_entity_ids: true

Go to the url below (replace with your token) and see what you get:
http://192.168.1.66:32400/?X-Plex-Token=your_token_here

then make sure your plex.conf only contains:

{"192.168.1.66:32400": {"token": "your_token_here"}}

All the above assumes your plex server is running with an ip of 192.168.1.66 at port 32400 and that your HA server is on the same network.

plex.py.yaml (32.1 KB)

Test this and let me know:

  1. place the attached file in the custom_components/media_player folder in the root of your home assistant (you may need to create the folders)
  2. rename the file to plex.py
  3. permission the file if needed (ex. chmod …)
  4. restart ha and test
1 Like

It was initially…

use_custom_entity_ids: false

After I changed it to true, all the players never use the entity_namespace in the entity.