[Release] Plex Communicator V3

Did you try disabling and re-enabling after?

Otherwise according to the Plex docs you can just append your auth token to the end of your password and it should work

Oh... No I haven't. I just figured it would break like most other authentications do when you enable 2FA. I'll give it a try.

And by appending the token, you are referring to the 2FA token and not the Plex API token, correct?

Hey! Me again. I updated my Hubitat and mediascene started not working again so I decided it was time to move over to Rule Machine. I have the rules set for play, pause and stop but cant figure out how to set the conditions for media type. This is probably super obvious but any pointer on where to get to media type?

Correct, just add your 2FA code to the end of the password, let me know how you get on!

1 Like

Select "Custom Attribute" on your trigger event, then select your plex device, then it'll give you the attributes you can use

TY. The communicator is still working after turning 2FA back on.

1 Like

Hey jebbett, Thanks so much for the awesome automation coding. It all works smoothly until I play a movie from a shared library. Until I'm able to do a hardware upgrade, I primarily watch movies on my friend's shared movie library which is massive. I noticed that this automation only works for local files and not those that are linked/shared to plex. From my observations, I would say that the cause is that the Plex Communication Device is unable to read that aspect of PLEX and/or PLEX isn't as forthcoming with shared library file metrics. Do you think it may be possible? If so, I would say a nice donation is in order for it. I'm currently looking into other resources like PlexAPI webhook sources, control4, etc to resolve this issue.

This is server based not client, so your Plex server likely has no visibility of any content you are streaming from another server.

I recently switched over to Hubitat from ST for Plex Communicator. Thank you jebbett! I am trying to figure out rule machine to achieve my previous configuration on ST that used Mediascene. I am mostly there, however I cannot seem to figure out the pause configuration. Here's a screenshot of my rule setup, when watching a movie/tv show, hitting play works correctly, pressing stop works correctly, but pressing pause does not. When I watch logging, pressing pause does not seem to log anything within the rule machine logs, however plex communicator does show "Event JSON: media.pause", "Event JSON: media.play", and "Event JSON: media.stop".

I am sure I am missing something simple, but the rule never seems to pick up that the playback state has changed to paused. Any help would be much appreciated!

Hey, no problem, please check the device logs to see if it hit's the "paused" status when pausing.. if so then the issue is not on my side.. Just tried here and the device is showing paused as expected..

Also otherwise you can grab Media Scene here, which I also ported across:

Here's the logs from rule engine, it doesn't seem to pick up the paused state from plex communicator, there's also associated logs from plex communicator. Because plex communicator shows the pause state, but rule engine doesn't capture it I assume I am missing something somewhere.

If I pause what's playing, and refresh the rule, it does show that the status of the plex device is paused, just rule engine never detects the change in state to/from pause.

I gave mediascene a go, but it gives me an issue with the below logs, mediascene doesn't seem to be able to detect media type. I listen to a lot of music through plex and only want to change states if watching a movie or tv show. Oddly, mediascene does detect the paused state, but as it doesn't pick up the media type, it doesn't turn off/dim lights initially. So it brought me over to rule engine and the problem at hand :frowning:

** Logs **

Rule Engine:

