SmartThings synchronous GET webservice call

Hi, Im trying to call a web service on my local network from within a SmartThings SmartApp. However I cannot seem to get this to work. The call needs to be a GET. I have tried using HttpGet but I get an error saying the address is blacklisted ( its a local IP and I have read that you cant do this with HttpGet ). So I have tried with physicalgraph.device.HubAction. I cannot get this to work either. Is there any ways of doing a synchronous get as I need the response as part of the method that is executing.

The HubAction code is as follow:

def result = new physicalgraph.device.HubAction(
method: “GET”,
path: “”,
headers: [“Content-Type”:“application/json;charset=UTF-8”,
HOST: “”,
] )

    	logInfo( "$e" );
		sendNotificationEvent("Exception occurred: $e")

The parse method is never getting called. Even if I did get this working, has anyone any ideas of how I could use it in a more synchronous way.



Welcome to the SmartThings Community, @stevepb!
Where are you creating the SmartThings app? physicalgraph.device.HubAction is a function of the legacy platform (IDE)
I suggest you use the SmartApp Node JS SDK instead, which is part of the current Developer Tools. Here’s a tutorial on how to create a simple SmartApp that can help you get started.

Also, you can provide more details about your integration so I can give you other recommendations. :smiley:


That wouldn’t work for a local device AFAIK. Is there an API for connecting with a local lan device via the hub?

Try adding the callback property to be the function call and specify your callback handler ?make it’s scope of globally accessible and not a private callback) and it should call the callback. I’ve found it more reliable than parse.

You might take a look at the following. It uses the new edge driver platform. But I don’t think GETs are quite working yet. (The topic title is a clickable link.)

GETs are working, in that they execute; I’m still figuring out what to do with the returned data. Right now my direction is to just plunk it into a string attribute for display in the mobile app. You can do an equals comparison in Rules against it, but it has to be against the entire string; there are no substring or ‘contains’ type of compares in Rules right now.