Plex binding for OH3 | Will it be ported?

Previously had the plex 3.1 binding but upgraded to OH3.2 so I added this:

org.openhab.binding.plex-3.3.0-SNAPSHOT.jar

to my : /usr/share/openhab/addons folder

It is the only external addon but I get this message in the log during startup.
As a result none of the plex things work. Have restarted OH3 many times.

Is it cached somehwere, if so how do I purge, or any other ideas?

[WARN ] [core.karaf.internal.FeatureInstaller] - The binding add-on ‘PLEX’ does not exist - ignoring it.

I got rid of the WARN by editing :
/var/lib/openhab/config/org/openhab/addons.config and manually editing the bindings line to remove PLEX.
(There is a super long winded thread on how to remove old bindings, honestly didn’t have the time to read it, it goes in circles quickly.

Also had to do: chown openhab:openhab on the new jar in the addons folder, then it came alive on restart.

Now however - all my existing Plex THINGS are “Unknown” .

I started a plex player and used the SCAN feature when adding a thing and it detected a player running - So I added it and tested it was indeed the one that I was running as the status in the associated ITEM was being updated on play/pause. Inspected the THING and saw the machineid is not what it used to be, its also not listed in : https://plex.tv/devices.xml

It is a real PITA to recreated ALL the PLEX THINGS, so…

Where is the scanner getting its machine ids from?

Hi Stan.

The scanner gets the IDS from: https://plex.tv/devices.xml

Thanks for the response, but I perform a find in the devices xml after the scanner has gotten and ID and the ID is not in devices.xml, not even partial.

For example just added a tablet using scan:
configuration:
playerID: w7pmpadeolobc1zrfyzbijub

loaded devices.xml - can’t find that ID, that device has a totally different id:
clientIdentifier=“b00400f3ebe9c63a-com-plexapp-android”

This device has PlexAmp and Plex installed on it, in testing there seems to be some “cross-talk” if plex and plexamp are both running then start/pause in plexamp seems to update the plex item.

devices.xml identifies the different players as:
product=“Plexamp” productVersion=“4.0.1”
product=“Plex for Android (Mobile)” productVersion=“8.29.1.30697”

I’ll keep plugging away . . .

I’ve found out that on at least Android 12 devices if you play Plexamp alone and do a scan, OH will detect a player with some unknown clientid not listed in devices xml. Closing out PlexAmp and starting only Plex then doing a Scan when adding a Thing - will pickup the correct clientid (that is in devices.xml and use it as machine id in the created thing.

FTR Devices playing PlexAmp show up in the Plex Dashboard, but are presently unpredictable in OH3.2 with the v.11 Plex jar.

Not sure if the Plex API lets you choose playlists or folders to start playing ( I imagine it does, since plexamp seems to essentially make calls to plex) but that would be on my wish list.

e.g.) Power on the stereo in OH3 and it automatically starts playing some folder or playlist.

Hi
Did you guys add webhook configuration to the plex server? I don’t get any player. Server is online.

Hope this isn’t necessary, Guess this is a premium feature, no?


I just tried the new binding myself. And I'm getting my server online, but can't get a player online. What's the required id of that thing? Is that something unique you create yourself? fe 192168123321 (IP of server) Or should that come from plex? Or...?

In https://plex.tv/devices.xml, I see folllowing 3 devices:

  • My server
  • My webbrowser
  • My phone

Got it:
Just go to the link and https://plex.tv/devices.xml you get a list of devices. there you take the “clientIdentifier” and put it to Machine Id in Openhab Plex Player.

I tried this with the 3 devices clientIdentifier I see, but none of them brought my player online. :cry:

did you play something after you add the client player?

1 Like

I’ve noticed that players stay that way until somethings is playing on them…. But I can’t get my “Plex Dash”s to report properly… but i haven’t spending time on it

1 Like

Came online after I started something on my webbrowser.

For the moment, I’m getting a lot of warnings like:

2022-04-05 17:50:20.441 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler PlexPlayerHandler of thing plex:player:fdd117bd6f:3aea92954a tried updating channel art although the handler was already disposed.
2022-04-05 17:50:20.442 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler PlexPlayerHandler of thing plex:player:fdd117bd6f:3aea92954a tried updating channel thumb although the handler was already disposed.
2022-04-05 17:50:20.442 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler PlexPlayerHandler of thing plex:player:fdd117bd6f:3aea92954a tried updating channel progress although the handler was already disposed.
2022-04-05 17:50:20.443 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler PlexPlayerHandler of thing plex:player:fdd117bd6f:3aea92954a tried updating channel endtime although the handler was already disposed.
2022-04-05 17:50:30.481 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler PlexPlayerHandler of thing plex:player:fdd117bd6f:3aea92954a tried updating channel state although the handler was already disposed.
2022-04-05 17:50:30.482 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler PlexPlayerHandler of thing plex:player:fdd117bd6f:3aea92954a tried updating channel power although the handler was already disposed.
2022-04-05 17:50:30.483 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler PlexPlayerHandler of thing plex:player:fdd117bd6f:3aea92954a tried updating channel title although the handler was already disposed.
2022-04-05 17:50:30.484 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler PlexPlayerHandler of thing plex:player:fdd117bd6f:3aea92954a tried updating channel type although the handler was already disposed.
2022-04-05 17:50:30.487 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler PlexPlayerHandler of thing plex:player:fdd117bd6f:3aea92954a tried updating channel art although the handler was already disposed.
2022-04-05 17:50:30.489 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler PlexPlayerHandler of thing plex:player:fdd117bd6f:3aea92954a tried updating channel thumb although the handler was already disposed.
2022-04-05 17:50:30.490 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler PlexPlayerHandler of thing plex:player:fdd117bd6f:3aea92954a tried updating channel progress although the handler was already disposed.
2022-04-05 17:50:30.493 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler PlexPlayerHandler of thing plex:player:fdd117bd6f:3aea92954a tried updating channel endtime although the handler was already disposed.

I am getting out of memory exceptions after a while. I just add my plex server, one player and a rule to switch my lights depending on the player state. It works fine for like 3 hours but then i start getting out of memory exceptions.
I don’t know if it’s relevant or not, but my plex server goes to sleep when inactive, so that may cause the problem.
Any ideas?

Continuing the discussion from Plex binding for OH3 | Will it be ported?:

Okay, I’m sure I am missing something but am looking for some support. I have everything bound and active but as soon as I start playing anything on any local client I get Plex is not returning valid session data. I see that error mentioned a few times above but no consistent answer on how to address the issue. I’m configured using my server IP and the toke retrieved from going to that IP and viewing XML I have also attempted multiple tokens from https://plex.tv/devices.xml but can’t seem to stop it from disconnecting once I hit play. Any help would be greatly appreciated.

Just for an update if you are still on 3.2.0 obviously the 3.3.0 jar update won’t work.

Hi Keil,

Still having problems with the binding or did updating to the correct version solve the issues.

@aronbeurskens Yes once I realized I was behind a version I updated and was able to get everything working.

Hi all.

I’m close to getting the code merged into the OpenHAB project.
There is a section in the README that describes use cases.

It would be great if you could send me some use cases with pictures (PNG) or videos how this binding is used.

2 Likes

You want detailed examples or can we type stuff off the top of our heads? Like
“When state is playing - activate scene “movie” ?
I haven’t got anything set up yet but I have a couple of ideas :blush:

See: [plex] Initial contribution by aronbeurskens · Pull Request #12135 · openhab/openhab-addons · GitHub

The README needs a part with information what the binding can do. It would be nice to have a complete list there with real examples (photo’s / videos) how people use it.