app:172023-02-20 12:13:58.093 PMinfoAction: END-IF
app:172023-02-20 12:13:57.928 PMinfoAction: Restore: Coffee Table, Theater Left, Theater Right, Theater Floor 1, Theater Floor 2
app:172023-02-20 12:13:57.925 PMinfoAction: IF (HTPC-PlexKodiConnect status(stopped) = stopped(T) [TRUE]) THEN
app:172023-02-20 12:13:57.892 PMinfoAction: END-IF
app:172023-02-20 12:13:57.889 PMinfoAction: Dim: Theater Left, Theater Right, Theater Floor 1, Theater Floor 2: 25 --> fade: 1 (skipped)
app:172023-02-20 12:13:57.887 PMinfoAction: Adjust: Coffee Table by +24 --> fade: 1 (skipped)
app:172023-02-20 12:13:57.885 PMinfoAction: IF (HTPC-PlexKodiConnect status(stopped) = paused(F) [FALSE]) THEN (skipping)
app:172023-02-20 12:13:57.859 PMinfoAction: END-IF
app:172023-02-20 12:13:57.856 PMinfoAction: Off: Theater Left, Golden Pothos, Theater Right, Theater Floor 1, Theater Floor 2, Snake Plant, Coffee Table Lamp (skipped)
app:172023-02-20 12:13:57.854 PMinfoAction: Dim: Coffee Table: 1 --> fade: 1 (skipped)
app:172023-02-20 12:13:57.852 PMinfoAction: Capture: Coffee Table, Theater Left, Theater Right, Theater Floor 1, Theater Floor 2 (skipped)
app:172023-02-20 12:13:57.849 PMinfoAction: IF (HTPC-PlexKodiConnect status(stopped) = playing(F) [FALSE]) THEN (skipping)
app:172023-02-20 12:13:57.773 PMinfoTriggered: HTPC-PlexKodiConnect reported playbackType(-) ≠ track
app:172023-02-20 12:13:57.750 PMinfoEvent: HTPC-PlexKodiConnect playbackType -
app:172023-02-20 12:13:15.248 PMinfoAction: END-IF
app:172023-02-20 12:13:15.245 PMinfoAction: Restore: Coffee Table, Theater Left, Theater Right, Theater Floor 1, Theater Floor 2 (skipped)
app:172023-02-20 12:13:15.243 PMinfoAction: IF (HTPC-PlexKodiConnect status(playing) = stopped(F) [FALSE]) THEN (skipping)
app:172023-02-20 12:13:15.217 PMinfoAction: END-IF
app:172023-02-20 12:13:15.215 PMinfoAction: Dim: Theater Left, Theater Right, Theater Floor 1, Theater Floor 2: 25 --> fade: 1 (skipped)
app:172023-02-20 12:13:15.212 PMinfoAction: Adjust: Coffee Table by +24 --> fade: 1 (skipped)
app:172023-02-20 12:13:15.210 PMinfoAction: IF (HTPC-PlexKodiConnect status(playing) = paused(F) [FALSE]) THEN (skipping)
app:172023-02-20 12:13:15.181 PMinfoAction: END-IF
app:172023-02-20 12:13:15.039 PMinfoAction: Off: Theater Left, Golden Pothos, Theater Right, Theater Floor 1, Theater Floor 2, Snake Plant, Coffee Table Lamp
app:172023-02-20 12:13:15.019 PMinfoAction: Dim: Coffee Table: 1 --> fade: 1
app:172023-02-20 12:13:15.003 PMinfoAction: Capture: Coffee Table, Theater Left, Theater Right, Theater Floor 1, Theater Floor 2
app:172023-02-20 12:13:15.001 PMinfoAction: IF (HTPC-PlexKodiConnect status(playing) = playing(T) [TRUE]) THEN
app:172023-02-20 12:13:14.924 PMinfoTriggered: HTPC-PlexKodiConnect reported playbackType(episode) ≠ track
app:172023-02-20 12:13:14.901 PMinfoEvent: HTPC-PlexKodiConnect playbackType episode

Plex Communicator:

