Plex + Smartthings

Ahhhhhhh nevermind! The app never finished installing. Once it made it through it brought the simulator out.

Ok, I think I have everything set up right - I am getting no errors, the status of plex changes in the .exe window but nothing changes with smartthings - iā€™ve tried lights, switches, anything and nothing changes. I am on hubv2 does that matter? What else can I look into?

Thank you so much!!

Try looking at live log in the ide to see if you have any logging or error. Possible you have the wrong token on your switches?

Here is what is showing in the IDE live log - It looks like its only setting HUEs values but I donā€™t have any hues linked to it yet - I have 2 switches thoughā€¦

Thanks!

Seems I had set the notifications here to tracking instead of watching, so hereā€™s a bit late reply :smile:

There was a missing null check when the script sets the hue levels, and since you havenā€™t linked any in yet it sends null which then seems to fail.
Also there was no logging from the method that toggles the switches, so it most likely just failed at switching the hues and never got to the part where it toggles the switches.

Iā€™ve updated the SmartApp script here with the fixes:
https://github.com/TehIMP/Plex2SmartThings/blob/master/SmartApp_Source.groovy.txt

Very interested in this, does this only work with PC PMS?

The application requires dotnet so as it is now itā€™s only running on windows, but you could:
-Compile the code through Mono (Linux, Windows, Mac). http://monodevelop.com
-Run Plex2SmartThings on a windows server and set it to connect to plex on another server.
-Run it on linux through Wine.
-Port the code to java since itā€™s pretty similar to c# :smile: (Linux, Windows, Mac)

That worked perfectlyā€¦well except dimming didnā€™t, just on/off but Iā€™m pretty sure thatā€™s my fault on how I have mine set up.

So here are a few requests - I know zero programming so not sure if this is possibleā€¦

First, not sure if the lights are supposed to slowly dim or just hit their level fast - would love slow dim on and off.

Plex now has the option of adding trailers in front of your movies and then an intro screen, like a Dolby video or welcome to our theater type thing. Iā€™d love to have the lights dim to 50% when the trailers start and then when the actual feature starts turn off the lights slowly. In plex you can set the number of trailers (up to 5 I think) plus an intro screen.

I think thatā€™s all I have!

This is really great work, thank you for doing what you do!

I love making things like this, so Iā€™m glad you like it :smile:

The script doesnā€™t attempt to dim the lights over time, at the moment it just sets the hue level/switches instantly. Iā€™ll see if I can add it to the script soon.

I havenā€™t tried using the Plex trailers yet, but Iā€™ll check if the Plex output differs between the trailer and the actual movie/episode and if it does it should be possible to implement.

1 Like

Trust me I love plex enough to spin up a vm on my Macā€¦ But maybe Iā€™ll wait to see how your app evolves. Major Kudos though. Any screenshots?

Hehe yeh plex is pretty awesome :smiley: Itā€™s not much to take a screenshot of since itā€™s running as a console application at the moment to keep it as simple as possible.

Well Iā€™m interested in what this looks like on the client.

The only client is the console application, and this is what it looks like on my server atm with some extra debug output enabled.

It seems the ā€œMode when playingā€ and ā€œMode when pausedā€ are flipped? After I realized that, those two features worked fine.

However, I canā€™t seem to find out how to set the media state to ā€œstopā€. The only thing I found that works is exiting out of Plex and waiting a couple minutes. How is this intended to work by design? I think it would be nice if exiting out of a video and back into the Plex interface (with the ā€œescā€ key or similar) would be awesome.

Nice catch, the play/pause modes were indeed flipped around and I just committed the fix :smiley:
As soon as a media is not playing or paused it should be set to the stopped state. So it is supposed to work like you said, e.g. for me it enters the stopped state as soon as I return to the plex interface.

Some things that may delay it is if you have defined a delay in the config file (e.g. ), or if youā€™ve set the checkInterval to a higher value.

You can compare the plex status page http://localhost:32400/status/sessions against the output of the plex2smartthings application. If the status page goes blank and the application isnā€™t changing state to stopped, then it might be some issues with caching I have to look into.

When media state is play and it is stopped, both the status page and the media state reported by application remain in play.

Tried getting the stop state to trigger but with no luck. Any tips on how I could get it working?

I am new to ST and Coding in generalā€¦I want to use something like this to be able to work with plexconnect (a python script running on my media server) to do some of the same functions like ,
1.when in TV menu , Dim lights in several areas
2.when playing tv show in tv mode , dim lights even more
3.When in Movie menu, dim lights in several areas
4.When playing a movie, take lights all the way down and prevent them from being turned on by motion (superceed any other motion activated lighting) and then if paused , lights go back up to a dim lightā€¦

I have a ge dimmer in 1 switch and the rest are all on GE , Cree or TCP bulbsā€¦

@Pete If the plex session page isnā€™t updating when stopping media, the only logical explanation for it I can think of is that the page gets cached somehow. You can try a forced refresh (Ctrl+F5) or opening a incognito/inprivate browser tab to force the browser not to use the cache and see if the session page is updated when the media is stopped.

@Brandon_Mitchell
1 & 3: It would be awesome having states for being in a specific menu, Iā€™ll look into it and see what info is possible to get out of plex :smile:
2 & 4: Filtering between tv-shows and movies can be done by tweaking the smartapp source, since it recieves the media type. You could then check if itā€™s a movie playing and make smartthings change to a movie-mode where motion sensors wonā€™t turn on the lights.

@ChristianH Thank you so much for this app. I set it up a couple of days ago and love it.

I think a cool feature would be player specific bulb assignments. This would be useful for players in different areas of your house (living room, bedroom). I would imagine that it could be done by also running multiple instances of the app with user/player specifics in the config.

FYI, trailers use an item type of ā€œclipā€ if you hadnā€™t looked into that function yet.