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: āhttp://192.168.1.123:3000/bcloudsmart/tadoā,
headers: [āContent-Typeā:āapplication/json;charset=UTF-8ā,
HOST: ā192.168.1.123:3000ā,
] )
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.
2 Likes
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
3
That wouldnāt work for a local device AFAIK. Is there an API for connecting with a local lan device via the hub?
RBoy
(www.rboyapps.com - Making SmartThings Easy!)
4
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.