@ChristianH I aslo thank you for your work on this! My VB setup isn’t quite up so I’ve been using the .exe from here:
(which works well)
Couple of things I’ve changed for those of you who might be interested
Since this app is only dimming bulbs I expanded the capability to look for bulbs that can be dimmed instead of just bulbs which support colour.
-From: input “hues”, “capability.colorControl”, title: “Which Hue Bulbs?”, required:false, multiple:true
-To: input “hues”, “capability.colorControl”, title: “Which Hue Bulbs?”, required:false, multiple:true
Next, I wanted to set the app up to be able to be focused to a single player
In the configuration section add: input(name: “bPlayerName”, type: “string”, title: “Which Plex Player? (blank means all)”)
In OnCommandRecieved() add an iff around the commands:
So everything is working great but here’s my To Do list if anyone has input:
The .exe doesn’t appear to catch/send onStop events. Not sure why.
Ideally I’d like to make the monitor program a plug-in for Plex. Haven’t tried making a Plex plug-in, but it appears to be able to run python scripts so I think there’s hope for this.
I’d like to have multiple bulb set + PC combinations. Ya, I could have multiple sets but that seems ineloquent.
I’ve updated the exe & smartapp with some changes:
Dimmers were added to the script by Sb87 some time ago
The exe now reports when media types changes so it can notify when trailers are playing, and an option is addded in the smartapp to treat trailers/clips as pauses (I don’t have plex pass so haven’t tested it).
Added support for up to 5 rooms in the script. Each room can have up to 2 plex player names that triggers their room, and they each have their own device settings. (Or set the name to * to match any player)
The script is a bit messy at the moment since I couldn’t get anything but input devices to save in a loop. So if any groovy experts knows how to do it please tell
E.g. this won’t save:
for(int i = 1; i <= 5; i++) {
section("Devices (room #$i)") {
input(name: "playerA$i", type: "text", title: "Plex player name", required:false)
}
}
Thank you for the awesome work. Would love a linux compatible client but as I am no coder myself I wouldn’t know the first thing at converting your app over to java or some other runtime. I can write bash scripts but well setting a script up to execute every second just seems counter productive.
@ChristianH !?!?!?!?! This is great! I tried out the new trailers function and it works perfectly. It dims the lights just as you would when pausing other content. I’ve set up one room/player so far. To confirm that it was working properly I started a movie on the room #1 player and then started and paused a movie on my phone. It ignored the pause status from my phone and kept the lights off. I just need to set up the other players/rooms and it’ll be perfect! Thanks again for your work on this smartapp.
Great work and glad to see a Plex community on here too.
I’d love to get launch, pause, play, and exit working and tied to momentary tile buttons. Tie these to Alexa and we’d have voice control for Plex!
Rather than have smartthings pars the state of plex, why not have smartthings send commands to control plex? Much easier to tie in lights and any other effects in afterwards too. Any thoughts?
I do have one question. In the GitHub instructions you have the user copy down the OAuth information
Note down the OAuth client id and secret. You will need both of them for later.
but then there is no instruction on where to use it. I see the OAuth section in the code that’s copied to SmartThings, but in your screen shot it was not changed. Where is this to be used?
Also, since if you set Hue bulbs and dimmers both in one room, they have to be the same dimness. Can you set up room 1 with the player name and the dimmers and room 2 with the same player name and the Hue? I want them both at drastically different dimness levels.
This is a baptism of fire for me TBH, I’ve had the hub for one day, and don’t even have my hue bulbs yet, but have managed to install your script on the hub, but looking at the settings there are options for the “Modes” but not for the routines?
Looking at the use cases for each, modes are defined for the state of the home or site, and routines for an action limited to a room or subset of rooms? The problem that I’m anticipating is that I want to create a “scene” so the main lights will turn off and some lamps will turn on, which I assume would be easiest by creating a routine, then triggering the routine from this script? I wouldn’t really want to change the mode as I was looking to use the mode to control the state for security purposes…
Am I just over complicating things here? What’s the cheeky chance that the code could be updated to accommodate?
Sorry I’ve been quite busy with work and other things lately:|
@TheFuzz4 It should be quite easy to port the code over to Java, but I wouldn’t have the time to keep both c# and java projects in sync atm
@thexder Np, glad it worked! Got to get myself plex pass as well and test it hehe
@Tutu Hmm I might look into it later, but atm the integration is from Plex to SmartThings only since I always need to manually select what movies/episodes to watch, and the lighting can just follow. I do like the idea of having voice commands though
@sraptor I don’t have the time for a youtube video atm, but the endpoints should be visible if you open the smartapp from within the smartthings app, and on the first page there should be a section called “API Information” that you can click to view the endpoints and token
@asujosh1 Thanks:) Hmm indeed, the OAuth might not be required anymore. I used it in the beginning when experimenting and don’t think it’s needed now. I’ll try to remember to update the docs. I like the idea of triggering multiple rooms at once, at the moment it only triggers the first one but it should be easy to change if you edit the groovy script and change e.g. the code in getRoomIndexFromPlayerName(…) to return an array of all the matching room indices and then just loop thrugh them
@Entityxenon Thanks Good point, I didn’t think of the routines since I haven’t used them that much yet but I can see that it would be useful I’m not home atm to test it but I added support for routines and fixed a bug in the changing of modes. I’ll commit the fix (if it works that is) in a few:)
Look forward to the update and thanks for the speedy response! One more feature request if you think there is demand for it
I’m thinking that there will be instances where perhaps I want to leave the lighting on… in which case would it be possible to add a pre-requisite, such as a switch being on or being in a certain mode… My preference would be a switch being on, then I would just create a “simulated switch” to toggle on and off, but I expect others may use modes!
Again great work and appreciate you have a day job
I think my suggestion may have been a waste of your time… I don’t think this actually achieves what I’m looking to do, either your app would need to be able to set a scene, or would need to trigger the lighting director app and a scene stored in there I guess, but no idea how you could actually do this… I think I need to have more of a play tomorrow… And sorry if I’ve wasted your time… I need to try and set some time aside and learn to code groovy myself I expect so I can try and map something together…
@Entityxenon No worries:) Pretty much anything is possible, what’s that lighting director app? Anything with an open API? And it’s absolutely worth getting into groovy if you’ve got the time
Will have a play this evening after work, having only had smart things for a few days, just finding the architecture quite odd and limiting, setting a scene you would think would be a basic functionality…
The app I mention is a smartthings smart app, but not sure you can trigger app to app?
Haven’t tried communicating between apps yet, but I’m quite sure the smartapps support http get/post. And since they also have http endpoints they can at least communicate that way:) There’s probably a more effective way though, got to research that a bit later
So trying to get some basic sense of SmartThings and how it works and an architecture, and made the below diagram.
So what would make sense would be that routines were made more configurable and also triggerable as standard, but that is unlikely to happen any time soon at least, but this would provide “scenes” if introduced…
So that leaves you with two options, create a scene in another SmartApp and work out how to trigger, which could break things if code on the target app changes or option 2 introduce the customisation in to your own app, which would make it more complicated, but probably the “right” solution based on the architecture.
Personally looking to control Hue lights, so ideally triggering a hue scene would be better, there is another Smart App that could be adjusted to accommodate I expect…
And one more post… The new rule machine smartapp that’s just been released could actually make customisation and control of this app much easier… Create a dummy switch set your app to toggle it, then the rules engine could then do the control of lights etc… Just thought I’d mention it…
That’s a good idea. I’m gonna give it a try when I get home. Still not fully practical for me yet since it doesn’t catch stop media states.
EDIT: Didn’t know how I was so out of it as to not realize that Plex Home Theater is an old player and Plex Media Player (PMP) is the most current. Stop state catches fine with PMP. I am happy now.
Hello. I tried your app a while ago, and I thought it was cool, but didn’t pursue it because we use Plex in multiple locations in the house and I wanted to be able to tell them apart. I’m pleased to see that’s included now! Unfortunately, I can’t seem to get it to work this time.
I am running Plex Media Server on a Mac, but I think I’ve compiled the C# code successfully. I used Xamarin Studio and Mono. I can run it in Terminal on the Mac that hosts PMS.
If I run it as ‘./plex2smartthings d2’ then I do get a bunch of debug info in terminal showing the state of what’s being played. But I have yet to be able to get ST to respond to that.
At first, I entered a client name in the smartapp config, but I’ve also tried using * in the client name field to see if I can get it to respond.
I turned debugging on in the smartapp, but I’ve been watching the ST log page and the only thing that shows up is when I change settings in the smartapp.
Any ideas?
When running the app in terminal without the d2 flag, I don’t get any status at all. Is that normal? I wasn’t sure if the regular mode should show any kind of status. It just says:
---Plex2SmartThings---
-Loading config..
>Loaded
-Connecting to plex.. Please stand by..
>Ready and monitoring.
(Click enter to quit)