SmartThings Community

[RELEASE] PlexPlus - Control Lighting with Plex Play Status

When I go into the PlexPlus app on my phone and click API Information I get an error. It says “AccessDenied, This request is not authorized by the specified access token”. I used the API information I got from the live logging function when I setup the config.config file. I have enabled oauth in the IDE so not sure why I am getting this error from the app? Especially since I am getting API info from the live logging.

I assume you are in the US, if not do you get the same error on the other option?

Also have you enabled OAuth in IDE as mentioned in the instructions? I expect this is your issue?

Yes I am in US. But I get the same error for the US or the EU API Info options.

I’ve updated the code to fix the icon issue and a minor change that I though might be causing your issue… however a quick test didn’t replicate your issue… and unfortunately as I only have access to the EU version, I can’t replicate your issue?

Try completely removing the app from your phone then from IDE then re-adding with my updated code…

Enable OAuth then publish the parent…

If that doesn’t still work in the app then, go in to the app enable debugging, bring up live logging in IDE and press done in the app again it’ll then return your app ID and token in live logging instead…

I still have the same issue. But the icon works now :slight_smile:

I can get the app ID and token from live logging but when I use those values in the config.config file I get the forbidden error from the plex server app. I am going to try factory resetting my hub and reinstalling again later tonight.

Will let you know how that goes.

Shouldn’t be a hub issue, as it should link to ST servers, I’ll try to break mine to see which issues return the same error…

Check out point 2.E - I think you need to add your Plex authentication token in to the config.config file, I can replicate your issue by removing it from my config file…

Alright I figured it out. The US API URL is wrong, or at least for me it is. I changed this in the smartapp code, and in the config.config file and everything works perfect now!

If anyone else is having issues with getting the API info to work, check the URL you use for your IDE. You may have to change this depending on your location.

This is the correct URL for me:

Thanks for the help and quick responses! So happy to have this working now.

Cheers for figuring it out! Will update the code to account for it, seems they have introduced regions in the US probably to reduce latency, so will need to find out all they have in use

v2.7 - Added USA West API Info due to new data center and also added App ID and Token independently in case new servers are introduced in the future.

Updated the guide with some debugging / problem solving tips

Thanks @DarkProjects for spotting the new server farm being used!

Any chance for a feature request ? When you stop playing, have an Optikn to set two modes one for day and one for night? Right now I solved this (with advice from here ) by using rule machine. But it’s no longer stable.

Hi Joel, That would be quite a significant change and would still essentially replicate what rule machine can do already… What rule do you currently have setup in rule machine? Are you triggering this rule based on change in mode? I know that there have been some issues in the past with mode triggers, if this is the case I would suggest setting up a virtual switch in IDE and then setting a rule based on that switch changing, this should be a little more reliable…

1 Like

I am guessing that Joel wants the ability to control when “return to previous state” option is enabled based on mode. For that couldn’t you add a “only when mode is” like the Smart Lighting app has?

I’ve been having a separate conversation with Joel about this privately… I think a big part of his problems are the platform stability issues that are currently taking place…

I do like your thinking though… although again I think that this app shouldn’t own “normal” lighting levels…

To avoid lack of duplicate code and also settings the way my setup works is that a virtual switch is triggered, and a couple of rule machine rules exists behind this to then check the time of day and the brightness to be set… that way Plex, my movement sensor and a physical switch all trigger one virtual switch and one set of code and settings to set the lighting level… If you then want to amend the default lighting level you only then amend in one place?

In fact you could achieve this with the SmartLighting app, setting a switch as the trigger… you wouldn’t need to change any code in the Plex App…

Ah ok, that makes sense, probably much better than how I wanted to do it.

I haven’t had stability issues yet, so I was thinking he just wanted more control over the lights.

Could you provide all the different options available to be changed? I am having a hard time finding all the possible variables. Thanks

Also, when I try to run the EXE on a windows 7 64bit pc, it says that it is not compatible. Am I doing something wrong?

Hi Dom,

I don’t understand the question? I assume you are talking about the variables in config.config? If so you only need to configure those that I have specified in the guide…

With regards to the EXE, it sounds like you perhaps have a corrupted download, I’m running it on W7 64bit and 32 bit without any issues, when I get home later however I’ll re-package all of the files in to a single ZIP file, I’ve noticed that the BAT files are also linking to the old EXE not the new one…



This is what I was referring to. I’m not sure what else there is to configure.

Cheers, other than the endpoints for ST the below are the only other two variables you really need to worry about:

The interval is probably about right for most cases, and the status URL should be fine if you are running on the same computer as Plex, otherwise need to re-name to the computer name…

checkInterval=“2” c="the interval is in seconds"

I’ll spend some time later updating the guide in more detail, as a lot of the content was just copied from Christian’s guide.

Thanks for clearing that up.