Hey guys,
im very new to smart things and have multiple apps setup. But for some reason this wont add to myapps. I followed the instructions, but im probably doing something stupid. Any help would be great.
Hey guys,
im very new to smart things and have multiple apps setup. But for some reason this wont add to myapps. I followed the instructions, but im probably doing something stupid. Any help would be great.
Hi Andrew, what error are you getting?
Also if the issue is happening when pasting the code from GitHub then I would suggest changing to raw view and then selecting all, sometimes copying in the standard view selects other stuff
I just implemented this yesterday [from the OP Github DTH and SA] and can confirm that I am getting status from multiple clients, and that it is not accepting control commands with any of them. I have verified that I can open up the Plex Remote from iOS or WebUI and control those same clients, and that they show player in the provides from the devices.xml. I really want to get rid of the polling, so I will look at Plex2Smartthings for that, but from what I understand only this system allows sending control back to it which I would like to get working (If the door is opened, Pause playback for example). Below is an example of a typical client in my list where I see status changes, but it does not respond to commands.
<Device name="Apple TV" publicAddress="xxx.xxx.xxx.xxx" product="Plex for Apple TV" productVersion="1.5" platform="tvOS" platformVersion="10.1" device="Apple TV" model="5,3" vendor="" provides="client,player,pubsub-player" clientIdentifier="ID Hash Here" version="1.5" id="79758600" token="ID Hash Here" createdAt="1478218863" lastSeenAt="1481847818" screenResolution="1920x1080" screenDensity="1">
<Connection uri="http://10.10.10.110:32500"/>
</Device>
Hi I think this has been broken for a while⦠I suspect Plex changes the API
However⦠Iāve been playing for the last hour, and I think the code currently connects to the server to control the device⦠but the documentation I have been looking at appears to refer to direct interaction with the deviceā¦
Can you try the code below⦠Iāve bodged in the code so only a stop command will work⦠so you will need to manually play, then use ST to send the stop command⦠if that works then I believe I can re-code the lot so control works againā¦
https://dl.dropboxusercontent.com/u/27382557/plexmanagercontrol.txt
Let me know how you get on⦠also note the attached code is heavily modified from the version on git hub⦠but does include a switch so you can turn off polling should you wish to poll via Plex2Smartthings/PlexPlus
Iāve just made further amendments to the code linked above⦠should hopefully all work , but let me know how you get on!
Edit: you will need to uninstall and re-installā¦
I canāt test this yet, but it looks like a minor typo on the previous (wrong line commented out). I look forward to testing this late tonight or early tomorrow. I was reading into it some as well, and I think there may be a way to pass it through the server still with including the X-Plex-Client-Identifier header for the target Player and a commandID. Hopefully you will merge the client identification information into your SA so that I do not need to manually enter it all. I also need to test that at the same time.
No there were quite a few things āwrongā, it seems some devices donāt support comms from the server for some reason⦠but give it a go and let me know if it works, no idea if Apple TV allows http control or not⦠if you end up with a * next to the device in the list it wonāt work, but not to say all without it will workā¦
When you mean my app I assume you mean PlexPlus? If so the Plex token isnāt used there itās used in the exe so you will need to obtain itā¦
Edit: Iāve re-read a few times and donāt think thatās what you mean? If you could explain?
So your latest code doesnāt work for me and Iāve been playing around with my Apple TV Client and a web browser and I have been able to pass commands that are working to control the playback states passing messages to the server.
https://server-ip:32400/player/playback/pause?X-Plex-Token=hash_here&X-Plex-Target-Client-Identifier=hash_here
I see that all the pieces are available already, it should just be a matter of putting the deviceID as an additional header in your new executeClientRequest function, but I am having a hard time figuring out how the object members work in this system. Also, my previous message was about your function named previous where you had the executeRequest active instead of the executeClientRequest.
I was having some weird issues so I started over from the OP Code, and I got the commands working now!!
See 2 posts down for github link of latest instance.
Ahh I see what you mean now! Good work on getting it working! Iāll take a proper look later in the week, Iām thinking of making a self contained DTH so commands are sent direct from the device, but not sure if a DTH can can do GET requests directly, this would provide control using PlexPlus also and no need for a separate app just for the control methodā¦
I think there is an issue with your solution though (although nothing technically wrong with your code) as I noticed while playing yesterday, the Roku stick seems to present a different ID when being added to when reporting play state! No idea why! Not sure if itās a roku issue or plex but the Plex API doesnāt seem very consistent in its implementation!
I added [Jakesā] features (sans client direct port communications) and put it here:
Good work saves me trying to work it all out
Will give it a try laterā¦
Can you un-comment the below line in your code, this is needed to identify state in some instances:
//def address = getPHTAddress(pht.deviceNetworkId);
Other than that looks good, to late to test properly, I can see in some instances that it doesnāt work to control some devices, but itās highly possible that these do not support control⦠Iāll test some of the same devices using direct control and see if that worksā¦
Also have you created a new DTH? I see you have added in the other control commands?
I have them on an in-progress DTH that I put in a new branch on my GitHub. I might have a typo somewhere, as they do not seem to work consistently, and the response is a bit slower than using the native plex app control for example. Iāve been doing my testing mostly on the aTV4, but the unit I really want to use this with is a PC in another room and that one is behaving very inconsistently. I may need to go back to trying your client direct commands, but they did not work at all with the aTV4 which is why I implemented the server commands. What is the reference that you used for sending client commands, as I donāt see it that way in the official API Docs I was looking at?
So your code seems to work with Plex Media Center (No longer supported by Plex) I think⦠but doesnāt work with the Windows 10 App that replaced itā¦
But I donāt think works with Roku, which mine did, but I donāt think there is a single answer, some things work with one method and some with the other method⦠I think generally the API is a bit of a mess, with no consistency⦠including Plex owned apps not reporting full capability!!
Iāve just spotted I uploaded the wrong version of my code as still has some values I was using to test⦠Play/pause/stop are triggering the wrong actions⦠but also the playpause toggle in the original version or mine doesnāt appear to toggle, so need to add some code fort this too, based on current device state I would assumeā¦
I was referencing the below documentationā¦
Looks like a fun āfree timeā activity for later this week or next. Iāll add this a setting to the DTH, and dot append it after the command to be parsed by the SA, as each device may need different settings. Since the official Plex API suggests that Server Comms is the directive, I suggest that if no value is set, Server Commands should be assumed. I wish I could send the commands from the DTH directly instead of bouncing them to the SA to handle,
input name: "CommandTarget", type: "enum", title: "Command Target", options: ["Server", "Client"], description: "Select Command Target", required: true
I think the passing will need to be like this:
sendEvent(name: "switch", value: device.deviceNetworkId + "." + command + "." + $CommandTarget);
Sounds good mate, let me know if you make a start on this, otherwise Iāll give it a go over Christmasā¦
Whatās stopping you doing it in the DTH though? Are sending get requests restricted?
Love the app so far! Thanks for making this. Couple of questions I have:
Iāve noticed a delay in status for playback. Seems to be about 10 seconds after I pause the movie that it changes status. Is this by design or is there to make this more instant?
Regarding CoRE integration. I see that in the log of Plex HT Manager it mentions āplayback typeā Do you know of a way I can integrate that into CoRE so that it only dims light if āplayback typeā is movie?
Thanks again!
EDIT: I see question 1 was answered a couple of times.
The event you would need to pull is playbackType, but I donāt know if that is something CoRE can pick up on, probably worth asking in the CoRE queries threadā¦
The alternative is to use PlexPlus⦠you can add the plex HT device in here and it already has the logic to be able to determine media type and adjust lights accordingly⦠you donāt have to use the exe in this case you can just add the device you created in this app in to Plex Plus⦠however if you do use the exe then the latency can be much lower between state changes as the polling takes place external to smart thingsā¦
Hi,
I am curious why the app is picking up all of my devices (phones, tablets) but not the Plex server on my pc.
If i choose Show all devices regardless of Capability it shows my PC. Im am reading through the thread but just curious on the logic.
Also, I am getting an unknown error when trying to save Plex Manager. It happens after i save it (if confirms then throws up an error).