Is there a way to access the Input element itself?

Is there a way to access the input object ?

For example, I have the following Inputs in the preferences:

input “switches”, “capability.switch”, title: “Light Switch”, required: false, multiple: true
input “thermostats”, “capability.thermostat”, title: “Thermostat”, required: false, multiple: true

Is there a way to iterate over the inputs and access properties like: input[0].name, input[0].title ?

There’s nothing called “input”, but there’s a map called “settings”. Print it out with log.debug settings.

The individual devices are in maps or lists named with the first parameter of the input() statement (i.e,. switches[], thermostats[] and can be iterated over. See every single SmartApp. :slight_smile:


Yes, I am aware of the settings map. But I want the input element object.

Reason: The Thermostat has multiple capabilities, I can do thermostats[0].capabilities, but it will return all the capabilities supported by thermostat. I want to get only that supported capability that I mentioned in the input element. I can hard-code the mapping in my code like [“thermostats”:“thermostat”], but I want to know if I can somehow get a list or map of input elements and retrieve the capability from it.

I don’t understand…

Each input element is already filtered to one specific Capability.

input “thermostatObjects”, “capability.thermostat”

you can do this the other way around

def buildInputs(){
	def map = []
	map.push(1:[name:"mySwitch",title:"select switches",description:"my switches",type:"capability.switch",required:true]
	map.push(2:[name:"myTherm",title:"select stat",description:"my stats",type:"capability.thermostat",required:false]
	return map

		name	: buildInputs()[1].name
		,title	: buildInputs()[1].title
		,description : buildInputs()[1].description
		,type	: buildInputs()[1].type
		,required : buildInputs()[1].required

just execute: log.debug “${thermostatObjects.capabilities}” or
log.debug "${thermostatObjects[0].capabilities}"
for a physical thermostat (or map a device handler from templates to a virtual device) and you’ll see what I mean.

Yes… I know you can enumerate the capabilities list of a Device Object, but I guess I don’t understand your question.

The thermostatObjects may have several capabilities each, but the Objects came from a “thermostat” input filter, so you are only “supposed” to use them with the Commands and Attributes of Capability Thermostat.


The input doesn’t exist as an object at execution, only the value that was assigned by it. It’s a definition for the user interface (mobile app) to use to build the controls. To access the input you have to be able to execute code on the mobile app.

1 Like