Plex Webhooks

No problem, did you solve the Roku issue? I use one, but not in a room I need to control lighting.. so understand what you mean but don't suffer the issue myself..

I think I can do something with armand's Roku app in another thread. I just installed it but the wife is gone and I better get the laundry done or home automation will be the least of my worries. :stuck_out_tongue:

has anyone got plex notifying of playing state where a remote server is used? I'm using a server that isn't mine. But would like to turn a virtual switch on if my shield tv is playing plex for example

i don't think this is possible tho where i don't control the server.

You would need to get them to setup webhooks on their server. This will give you visibility of everything they watch too.. so doubt they will do that?

You would need to find a way to get play state directly from the shield, not sure if it will let you run tasker or even if that can capture play state..

1 Like

Ok cool. I'll work it out. Thank you

so i got remote access to webhooks on the plexserver. but Using plex communicator - it seems it will only work it it's on LAN is that right?

Using maker API I'm not sure how I can open app access to an app.

You should just need to use the cloud URL rather than the local URL..

In the code replace getFullLocalApiServerUrl with getFullApiServerUrl

1 Like

ok cool. i updated two instances of that text. But testing that URL I get

{"error":true,"type":"AppException","message":"Method Not Allowed"}

Do I need to do something in maker?

thanks for the help

You need to put that URL in Plex, visiting the URL normally won't give it the information it needs so it will error..

1 Like

ah ha! thank you

Could anyone tell me where I'm going wrong? I copied the 'Plex Communicator' into HE 'Apps Code' section with OAuth enabled. From there I copied 'Plex Communicator Device' to HE's 'Drivers Code'. Lastly, I copied 'MediaScene' and 'MediaSceneChild' (Everything coming from this forum topic page) into 'Apps Code'.
After going through the Plex Communicator setup i.e., adding my Plex device, logging into my PlexPass account, and adding the webhooks URL given by 'Plex Communicatior' app into my Plex server, I am able to see debug events occur in Hubitat whenever I play, pause, or stop my Plex player (Nvidia Shield), but nothing ever changes in the 'Current States' status of my Plex Server device from the HE device list.
Being that there is debug communication going on between my Plex server and Hubitat, could it be the device driver?



You appear to have done everything right! It is likely that the device ID is not being correctly passed by Plex in the JSON likely a different device ID, but the current debug logging doesn't show what's being passed.. I'm away from home, I think there are a couple of commented out logging lines one of which should contain the id being passed.. however when I get home later I'll update the code to make this easier to debug..

1 Like

@jebbett Just wanted to jump in to say Thanks for the great info in this thread. I just got my Plex Communicator hooked up with MediaScene and its working perfectly on the first run.

Quick question - although maybe I should ask it over in a different thread - but is there any way to control multiple lights individually in MediaScene?

For example, I have 3 light switches that I'm trying to control. Front Lights are between the screen and the sofa, Back Lights are behind the sofa, and Stairs Lights are (shock) on the stairs.

I'd like to use both the Front and Back lights with the webhook, but I want to set them to different levels and in different situations. When I play, I want all the lights to go off. When I pause, I only want the Back Lights to dim. But when I stop, I want the front and back lights to come on.

I may be missing it, but it seems like I can only control the dimmers together, like a group, and not individually. Is that right?

Thanks again!

1 Like

No worries!

Just create different "rooms" in media scene, with the same triggering device :wink: they should be called groups really..

Thats what I was thinking, but figured I'd ask. It felt very similar to "Simple Lighting" where it just makes more sense to set up a few small rules rather than over complicating the situation.

Thanks! (Now if I could just shake these Error 500 that keep locking up my hub, I'd be in great shape!)

1 Like

i think i missed it but how do you enable oauth

nevermind got it but i keep getting a error saying im not authorized when i try to set up the app
Error: Unauthorized

app:8572020-02-25 11:14:40.511 am errorgroovyx.net.http.HttpResponseException: Unauthorized on line 319 (authPage2)
this is the error code i get when trying to log in

If you refreshed or changed anything, you may be using an old OAuth "client secret."

https://docs.hubitat.com/index.php?title=How_to_Install_Custom_Apps

"If your client secret key becomes compromised, you may refresh it to protect the OAUTH2 endpoint security. To refresh the client secret, open your user app code, select OAuth and check to box for Refresh Client Secret, the select Update"

1 Like

First of all Many thanks to @jebbett for creating this. All I have done here is to document my learning in getting this to work so first time users dont struggle but enjoy this cool feature to impress WAF & Kids :smile:

  1. Copy all the Code in this post to a notepad - Label them separately to avoid confusion
  2. You need to have a PLEX PASS else this will not work
    Instructions are seque
  3. Installation on Hubitat Side
    a. Click "Drivers Code" -> "New Driver" -> Copy & Paste the Plex Communicator Device code & save
    b.Click "App Code" -> "New App" -> Copy & Paste the Plex Communicator code & save. Click on OAuth Option and update.
    c.Click "App Code" -> "New App" -> Copy & Paste the MediaScene code & save
    d.Click "App Code" -> "New App" -> Copy & Paste the MediaSceneChild code & save
    e. Click "Apps" ->"Add User App" -> "Plex Communicator"->Enter Plex Username, Enter Plex Password & LAN IP Address of Plex Server (Enter only IP Address no URL)
    f. Click "Apps" -> "Plex Communicator" -> "Select your Device" -> Select the Plex Media Player (In my case it was my android STB. It could be fire TV chromecast or whatever) & Done
    g.Click "Apps" -> "Plex Communicator" -> "Connection Method" -> "Plex Webhooks Settings" & Copy the URL displayed (Important for Plex to send you status update. The device ID is key for communication hence URL from this option is Key). I dont have ST or Smarththings so ignored all other Options
    h.Click "Apps" ->"Add User App" -> "MediaScene" -> Click Done to Install. After which you can configure for different play, pause or stop stage different light configuration or swithc configurations. This is a trial and error you should chose what is relevant to your home.
  4. Installations on Plex Side
    a. login to the Plex website https://plex.tv & Select your Account name and select settings. On left side you will see "webhooks". Copy the URL from 3,g & Click save (Format should be http://[Local IP of Hub]/apps/api/[DeviceID xxx]/pwh?access_token=xxxxxxxxxxxxxxx)
  5. At this juncture you should see go to Hubitat logs and see if playing or stopping plex show provides the log entries.

If all goes well the integration should be complete and it should work

I was a bit lazy to do the screen shots (Look for posts from zskwrel few screenshots are there). But this is fresh from completing it now so pretty close barring few typos here and there.

Thanks

6 Likes