Plex binding for OH3 | Will it be ported?

Are you setting this up through the GUI or via files? Can’t say I have ever done it w/ files, though I guess I should try.

ok

thing file

Bridge plex:server:plexrServer “Bridge Plex : Plex” [host=“xxx.xxx.xxx.xxx”, password=“xxxxxxx”, refreshRate=5, portNumber=32400, token=“xxxxx”, username=“xxxxx” ]

{

plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android “Plex Player” (plex:server:plexrServer)

}

items file

Switch    PlexTVPowersWitch          "Power Switch"                     <video>    {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:power"}

String    PlexTVPower                "Power"                     <video>    {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:power"}

String    PlexTVStatus               "Status [%s]"               <video>    {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:state"}

String    PlexTVTitle                "Title [%s]"                <video>    {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:title"}

String    PlexTVType                 "Type [%s]"                 <video>    {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:type"}

String    PlexTVEndTime              "End time "                 <video>    {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:endtime"}

Dimmer    PlexTVProgress             "Progress [%.1f%%]"         <video>    {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:progress"}

String    BridgePlexCurrent          "Current players"                      {channel="plex:server:plexrServer:currentPlayers"}

String    BridgePlexCurrentActive    "Current players active"               {channel="plex:server:plexrServer:currentPlayersActive"}

String    PlexTVCover                "Cover"                     <video>    {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:thumb"}

Image     ShellArt                   "Background art"                       {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:art"}
String    PlexTVCover                "Cover"                     <video>    {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:thumb"}
Image     ShellArt                   "Background art"                       {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:art"}

I could not get the picture
I’m doing something wrong

Hi,

I just put my Plex server container and my OH3 container in a brige network and used the bride network IP if the Plex server container in the binding configuration of the server thing.
Still showing “online”, still no discovery of any player, neither Windows, Android.

Im am gonna try and setup openhab on my windows machine and check this again.

Any way I can provide some logs that could actually state that theres a connection (or no connection) between OH and Plex?

The art channel is a url, so it’s a string, not an Image. Plex does not supply the Images themselves, but a link to them. You’ll need to make this a String I’d think.

You could put the logging to debug mode, which would probably provide at the least any exceptions that are happening.

The Server thing goes to online once all the checks are passed(so once it’s in the polling routine). I’ve setup another server here inside a vlan’d VM setup to see if I can figure out what would possibly be going on here with a multi-lan setup which is something like what I think you have there. I’ll see if I can update today.

I’ve already made a change quick to handle that better and let you know if Plex polling isn’t returning valid data, I’ll push that shortly once I test a couple things here.

Thanks for the effort.

So my lan config is as follows.
My lan is 192.168.0.0/24.
Docker Host has 192.168.0.4
The macvlan is bound to that only nic (192.168.0.4).
Macvlan has the configuration 192.168.0.0/24, range 192.168.0.160-192.168.0.169, Gateway 192.168.0.1 (which is my actual physical router)
OH3 and Plex are both attached to this vlan and use a pihole container in that same vlan for dns-resolving. Dns resolving works for all containers.

I share these information just so you know what you could try to configure.

@bhomeyer
Update:
I have checked the binding on my windows machine now, and it’s exactly the same.
Can not get any player to show up.
Restarted Plex container several times.

Where do I enable the debug log you mentioned earlier?

thanks
you could share the configuration here
I have a test with this ( the image link is displayed, not the image )
sitemap

 Image item=ShellArt 
 Image item=ShellThumb
String    PlexTVCover                "Cover"                     <video>    {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:thumb"}
String    ShellArt                   "Background art"                       {channel="plex:player:plexrServer:9156fc3e3783f232-com-plexapp-android:art"}

Apologies, to be honest I have nothing setup with files on my OH3 environments, everything is done via Main UI. So thanks for posting your examples.

And yes, you’ll get the URL. Main UI you can just go and place an Image card and select that item and you should be good to go. I guess I could have made the binding provide the image directly, but then it would have meant handling when it didn’t exist, etc and it was not really needed.

For an actual image there in a sitemap something like this would work I’d think :
Image item=PlexTVCover

Hello!

I went from using OH 2.5.x to 3.0 few days ago, and, since Plex is one of the important parts of my automation, I’ve started using your binding as file addon right away. Everything was working fine, until today. I’ve updated Plex Media Server to the latest version, and it stopped working. I’ve tried removing and adding both, server and client things, but without success. When I was initially setting it up, scanning found both, Samsung TV and Chrome player. Now scanning doesn’t find any player, nor manually configured players work, so, I guess it might be server version that makes problem for everyone.

Best regards,
Davor

1 Like

Hello!

Just a follow-up on my previous comment. I’ve decided to roll-back from current (1.21.2.3943) to earlier Plex Media Server version (1.21.1.3842), and everything started working again - scanning finds all the clients, and, after adding them, they work as expected.

Best regards,
Davor

Thank you so much for the work you’ve done on this binding, and apologies for volunteering to test and only now getting back; system wasn’t sending me notifications!

My use case is that I want to show the cover art for playing items on a HabPanel. This is working in OH2 but not in OH3, so I setup a link to the remote OH2 instance and can see that the image strings are different. If I add the OH3 string item as an Image card to the main interface, it still doesn’t work whereas doing this for the remote string item displays the image. Also, the image reference returned in your new binding is that of the specific episode (which is usually just a screengrab from about halfway through) whereas the OH2 binding shows the image for the Series.

Here’s a screenshot (token erased) to show the difference between the two bindings on the Image String.

Hope you can help!

Thanks again.

Ricardo

You are right!

I downgraded my Plex container and now it does indeed work.
The only odd thing is, that the only way the binding would connect to my server is to use the actual 192.168.x.x IP on my LAN. Using the container name, the bridge network ip or the domain name of the server didn’t let me scan for the players nor would they connect when manually added. But this might be a problem with my docker network configuration.

Conclusion: The binding is not compatible with the most recent PMS 1.21.2.3943

1 Like

I had the same problem with PMS on QNAP. I installed 1.21.1.3978 and the binding stopped working, so rolled-back to 1.21.1.3876 and is all OK. I wonder what Plex has changed?

I’m wondering what happened to the few other posts that were here yesterday. There where 4 or 5 newer posts, one with the link to the new binding version from the author of the binding, but they just disappeared.

Best regards,
Davor

Good question, my posts are gone too…

I did get the updated jar and I will say that it’s working :slight_smile:

maybe if it could get posted again, @bhomeyer ?,

I’ll repost my updates .things & .items & .rules (I used Telegram for notifications for years) shortly…

UPDATE: I found it

plex.things

Bridge plex:server:plexrServer "Bridge Plex : Plex" [host="IP.Address.Or.Hostname", password="PassW0rd123", refreshRate=5, username="UserNameOrEmail" ]
{
    Thing plex:player:MyViewerName01 "My Viewer Name 01" [playerID="ClientIdentifierFromDevices.XML1"]
    Thing plex:player:MyViewerName02 "My Viewer Name 02" [playerID="ClientIdentifierFromDevices.XML2"]
}

plex.items

String    BridgePlexCurrent          "Current players"                      {channel="plex:server:plexrServer:currentPlayers"}
String    BridgePlexCurrentActive    "Current players active"               {channel="plex:server:plexrServer:currentPlayersActive"}
Switch    PlexTVPower01                "Power"                     <video    {channel="plex:player:MyViewerName01:power"}
String    PlexTVStatus01               "Status [%s]"               <video    {channel="plex:player:MyViewerName01:state"}
String    PlexTVTitle01                "Title [%s]"                <video    {channel="plex:player:MyViewerName01:title"}
String    PlexTVType01                 "Type [%s]"                 <video    {channel="plex:player:MyViewerName01:type"}
String    PlexTVEndTime01              "End time"                 <video    {channel="plex:player:MyViewerName01:endtime"}
Dimmer    PlexTVProgress01             "Progress [%.1f%%]"         <video    {channel="plex:player:MyViewerName01:progress"}
String    PlexTVCover1                "Cover"                     <video    {channel="plex:player:MyViewerName01:thumb"}
String     ShellArt01                   "Background art"                       {channel="plex:player:MyViewerName01:art"}
Switch    PlexTVPower02                "Power"                     <video    {channel="plex:player:MyViewerName02:power"}
String    PlexTVStatus02               "Status [%s]"               <video    {channel="plex:player:MyViewerName02:state"}
String    PlexTVTitle02                "Title [%s]"                <video    {channel="plex:player:MyViewerName02:title"}
String    PlexTVType02                 "Type [%s]"                 <video    {channel="plex:player:MyViewerName02:type"}
String    PlexTVEndTime02              "End time"                 <video    {channel="plex:player:MyViewerName02:endtime"}
Dimmer    PlexTVProgress02             "Progress [%.1f%%]"         <video    {channel="plex:player:MyViewerName02:progress"}
String    PlexTVCover2                "Cover"                     <video    {channel="plex:player:MyViewerName02:thumb"}
String     ShellArt02                   "Background art"                       {channel="plex:player:MyViewerName02:art"}

plex.rules

rule "Send telegram with title for My Viewer Name 01"
when
    Item PlexTVTitle01 changed
then
    val telegramActionPlexBot = getActions("telegram","telegram:telegramBot:PlexBot")
    telegramActionPlexBot.sendTelegram("Bedroom Roku is watching %s", PlexTVTitle01.state.toString)
end

rule "Send telegram with title for My Viewer Name 02"
when
    Item PlexTVTitle02 changed
then
    val telegramActionPlexBot = getActions("telegram","telegram:telegramBot:PlexBot")
    telegramActionPlexBot.sendTelegram("Bedroom Roku is watching %s", PlexTVTitle02.state.toString)
end

And that makes my OH3 upgrade almost complete, if someone could send me links on how to build my VSCode to port MQTTitude from Legacy OH1 to OH3, I’ll do the work :)… I’m a noob when it comes to Dev work (most of my career is OPS) so any help or hand holding would be greatly appreciated.

Thanks
Aaron

I have OpenHAB 3 running on Windows. For the Plex addin do I use an x-token by examining the url for Get Info on a movie item or do I use a username/password?

@bhomeyer
Thanks for the fix!
I have two things that caught my attention.
The Title Channel only ever shows the name of the playing episode, but not the show. Is it possible that it can show all information about the title?

Another thing is that the Type doesn’t show “trailer” when a trailer is played?