[Release] Plex Communicator V3

The two switches are in the same hubitat room as the ShieldTV device. I created three rules. One on play, one on pause, one on stop. Nothing happened. Pressing the Run Actions on each rule though performed as expected. It just does not respond to the Plex. It wants to see playing, paused, and stopped. Plex2Hub reports PLAY, PAUSE, STOP. I selected the music player as the capability for trigger event and then the ShieldTV device. So, it is likely that your MS app is not at fault. It is something else. It almost works but not automatically controlled by state change reporting from Plex2Hub.

This is the section of config.config:

  <!ENTITY accessToken '6144b52d-1e49-4286-a50d-d2e486ca2371'>
  <!ENTITY appId '4'>
  <!ENTITY ide 'http://10.0.0.144/apps/api/'>
  <!ENTITY plexStatusUrl 'http://10.0.0.253:32400/status/sessions?X-Plex-Token=yVsX3CrjgWhTXJeC-BHo'>

Do I also need to do something in the webhooks section of Plex? Do I need to put a url in there? If so, what url?

You have not answered my question, the Plex device you created in Hubitat is that changing status along side Plex?.

If you are not getting errors in the exe then config.config is not your issue, if you have reinstalled the app then you need to re-setup config.config.

You can use web hooks only if you have paid for Plex Pass, if you do then you don’t need the exe

I got it to work. I needed to put in the webhook url that Plex Communicator shows. Duh. Thank you for your help.

No problem, glad you got it working, it's probably an issue with the exe, probably something has changed in hubitat, but WebHooks is the future!

Absolutely. I did not know if I needed to use exe AND webhooks or not. But after I found out what the url was for in Hubitat it made it really easy. I am using the rule machine to control the lights as it seems that that has a lot more flexibility currently. I just wish that I could put the Hubitat device in as a secondary controller to my VeraSecure. Vera is more capable and it has support for the 2GIG rf devices too. I need that. WIth secondary use Hubitat could see all of my devices on the VeraSecure but alas not available as far as I know.

@jebbett Still loving this great app in my theater. I need to incorporate @martinez.mp3 's additional attributes.

A question for both of you, and then a request....

Is there a way to see all of the attributes that are available? I'm particularly looking for a movie's aspect ratio and don't know where or how to hunt down if that info is being passed or can be passed. I have a screen mask with a qubino shutter module that I use for cinemascope movies. It would be F*&(*Cing awesome if Plex Communicator could see the aspect ratio and then lower the screen mask based on that.

And for a feature request (although this is really for MediaScene) -- Can we add or separate the levels and colors per light/switch? In my use case, I have "Front Basement Lights" and "Back Basement Lights" as well as "Screen LEDs." For Pause and Stop, I don't want them all set to the same level.

The "front" lights, which are over my seating area and screen, I generally set them only to 5% on pause. But my "back" lights I set to 20%.

So right now I have 3 separate rules for each set of lights. Would be nice if you could set each individually within the same rule.

Still an amazing app in my house. Thanks so much !

Separately, I'm seeing logs from devices that are not selected to be monitored, and aren't even my own devices, or the server that I have monitored.

Short version, I have 2 plex servers. One that everyone uses (Ubuntu), and one that I use in my media room (nVidia Shield). They are completely separate instances of Plex.

I'm guessing the webhook in my Plex account is logging all the activity in my account and the Plex Communicator and/or MediaScene decides what to do about it?

My nVidia Shield is the only Plex Communication device in my Hubitat. (and is working properly within my rules)
image
image

These show a friend of mine accessing my Ubuntu server (xxx.xxx.xxx.22), which is not the IP address set in my settings (yyy.yyy.yyy.55), or the device that is set to be monitored.

Setup multiple rooms with the same devices triggering this allows separate control

Here is everything in the api assuming webhooks is being used: Webhooks | Plex Support

Is this triggering anything incorrectly? Or is it still working as expected?

Seems to be working fine. Nothing except the shield is making my lights go on or off.

But I was pretty surprised to see activity on a server that I didn't provide an IP address for.

