Plex and OpenHAB - fun times!

A bit of a provocative title but I mean no harm :slight_smile:
Actually, I’ve been having a lot of fun with the plex binding, it shows a lot of useful data to make cool things like control lights and show what’s being played on - however I think i found a missing core functionality:
To push a specific content to a player.

Here’s a (home assistant, sorry!) post discussing the topic:

I know we need the rating key to identify the media we want to play, and we have that with the openHAB binding!
We have it for the TV series seasons main series even single episodes and movies and audio. All is good.
But, for the love of everything that is holy I cannot figure out how to push that to the player in order to begin playing said content.

Or, in all likely I’m being dumb as per usual :smiley: which brings me here.

So my entire project is quite simple:
NFC reader reads an NFC card;
Card ID is mapped to a Plex Rating key;
Rule is triggered by the reading which sends the plex content rating key to my player and the media starts playing;
Result: happy 3 year old.

I have the nfc reader done;
I have the card mapping also understood;
OpenHAB and the esphome binding pick up the nfc ID and then the mapping is fairly easy to complete;
I’m now stuck on the last bit: pushing the command to a Google TV with chromecast to open plex and start playing.

Has anyone been able to complete such an experiment?
Any ideas or pointers to nudge me in the right direction?

Please help a young father pulling his hairs out.

:heart:

Edit:
Might as well share the hardware:
Esp32-c3
NFC card reader (i2c)

In time I will design a 3d printed enclosure and store everything neatly in the front of the Besta (IKEA) TV bench, so my kid can grab the nfc cards (on which I will stick the pictures of his favorite characters) and scan them with the nfc reader.

Edit 2: because I’m a sociopath I decided to forego sleep and try a couple more things, namely the AndroidTV binding. Unfortunately because I have an actual google TV (With chromecast), the App name channel is read only so that doesn’t work.
How can this be so hard :confused:
Android debug bridge I guess… I’ll report back soon.

Please do!

I once looked into something similar way back when I used Roku. I could get as far as launching the app but I couldn’t launch the actual content. I never looked at Google TV/Chromecast options though. It will be interesting to find out what you discover.

I’ve also moved somewhat away from Plex. I still run it but not as my main app any longer. But if there’s a way to get a URI to the content you want to play, you could use the Chromecast binding’s “play uri” Channel. I don’t think it will be playing through the Plex app in that case though and the content will be directly streamed, “cast” style.

Maybe using Python ? https://stackoverflow.com/questions/68875959/how-to-start-a-plex-stream-using-python-plexapi

It was so simple with VHS tapes. My 3-year olds back then simply grabbed the right cassette and put it inside the player…

AHHHh I completely forgot that one! Thank you for reminding me!
I did a quick test with the Chromecast:
Yes it’s cast, no plex app.
Plex server doesn’t even know it’s playing.
No subtitles or transcoding nothing.
But as long as the player is a decent one most things should play.
No next episode logic whatsoever.

So.. okay this is some of the solution but not the whole thing, so I’m going to check out the Android debug bridge too and report back.
But hey if someone out there is looking to cast movies this works.

What do you use now? The Plex UI/app has been super slow on my old TV (5yrs old-ish?). I guess they tested it on the latest generation TVs. Migrating away from plex isn’t something I look forward to though. Too many projects, not enough time!

Humm I don’t think that script can actually start the plex app can it??

If ADB doesn’t pan out, you might be able to set up a rule to calculate the URI for the next episode and start it. I don’t know what the URIs look like and am assuming they are predictable. It’ll be tedious but it should be possible, assuming the URIs are predictable. If not, maybe you could set up playlists and load them into a rule to choose the next episode.

I still use Plex. I paid for a lifetime license a long time ago so I feel obligated to keep it up and running. But I don’t really acquire new content for it any more so it’s all the same old movies and TV shows we’ve already seen a hundred times. We mainly use the streaming service day-to-day.

If I were to jump ship, I’d use Jellyfin today.

Back in the day I used to run BeyondTV and then MythTV to create my own self-hosted DVR with OpenELEC running on an RPi for the TV/user interface. But now I crave simplicity.

ADB is dead on the water. Android 14 killed it with auto changing port on device reboot, so that’s no go.
Ungh.
I was actually just now looking at the url and trying to figure out a logic behind it, but I’m reading about an allleaves api endpoint that is supposed to output all members of a season.
Now this can be real or ai hallucination.

I’ll do some tests in a bit and report back.

I’ve had a Plex Lifetime subscription so long, I feel I’ve gotten my money’s worth from it. I’ve moved on to Jellyfin, I got so fed up with Plex because my media (what I want to watch) was buried so deeply under their “services” (nothing I’d ever asked for or would want to watch).

Jellyfin has proved to be a nearly seamless drop in replacement. It took a couple tries to get the hardware acceleration fully config’d and the one place it falls down compared to Plex is real-time de-interlacing. I’ve a bunch of older TV episodes that I never baked the de-interlacing into and Jellyfin stutters a LOT when trying to stream those despite the machine being plenty powerful enough. It’s almost certainly my fault for missing some config, but instead I just need to go back and Handbrake those and Jellyfin will be 100% satisfactory for me.

The whole “you must log in to our cloud servers in order to access your self-hosted server” stuff never sat right with me either. I’m glad to hear that Jellyfin was so easy to integrate. I keep seeing articles about it and it looks like a more than capable replacement.

@Pedro_Liberal, maybe the URIs in Jellyfin are easier to deal with? It would be worth a 30 minutes bit of research. Maybe you can more easily reach your goal by pivoting.

@rlkoshak I actually did not consider jellyfin.
There’s a binding, @JustinG you have jellyfin right? Can you do a quick test please?
I found this channel in the documentation:

play-by-id String Play media by id, works for series, episodes and movies; id search is explained bellow
Jellyfin - Bindings | openHAB

(The documentation is actually missing the search by id section apparently…)

Does… it work? I’ll spin a docker container for this alone :rofl:

With a very quick and dirty test, I was able to get the play by id channel to work with a web-based Jellyfin client, but not with the client app on my Pixel 8. :person_shrugging:

@JustinG ah ah, then perhaps there’s a chance, though it worries me because I will be using the android TV app, hope it’s different enough from the mobile :slight_smile: