chadwpalm / Lumunarr

Connector application for using Plex Webhooks with Philips Hue Bridges.
GNU General Public License v3.0
52 stars 0 forks source link

Lumunarr don't work / maybe issue with webhooks? #32

Open danieldjupvik opened 1 day ago

danieldjupvik commented 1 day ago

I had Lumunarr configured and working before on v1.3.1 or something but after the hue v2 API change deleted my config and started fresh again because the migration of settings didn't work and then I had to move so I haven't had time until now to reconfigure Lumunarr. But now that I have everything configured it's not working regardless of what im doing. Only getting this output in the logs:

[INFO]  This is a server webhook not associated with a Plex client
[INFO]  POST /webhook - Status: 200

when doing a test from my plex client. The username in the Lumunarr config does match my logs in plex except there the username ends with (1) but that might just be for visuals in the plex log. Client is configured in Lumunarr, I also deleted all my clients in plex auth then added it again just to see if there was retrived wrong client from Plex, but still same issue.

Pretty desperate for help 🙏

Versions:

chadwpalm commented 1 day ago

First, I'm sorry the API migration didn't work for you. I'll have to revisit that and make sure there isn't any edge cases that might be causing issues.

Regarding seeing this:

[INFO]  This is a server webhook not associated with a Plex client
[INFO]  POST /webhook - Status: 200

You can view an explanation of what that message means here: https://github.com/chadwpalm/Lumunarr/discussions/28

The good news is that the message means that webhooks are setup properly in Plex and they are reaching Lumunarr, or else you wouldn't be seeing that message at all. The bad news is that for some reason it is not parsing out your client correctly, so we can focus on figuring that out.

First question....when you are creating a client profile in Lumunarr, are you seeing a list of clients when you pull down the Client list, or is it empty? If you are seeing clients, great.....if not.....then we will need to address that first. Let me know in your reply.

On to webhooks. There is a website that I used extensively when developing the app. It can be found at: https://webhook.site/ You don't need to signup for it. Open that link and the very top link on the page that says "Your unique URL". Copy that and add it into your list of webhooks in Plex. This will send your Plex webhooks to that site so you can see the payloads.

Now, open your Plex client and start a movie. Let it run for about 5-10 seconds then stop it. Go back to the website and you should now see a list of webhook requests on the left. To see the payloads, click one of them and on the right you will see "Form Value" then "Payloads"

image

If you hover over the payload text it will expand out. It's in JSON, and what I do is paste it into https://jsonformatter.org/ to format it better. That's up to you.

What you are looking for is the "Player" section and it should show the title and uuid of the player.

  "Player": {
    "local": true,
    "publicAddress": "XXX.XXX.XX.XX",
    "title": "Chad's Roku Ultra",
    "uuid": "fde9a26e8417550f0f6829858908cff7"
  },

Now look at your Lumunarr settings file (might want to send that to the JSON formatter too) and see if the client you set up there matches in both title and uuid.

      "uid": "8c57a5f9-2e1d-4ebd-ac99-005e92771575",
      "client": {
        "id": "fde9a26e8417550f0f6829858908cff7",
        "name": "Chad's Roku Ultra (Roku)"
      },

The title on the Lumunarr side will show the extra client type in parentheses but that doesn't matter.....the backend is matching up the uuid. Don't get confused here.....the "uid" in Lumunarr is a unique id of the client that is only used in Lumunarr. The matches should be "uuid" in the webhook with "id" in the settings (as shown for me above).

Let's start there and report back to me what your findings are and we can go from there. My concern is the add "1" you mentioned from Plex. I think the UUID's aren't matching, but I want to confirm.

danieldjupvik commented 1 day ago

Thanks for replying! When I create a client profile I get the dropdown list of available clients. The "id" from Lumunarr settings.js file does match with the "uid" in the webhook payload using the website you referred to. Here is the log I was talking about earlier from Plex: [Req#909d5] Webhook: Delivering media.resume event by user RealLokii (1) to 3 hooks.

chadwpalm commented 4 hours ago

Unfortunately I can't tell you what the (1) means in the Plex log.

Perhaps explaining the relationship between Lumunarr and Plex would better help troubleshoot things on your end.

Whenever you log into your Plex account through any application, whether it be a Plex client, or a 3rd party app like Tautulli, Overseerr, Lumunarr, etc., that application becomes an "authorized device" in your account and a Plex token is assigned to that application that allows it access to information in your account. That application/client is added to the list of "Authorized Devices" you see in your Plex settings.

image

When you log into your account through Lumunarr, you are giving Lumunarr access to all of the clients authorized in your account. That is the list you see in the Client pulldown list. If you are running a Plex server, it also grabs the list of users who have access to your server. That's what is populated in the User pulldown list. The Client pulldown list will only contain clients that you are logged into with the same account you logged into Lumunarr with. I just wanted to make sure that point was made, but I assume this is what is happening in your case.

The Client pulldown list in Lumunarr should match perfectly with the Authorized Devices you see in your Plex settings. Both are sorted by "Last Accessed" time. The only thing you won't see in Lumunarr are Plex Servers themselves as I didn't include them for obvious reasons.

You can check the information yourself if you go to https://plex.tv/devices.xml?X-Plex-Token=plex_token You can use the token from the setting.js file to replace "plex_token" in the line above. The result is in XML, but you should be able to see the UUID numbers there.

One other thing.....you had mentioned Plex version 4.136.1 (which is actually the version of Plex Web, not the server) which means your client is through a browser? I tried to use this earlier and the webhooks were spitting out user IDs of "0" instead of the actual user ID for my account, so Lumunarr wasn't working. I thought this was maybe a feature and was ready to update code, but I logged out and logged back in and everything was working again, so I don't know if something go screwed up during a Plex update. You might want to try that and see if it fixes things for you.