- Is there any way to get a complete device listing. (not by capability)
- If not, is there a way to combine the objects created (by capability) into a single object?
There isn’t at the moment.
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
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?
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.
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?
Take a look at this.