Any HttpGet smatapps or code anywhere?


(Steve ) #1

Hi all.
I’m looking for a Smartapp that will allow me to make a HttpGet request on my home broadband routers local ip of (http://192.168.0.1) and also to possibly receive the data as text.
If there’s no Smartapp does anyone know the main code i could use in a custom app that i can try and create myself.
Basically i’m wanting smartthings to connect to my router (the open status page) to find out if a certain Mac address is connected to the wifi and if it then set a simulated presence sensor to home and vice versa.
I have done this method using the android app tasker and it works great but i’ve just read today that it can be done through smartthings so hoped i could get it set up.
I’ve just tried this with Webcore and have done he HttpGet and parse Json data but then after after i’m stuck.
Any help is greatly appreciated.
Thanks


(Ron Talley) #2

Best to head over to the webCoRE community for this one.


(Steve ) #3

Thanks @rontalley
That’s my post I created that you’ve linked to on the WebCore community :slight_smile:
I didn’t seem to be getting a response and also thought I’d prefer to do a non WebCore method if I could


(Justin H) #4

Here’s a small example:

def requestUpdate()
{
    log.debug "Sending request to ${uri}"
    
    def theAction = new physicalgraph.device.HubAction("""GET /path/to/file.html HTTP/1.1\r\n Accept: */*\r\nHOST: ${uri}\r\n\r\n""", physicalgraph.device.Protocol.LAN, "${uri}", [callback: calledBackHandler])

    sendHubCommand(theAction)
}

void calledBackHandler(physicalgraph.device.HubResponse hubResponse)
{
    log.debug "Reponse ${hubResponse.body}"
}

#5

There are probably several options depending on the exact details. In particular, it will depend on how much can be preconfigured.

This one is popular, but I don’t know if it will pass all the parameters you want.

If you can use Tasker, you can generally connect that to smartthings by using the third-party app, sharptools, also very popular. @joshua_lyon Can say more about that.

And some people just use the IFTTT maker channel for simple applications, but again I’m not sure that’s a fit for your particular use case.

But I would agree, expect most people are using webcore for this kind of purpose now. :sunglasses:


(Steve ) #6

Thanks for the info guys @JHO @JDRoberts it gives me some good starting points.
I just thought If I could use SmartThings to do it instead of tasker it would make things neater and then I wouldn’t need to keep a android device on to it.