So my hub turned up today and have been starting work to port over Plex integration.. I've got most of the wrinkles ironed out apart from being able to receive status updates from plex..
My code is below and I receive the error "java.lang.IllegalArgumentException: Text must not be null or empty on line 358 (plexWebHookHandler)"
Pulling "params" out to logging only responds with access_token=xxxxxxxxxxx, so no payload appears to be being passed back like I would get in SmartThings..
Any ideas or help welcome..
import groovy.json.JsonSlurper
mappings {
path("/pwh") { action: [POST: "plexWebHookHandler"] }
}
def plexWebHookHandler(){
def jsonSlurper = new JsonSlurper()
def plexJSON = jsonSlurper.parseText(params)
//do some stuff here
}
Just out of curiosity, what are you trying to do with Plex through Hubitat? I am a heavy Plex user being that we only have DSL available and use 4ktv's, but never thought about integrating it with Hubitat. I have a Synology DS918+ that I use as a whole house Plex media server.
Basically it creates a device for every Plex device and passes playstate and media type... you can then use it to control your lighting when a film starts etc.. and bring the lights back up when you pause or stop
do you know what the headers are that the plex server is sending? I'm thinking the content-type is either not set or not set to something we recognize. I'm going to put in a ticket for us to add request.body to return the raw body from a request and you should be able to access it that way. unfortunately that means you need to wait until we can get that added unless you can configure the Content-Type header in the request.
No ETA on the multpart parsing. But we did add the raw body to the request. Perhaps you can parse what you need that way? if you are on the latest build, you can use "request.body" to get it