[OBSOLETE] Plex Home Theatre Manager SmartApp

Just to add to this… I think I have narrowed down the issue of the missing devices!

Looking at plex.tv/devices.xml… I’m missing devices here, and also not showing in Plex Web settings! :fearful:

I would expect to see a total of 3 Samsung TVs, 2 in my house (same model) and 1 at my parents (different model)…

Currently I’m only seeing 1 device, with an external IP, which is one or both of the two in my house! This is worrying for a few reasons… mainly because there could be devices connected which I no longer have any control over access?!..

I’ll try deleting these one from Plex when I get some and see if both still function, and then try removing and re-connecting at the TV… but this is strange and I’m certain that the TVs were all there before! … I did move my Plex server to a new server at one point maybe something in that migration broke it…

For the naming part in the list… the below code should sort it… I do have a concern that the IP is being obtained from the URI in devices.xml, Samsung TVs as an example don’t seem to have one, the Plex2Smartthings exe parses sessions.xml, which does have the local IP, but only shows devices if it is active… maybe IP needs to be configurable in the DTH but configured via the app if available? (If that is even possible - I suspect you would need to put the logic in to the DTH and set it as you do now, but have a step to finish setup of the DTH, by pulling the default value from the deviceId string.)

I’ll see how far I can get tonight, but I’ll first try and force an IP in and see if this works with the Samsung TV in the first place… otherwise it’s pretty much a waste of time going down that route! :slight_smile:

Code for the improved description below:

         //Define name based on name unless blank then use device name
         def whatToCallMe = "Unknown"
         if(thing.@name.text() != "") 		{whatToCallMe = "${thing.@name.text()}-${thing.@product.text()}"}
         else if(thing.@device.text()!="")	{whatToCallMe = "${thing.@device.text()}-${thing.@product.text()}"}

I accept your feedback anout the whatToCallMe. Good luck with the IP and Port info concern with your Samsung, if it works, it shouldn’t be an issue to make that a configurable setting under the DHT - I think we could even put the clientIdentifier there. I would then think that we make sure that Unknown is always in the list, and that one could populate the data if they want to add a new device that isn’t pulled with this method. Hoping to hear back about the Roku as well.

It would probably just be easier to remove the list entirely, and have device additions through pages, kind of how PlexPlus does it, but better, this way you should also be able to present other device details to the user (may solve some of the device identification details… and actually in fact you could then create a custom device this way too… this would mean you wouldn’t have a second step of setting up the DTH…

In terms of the “Unknown” element in my device naming this is to handle stuff like the below device that even Plex doesn’t know what it is! In which case control is pretty unlikely to work :slight_smile:

<Device name="" publicAddress="82.37.XXX.XX" product="" productVersion="" platform="" platformVersion="" device="" model="" vendor="" provides="" clientIdentifier="cddc5a84-d663-43cb-9563-XXXXXXXXXXXX" version="" id="76281660" token="XXXXXXXXXXXXX" createdAt="1476399311" lastSeenAt="1476399312" screenResolution="" screenDensity=""></Device>

Will report later on Roku / Chomecast / Laptop / Samsung TV when I get home…

So:

Plex Home Theatre (windows EXE) - Appears to be working fine
Plex For Windows (Windows 10 app) - not working
Roku - not working (but can control using my iPhone)
Samsung TV - not tried yet

For Roku, IP and port appear to be correct

Not sure what info you need? Happy to re-run and provide logs if you want to add any debugging, or let me know what I need to look for… but not seeing any errors :frowning:

Good that PHT works like PMP - I think I can check the W10 app as well, which maybe I will try later. I know I can’t control Tabs in Chrome, but I’m not sure why ATV4 and Roku work through the official app but not through this code yet. Hopefully unlocking one will fix the others?

Thanks for this great app!

Feature request:

Is it possible to have this SmartApp use the Plex Webhooks for instant status/response?
https://support.plex.tv/hc/en-us/articles/115002267687

Thanks!

I didn’t know about this, but this would probably be fairly easy to do, the hardest part is identifying the player… however the downside is that it only works for Plex pass, which will rule quite a lot of people out!

However @ph4r is working on some updated code using the official Plex API that will hopefully achieve this without the use of webhooks… I know there hasn’t been anything on here for the past 11 days, but we have taken the discussion and testing off line, although the drop box link above will be the latest code we are testing…

Webhooks would be much easier, just a shame that it’s Plex pass only! … I will potentially look at adding this as another interface in the PlexPlus smart app in the future if I have some time, but I’m struggling to find time to help ph4r let alone pick up a new project, if I get a free weekend though then I’ll give it a go, and then porting to this smart app should be fairly easy :slight_smile:

@jpark40 - Thanks for bringing this to my attention! I agree it might leave some people out, but I think this might be able to be added either here or the PlexPlus SmartApp. I am a PlexPlus subscriber, but didn’t know that this existed. I think it might be pretty easy to add to the PlexPlus SmartApp with a new endpoint.

According to the example JSON they list it does not include duration, which is a bummer because then the dropbox version of this “suite” can’t send a new play position. I have found more time than I expected the past couple weeks to work on this; however, I am travelling the next couple weeks and will not likely get to this very soon.

Which version are you using currently, the OP or the dropbox from me?

1 Like

In fairness, it was only announced yesterday!

https://community.smartthings.com/t/plex-adds-alexa-skill-and-webhooks-for-automation/76521

@jpark40 @ph4r

I’ve updated PlexPlus to support this during my lunch at work, will need to make a couple of wording and documentation changes to help with setup, but install it, enable OAuth, enagble debugging in the SmartApp and it’ll post the webhook URL in live logging :slight_smile:

v3.1 - Added support for Plex Webhook (Plex Pass users only)

Porting this to PHT Manager should be fairly simple too, shoudl only require minor tweaks to terminology and and the ability to disable status updates from other sources :slight_smile:

1 Like

Using the OP code.

Wow that’s a productive lunch! Thanks! :smiley:

So I got this v3.1 setup with the webhook URL in Plex but now I’m not sure how to trigger anything.

No rush, I’ll wait for you to update the documentation during your next lunch :wink:

Thanks again!

OK. I got it working :slight_smile:

  1. Add a new Plex WebHook pointing to:
    <IDE URL>/api/smartapps/installations/<APP ID>/pwh
    You can get the IDE URL and APP ID from the PlexPlus app under Setup Details/API Info. Use your region

  2. Create a new room like you would have done previously. Use the Player Name like you would have done previously also

Job done

Firstly, make sure your server is on the latest version… then create a room in the smart app and update one of the fields “Player name, User, IP” for values you can see what’s being sent under “Last Event” in the SmartApp…

Just turn debugging on and go in to live logging… open the app and click done and it will give you the full URL to copy paste in to Plex :slight_smile:

Or that :slight_smile:

1 Like

Actually, I can’t get this to work.

Im assuming I dont need the app on my server any more, but my WebHook URL of
https://graph-eu01-euwest1.api.smartthings.com/api/smartapps/installations/<app_id>/pwh doesn’t seem to trigger anything.

It throws the error:

physicalgraph.app.exception.SmartAppException: Method Not Allowed

Am I missing something?

Grab the URL from the Live logging :slight_smile: , you are missing the access token on the end…

Also if you haven’t already updated your server, you will need to, otherwise it doesn’t seem to send an event!

Ah it was the token.

Success, its all working now. I can remove the server app :slight_smile:

1 Like