Getting a full output from a device in a single query


(Barry Murphy) #1

Hey guys,

1./ I came across API documentation at https://github.com/tmaiaroto/smartthings-unofficial-docs/blob/master/Documentation.md which allows a request for Hubs, from there you can request Devices from the API, then you can request info on the device, which gives the capabilities of the device and the values from the device.

From what I can tell this method you have to login as your main user ID so its not very helpful if you writing an application that will be shared with others.

2./ The next option is using the webservice http://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/overview.html and creating an OAuth SmartApp and then allowing users to give you permissions to the specific devices they wish to allow. The problem I have found is I need to then query each device type, like locks, switches etc to get a list, then I need to (using the ID it provides) query each device for it’s temp, state, etc.

So this option requires a lot more queries to obtain the data I want and will slow things down.

Does anyone have suggestions?

Many thanks in advance


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

That documentation is definitely obsolete. Some of the hooks will continue to exist as they are used by internal SmartThings features and the web based screens, but anything you build on them is likely to break someday and unlikely to be approved for production.

The published official methods are not as bad as you think; it just takes some time to experiment with them and various code examples (and good Groovy coding…) to see how powerful they are. We hope SmartThings improves/extends the official APIs, but their priority is on platform stabilization, rather than new features (especially not more general developer features).