How do I get a complete device listing?


(Steve Nemeth) #1
  1. Is there any way to get a complete device listing. (not by capability)
  2. If not, is there a way to combine the objects created (by capability) into a single object?

Thanks


(Tim Slagle) #2

There isn’t at the moment.

http://grails.asia/groovy-map-tutorial


(Jody) #3

The way SmartThings works, you create your own API. If you want to have a devices endpoint that lists all devices, it’s possible. The best place to start is the docs. http://docs.smartthings.com

There is more than one way to do what you are looking for.

a more complex example of an API endpoint


(Steve Nemeth) #4

Hi Tim,
Thanks for your response.
If I combine the collections into a single collection, say in the initialize() method, will I be be able to access that collection in other methods that I create similar to the collections created in preferences. Or would it be out of scope and I will have to create a method that combines the collections every time I need to access it?
Thanks,


(Tim Slagle) #5

It’ll definitely be a little weird, and you’ll need to dance around it a little bit. It’s not exactly something that will be easy to code. What is the main goal, maybe I can help if I knew what the goal is.


(Steve Nemeth) #6

Ideally the goal is to have a single collection containing all devices that can be used (looped through) in any method throughout the SmartApp.

From what I have read, a global variable or collection can not be created. I’m thinking to create a method that combines the collections into a single collection, then use that method within the other methods that need it.

Does that sound like the best way to achieve what I’m wanting? Is there an other suggestion as to what may be best?


(Tim Slagle) #8

Take a look at this. :slight_smile: