HTTP Request/POST


(Haissam Mayasi) #1

I was wondering if someone can share code for having an HTTP string sent to the smartthings hub and it can turn on or off certain lights depending on the URL. Ultimately, this would allow me to control things with my smart watch. I’m just having difficulties in getting started. Any help would be greatly appreciated.

Thanks.


(Geko) #2

There’s no such thing as “having an HTTP string sent to the smart things hub”. The only way to communicate with the hub is through the cloud. Search for “HTTP endpoint example.”


(Ben Edwards) #3

This:

http://docs.smartthings.com/en/latest/cloud-and-lan-connected-device-types-developers-guide/index.html

and specifically:

http://docs.smartthings.com/en/latest/cloud-and-lan-connected-device-types-developers-guide/building-lan-connected-device-types/building-the-device-type.html?highlight=http%20request

may help.


(Kevin Tierney) #4

I am having trouble finding the original links from the old site, but what you need to do, is go to this site https://labs.smartthings.com/exampleOauth.php (you’ll need to create a developer account if you havent already)

Once there you’ll authorize the app and then select which switches you want to control. After you have authroized the app, you will be taken to your personal url with all the switches with on,off, and toggle options. Make sure you save the URL for future use. Each individual button has its own url and you can call an http get on that url and it will send the effective command.

I currently use this with tasker and my pebble watch on android to control my lights

I also found the following instructions for doing something similar on an iphone with a pebble in my evernote archive

Once you approve the app, you can select the lighting and locks you wish to control. You will then be presented with a series of buttons in your browser to turn on and off lights or toggle them by using a http string. Right click on each action you wish to add to your pebble watch, copy the links and paste them in an email to yourself that is accessible on your mobile device so we can copy and paste them easily (This was tested on an iPhone).

Go to the app store on your iPhone, download Smartwatch+ and install the app to your pebble watch. You will need to enable the HTTP Request Screen in the settings on the iPhone app.

In the iPhone Smartwatch+ app click the + sign in the HTTP request config and give the action a label and paste the corresponding web link for each action from your email.

Go your pebble, press the select button to see the menu and scroll down to SmartWatch+. Select HTTP Request and you will see a list of all your actions. Select one to activate the trigger.

You can now control all your lights from your pebble!