Is there a way to iterate over the inputs and access properties like: input[0].name, input[0].title ?
tgauchat
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
2
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.
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.
tgauchat
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
4
I don’t understand…
Each input element is already filtered to one specific Capability.
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.
tgauchat
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
7
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.