Standalone Application capable of listing and controlling devices

Dear all,

I am a newbie , started working on web app to list and control devices in one location.
i could write REST calls for logging and getting location and devices details.
for example below function sends get request for fetching devices for a location:
sendGetRequest(endpoint + “/api/locations/” + locationId + “/devices?” + “access_token=” + token, callback);

How to change status for one device from a web app?

I think @mager can help you!

1 Like

@kapil1211, welcome to the game.

Check out my project and look at the source to find more than you ever wanted to know about REST calls:
http://action-dashboard.github.io/

1 Like

thanks alex, i have a quick view on your work.
And followed mentioned steps, but after opening url in browser i just get one grey box with “Refresh button”.
Am i missing something here ?

FYI: I dont have smart hub or actual devices yet, so is there any depenency for those?

If you have no devices what do you expect to see on a dashboard?

1 Like

1.i have added virtual device in my Home Location, will not this be shown ?
2.Where can i find complete list for API like :
https://graph.api.smartthings.com/api/locations?access_token=***** (to fetch the location using access token)
like this way if there any post/get request to change state of a particular devide_id ?

Please correct me if i misunderstood something, meanwhile i am going through docs and learning more :slight_smile:

I could ad Virtual device in your dashbroad through ST Android App, and now it reflects in dashboard :slight_smile:

And here is my understanding:
But for changing the state of a device- lets say switch on/off a Bulb,
i need to write a web all from my html web app, which will be interpreted by groovy code.
And there i can change the state. (thats i could understand your code)

Is this correct ?

And good news is i just received my Smart Hub Kit with basic sensors , so now i can start practically :wink:

You create your own API, it doesn’t have to be a web app.

Refer to this document to get started:

http://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/index.html

1 Like

Thanks for your reply, but my actual requirements is to control devices through my Webapp (not through from SmartThing Android APK or other applications like you have developed)

Altough its doing the same thing, basically i want to mimic the same in my WebApp.
(But i am new to HTML/REST etc, so kind of asking basic doubts)

As mentioned i want to change the device state through my HTML page,
would be happy to hear your inputs.

Here’s an example of how to control a switch with a REST API: https://github.com/SmartThingsCommunity/Code/blob/master/smartapps/hackathon-demo/restful-switch.groovy

It more or less uses the tutorial Alex posted.

thanks @mager, i am looking for same.
Is there any public JS code also for this project ?
TIA.