So the webhook reports on the account level? And the Plex communicator identifies which servers or devices to use at triggers / conditions? I just don't want to ping the Hubitat with hundreds of needless calls.

It appears that way, Plex communicator will only be looking for added devices appearing in the web hook, so load on Hubitat should be minimal, unfortunately not a lot you can do as it’s just down to what Plex is sending..

Right.. So.. Information is available, but not in webhooks :tired_face:

So here is some nerd information:
If you setup a webhook here, then add that in to plex, that'll then show you exactly what your plex is sending out! https://webhook.site/, you then might need to drop that in to https://jsonformatter.curiousconcept.com/ so you can read it easily..

However aspect and pixels are not there.. That then leaves you with manually querying the server: http://[IPADDRESS]:32400/status/sessions?X-Plex-Token=[TOKEN], the token can be taken from the app by hitting the cog in the corner..

You'll then see the now playing XML, that then gives you this information below.. You can see here that height is 804 pixels but is reported as 1080p.. I'm assuming this is because cinema is 21:9 not 16:9, so really passing the ratio (width / height) would be the answer.. then you can use that to work out exactly where to adjust your blinds using rule machine.. would that work? Obviously if you are playing something that includes the black bars in the actual rip then it wont aspect correctly

<Media id="112558" videoProfile="main" audioChannels="6" audioCodec="ac3" bitrate="4372" container="mp4" duration="7026048" height="804" optimizedForStreaming="1" protocol="dash" videoCodec="hevc" videoFrameRate="24p" videoResolution="1080p" width="1920" selected="1">

1 Like

So thats really the pisser of all of it. The blu-ray box says the movie is 2.35:1, but MediaInfo and anything looking at the video file sees 16:9, which makes the whole exercise sorta moot.

Managing the screen mask is the easier part of my equation. Changing my projector's lens memory location, so it shoots the image on the bottom of the screen so I only have to mask the top, is the harder part. It requires a separate activity for the Harmony remote in order to trigger the projector. "Widescreen Movie" is a separate "activity" from "Full Screen Movie." I may have to suffer like a neanderthal and press the "Lens 2" button manually.

Thanks for the great info above. "Hey Google, Cinemascope" will have to suffice for the screen mask.

@martinez.mp3 - I finally got round to merging in your changes, I had to make a couple of amendments due to the 3 sources of events being triggered so it works with all of them, but otherwise very impressed with your work, you simplified a lot of my code too! :slight_smile:

@ckronengold - New version up on github, has resolution and aspect ratio for you, you need to enable "Get more info from server", aspectRatio will give you a decimal number for the ratio based on the actual video resolution (1920 /1080 = 1.78).. see how that works for you :slight_smile:

2 Likes

I love the idea of this app. I was able to get Plex Communicator connected and webhook enabled and mediascene sets all my switches/dimmers for media.start but not for the media.stop. I see it in the debug log as media.stop but Mediascene doesnt seem to do anything with it. Any tips or troubleshooting I can do there?

Event JSON: media.stop
…then nothing

Also any thought about doing something similar with “return dimmers to where they were before” kind of like you have for mediascene on the switches?

Solid work on both so far. Thanks!

JK, I didnt have debug turned on for mediascene. It looks like the rule may not be returning everything to the stop state because there is no media type when its stopped? Pause does seem to work, its just stop. Did I do something wrong?

[app:112]2022-01-16 12:05:28.094 am [debug] Media Scene [Theater] >> Match NOT found for media type: -
[app:107]2022-01-16 12:05:28.043 am [debug] Event JSON: media.stop

V3.1 uploaded to GitHub - now with added option that delays clearing of values on stop.

Install and turn the option on in the app, this will solve your problem..

In terms of MediaScene I'm not actively developing it and don't use it myself any longer, I've just left it there as an easy way to do simple automation. Rule Machine can do what you want though using the capture and restore functions and is much more powerful!

V3.1 fixed my problem. Thanks for the tip on Rule Machine. I’ll play around with that tomorrow and see how well I can dial it in. Cheers!