[OBSOLETE] Plex Home Theatre Manager SmartApp

I resolved the issues of the hubAction, by setting the device id to IP:PORT in hex.
This then send the response to the parse method of the device itself.
I’ve updated my Kodi code in github have a look to see how i did it.

Thanks for your work on this again! made my life easier

I’m so pumped for this!!

Has anyone tested it with the Plex Apple Tv client on the 4th gen Apple TV? Does/will it work on this? I’m looking for basic “when playing, dim lights, when paused/stopped, set lights to 100%”

I’ve been in hospital today, so haven’t been able to do any work on the project. However I will be able to at the very least be able to do what you ask. The main issue is the ability to control these devices.

Detecting The devices current state is. Controlling is not so easy because it’s most end points don’t support it.

I’ll make some changes to make this work for you

Thanks man. I’ll take a look into this… So you set the device id, or the device network id?

its the devicenetworkid that needs to be set, then the results come back to the device…

im seeing a new issue though, polling every 10 seconds seems to be slowing down by whole smartthings setup. other deivces, eg motion sensors triggering lights. i’m not 100% though

I’m not sure how everything else works when you set the devicenetworkid, as that’s what I use to store the server ip / client IP and device unique identifier?

I doubt a 10 second poll would cause that kind of slow down?

Installed this, it sees my Plex Media Player(plexpass app, on windows 10), but cannot issue commands etc. It does show what is playing though. I believe this is a Plex Media Player issue, as no where in its options do i see something for http commands.

Will switch over to Plex Home Theater(like it 100x better anyways) tonight and give her a shot.

Nice! Confirmed works with Plex server running on Linux box (my media hub) and a Roku 3 client (Plex Channel)

Picks up the play state, play/pause works, media title displays.

So… cool. Now, um… how do I bring down the lights on play/bring up on pause/stop.

I’m seeing the following when it tries to get my auth token:

Hit Exception java.lang.SecurityException: Endpoint https://plex.tv/users/sign_in.json?user%5Blogin%5D=XXXXXXXXX&user%5Bpassword%5D=XXXXXXXXXXXXXXXXXXXXXX is blacklisted. on [uri:https://plex.tv/users/sign_in.json?user%5Blogin%5D=XXXXXXXXX&user%5Bpassword%5D=XXXXXXXXXXXXXXXXXXXXXX, headers:[X-Plex-Client-Identifier:Plex, X-Plex-Product:Device, X-Plex-Version:1.0], requestContentType:application/json]

Simple! Go and search the forums for a smart app called Rule Machine. Install it.

You can use rule machine to set up simple or complex rules. In this case you say "when Plex is switched on, dim lights’ and ‘when Plex is turned off, set lights to 100%’

From what I can tell googling around, that blacklist error simply means ST cannot resolve the server… Give it another go and see if it works

Looks like your password isn’t complex enough. =)

I just sent a PR that fixes this. Special characters need to be encoded if they’re going to be passed in a URI.

Urg. I don’t think this is going to work for the Android TV clients. I believe you need the app to 'advertise as a player ’ in order to control it remotely. You can’t enable that on the Android TV app. Even though it’s the same apk.

Disappointing

Ha, nice one @btk. I’ll check it out soon.

@hmin03 just because you cannot control does not mean it’s not useful. I am writing an update which will get your devices in SmartThings, even if it will only show the current status. (Playing / paused / current title etc) so that you can set up cool rules in rule manager like I’ve discussed before.

Is that still of interest?

I’m still interested in just status :slight_smile:

Yep! Still interested!

Just noticed a small error in the device code, makes a big difference
`capability “Music Player”```

should be

capability "musicPlayer"

That way the device will show up as music player when settings rules on its state.
Rule machine hasn’t implemented it yet, i have submitted a pull request to him though

Hi @iBeech ,

Good work on the App, seems like a really good idea, especially as pulling removed the limitation of a separate exe and a requirement for a windows box for it to run on. ( I had re-written some of ChristianH’s plex 2 smartthings App)

But just want to understand how it works in comparison, so Plex2Smartthings has an exe running on a computer that polls the plex server and then sends an event to SmartThings if a state changes, this means SmartThings doesn’t need to poll.

For your implementation I understand that you are polling every 10 seconds from what I can see, in order to avoid an intermediary application, which although is a very good idea, is this not very likely to suffer from the SmartThings runIn() issues that mean that the schedules drop, ST even advise against polling under 60 seconds, and also say that they may prevent it? I’m only saying as I have had issues with 60 second polls recently falling over after about 40 minutes, and concerned that this approach with the limitations of ST will potentially result in unreliability…

I can’t seem to find my Samsung TV when searching either with no obvious error in the console:

f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:16 PM: debug getChildDevices(false), children=0
f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:16 PM: debug Parsing /status/sessions
f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:16 PM: debug Parsing /clients
f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:16 PM: debug The GET path is: /status/sessions
f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:16 PM: debug Executing 'updateClientStatus’
f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:16 PM: debug Polling for PHT state
f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:16 PM: debug The GET path is: /clients
f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:16 PM: debug Executing 'getClients’
f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:16 PM: debug The GET path is: /clients
f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:16 PM: debug Executing 'getClients’
f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:16 PM: debug Token is: [REMOVED TOKEN]
f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:15 PM: debug Getting authentication token for Plex Server 192.168.25.100
f5394d58-73df-43a0-a46a-954afcfff0e3 7:54:15 PM: debug Installed with settings: [plexServerIP:192.168.25.100, plexUserName:USERNAME, plexPassword:PASSWORD, theHub:physicalgraph.app.HubWrapper@IDREMOVED]

I’ll PM you the device as suggested above, not sure how you troubleshoot these things or if there is an easy way to tell if you can control via HTTP… but if having the XML for other devices helps, I have probably about a dozen different device types connecting to mine, would also be good to update the first post with a list of confirmed devices :smile:

[quote=“iBeech, post:55, topic:37415”]
@hmin03 just because you cannot control does not mean it’s not useful. I am writing an update which will get your devices in SmartThings, even if it will only show the current status. (Playing / paused / current title etc) so that you can set up cool rules in rule manager like I’ve discussed before.

Is that still of interest?
[/quote]I’m not smart enough to answer your question, so I’ll elaborate to see if you can find the answer within. My reference is a NAS PMS server to a Samsung Smart Hub client. It seems that HTTP control of the client is not possible (Thank you for probing the Plex forum to the author, Orca, for that answer).

Is it possible to get simple status - perhaps just playing or stopped/paused - from either the client or the server? That would suffice for me. The idea being that I could use Rule Machine to control lighting.

I think that’s exactly what he’s proposing in the referenced reply.