app:122023-02-20 12:13:57.607 PMdebugEvent JSON: media.stop
app:122023-02-20 12:13:57.605 PMdebugAccount JSON: [id:11531015, thumb:https://plex.tv/users/<OMITTED>, title:<OMITTED>]
app:122023-02-20 12:13:57.603 PMdebugPlayer JSON: [local:true, publicAddress:<OMITTED>, title:HTPC, uuid:<OMITTED>]
app:122023-02-20 12:13:57.600 PMdebugMedia Type: episode
app:122023-02-20 12:13:51.504 PMdebugEvent JSON: media.resume
app:122023-02-20 12:13:51.498 PMdebugAccount JSON: [id:11531015, thumb:https://plex.tv/users/<OMITTED>, title:<OMITTED>]
app:122023-02-20 12:13:51.495 PMdebugPlayer JSON: [local:true, publicAddress:<OMITTED>, title:HTPC, uuid:<OMITTED>]
app:122023-02-20 12:13:51.493 PMdebugMedia Type: episode
app:122023-02-20 12:13:30.097 PMdebugEvent JSON: media.pause
app:122023-02-20 12:13:30.095 PMdebugAccount JSON: [id:11531015, thumb:https://plex.tv/users/<OMITTED>, title:<OMITTED>]
app:122023-02-20 12:13:30.092 PMdebugPlayer JSON: [local:true, publicAddress:<OMITTED>, title:HTPC, uuid:<OMITTED>]
app:122023-02-20 12:13:30.090 PMdebugMedia Type: episode
app:122023-02-20 12:13:14.765 PMdebugEvent JSON: media.play
app:122023-02-20 12:13:14.760 PMdebugAccount JSON: [id:11531015, thumb:https://plex.tv/users/<OMITTED>, title:<OMITTED>]
app:122023-02-20 12:13:14.757 PMdebugPlayer JSON: [local:true, publicAddress:<OMITTED>, title:HTPC, uuid:<OMITTED>]
app:122023-02-20 12:13:14.754 PMdebugMedia Type: episode

Mediascene:

app:422023-02-20 12:24:57.843 PMdebugMedia Scene [Theater] >> Stopped
app:422023-02-20 12:24:53.194 PMdebugMedia Scene [Theater] >> Paused
app:422023-02-20 12:24:37.891 PMdebugMedia Scene [Theater] >> Match NOT found for media type: -

In which case your issue is with your rule on RM.

Make sure your trigger is correct, but otherwise you’ll need to check with them.

That would be the problem, I just did a little poking, I have it working now, thanks again!

1 Like

Hello there! Thanks for the plugin - I'm trying to get it to work but I'm having a hard time. This is what I've done so far :
I installed the Drivers and App from github.
From the Plex Communicator App I was able to Select my Device, Enter my Plex information and select Local Connection Method. Also turn on Enable Debug logs and hit done.
Copied the webhook from Hubitat and created a new webhook in Plex and paste the URL there.

In Devices I can see my device but nothing is showing up as status.

Here are some of the logs I'm seeing from Hubitat:

java.lang.NullPointerException: Cannot get property 'type' on null object on line 436 (method plexWebHookHandler)

2023-06-10 09:33:35.826 PM[error]got error # 404 Not Found

2023-06-10 09:33:35.824 PM[debug]processCallBack

2023-06-10 09:33:33.907 PM[error]got error # 404 Not Found

2023-06-10 09:33:33.883 PM[debug]processCallBack

2023-06-10 09:32:44.360 PM[debug]Parsing plex tv/devices xml

Any help would be much appreciated! :slight_smile: Thanks again!

Well, it's been almost a year since the last post, but is there any way to make the lights come back on when the movie ends, and the screen minimizes and plays the credits? I have to stop playing it completely to bring the lights up, but I want them to come back on dimly during the credits like in the theaters. Is this possible? I'm not sure how Plex reports playback status during credits, so maybe it's just a programming limitation.

As an experiment I'd keep an eye on all the states in the driver and see what changes when the movie ends.

1 Like

Do you have Plex pass? If the answer is no then the metadata isn’t created.

Otherwise I think it’s possible but would need a code update, hopefully Plex passes it as a play state, but I’m not optimistic, and if that’s not the case then it becomes a fair bit more complicated.

If I get some time later I’ll have a look

I do have Plex Pass. That was my thought too, I don't know if Plex will even see it, or if it's the client that sees the credits and minimizes the video. Since Plex recognizes the credits, I'm hopeful, but doubtful.

So, just checked the webhook and there's no trigger at the point the credits start and no information in the webhook data (you can see this data using webhook.site).

I also checked the data at http://[IP]:32400/status/sessions?X-Plex-Token=[token], also no info found there or in /library/metadata/[filmid]..

Plex API docs are useless, so it's possible the timestamp exists somewhere, if it can be found then could be used, I know the 3rd party Plex Python API exposes it, but you'd still have to calculate the time when it happens

Well that's a bummer, no biggie. Thanks for checking! I'm not a programmer so I'll find a convenient workaround.