How to determine what capabilities are available?

I recently wrote my first SmartApp GroveStreams SmartApp and found that I had to include a lot of capabilities in the preferences just in case the user has them - whether s/he has them or not.

Is there a way of querying which capabilities are available for the location?

Have you seen this? Near the end someone is showing off a smart app that displays capabilities.

Thanks @jody.albritton that looks great for finding the capabilities of a specific device, but what I am really after is the capabilities available across devices at a Location.

I want to only present as inputs those capabilities available so that the user doesn’t have to page through a load that aren’t relevant to them.

I can’t find a way of enumerating Devices or Capabilities that are available.

I don’t know if there is an easier way, but I would create an array of devices for the location. Then, loop through that array and display the capabilities using a method similar to the one above.

Hi Jody, excuse my complete noobness but how would I do that? I rather hopefully tried to output “devices”:

preferences {
    page name: "displayDevices"

def displayDevices() {
	def pageProperties = [
    	name: "displayDevices",
		title: "Display devices",
        install: true,
		uninstall: false
    return dynamicPage(pageProperties) {
		section("Devices") {
        	paragraph "${devices}"

but just got “null”.


If I understand the following post correctly, that is not possible. I have not seen the API which would allow to do what you are looking for.

Thanks @psfunatyo that’s a shame. I think I should at least be able to enumerate them within the app, even if I can’t interact with them. After all, when you prompt for capabilities the devices with those capabilities are listed, so being able to ask what capabilities a location has would seem reasonable.

With ST you are able to build your own API. You should take a look at some of the api endpoint examples. You could configure a smartapp api endpoint that would allow users to authorize their devices, and then you could enumerate the capabilities of all authorized devices.

Thanks @jodypeterson, yes I guess going through the OAuth process would list the available devices. I was hoping to do it within the SmartApp though and can’t really see a good reason why this wouldn’t be supported.