Im working on an app where it would be useful to select a device and then be able to select from the available attributes for that device.
Can anyone give me a pointer on this.
Thanks.
Im working on an app where it would be useful to select a device and then be able to select from the available attributes for that device.
Can anyone give me a pointer on this.
Thanks.
To compliment @csteele's nice little App (that I didn't know existed
), there is also the capability documentation, which includes both the attributes and commands for each capability.
But I expect if you want to cover all possibilities, adopting the approach @csteele took in his app will cover all eventualities.
Actually, @csteele, will the app pick up all attributes using ${v?.supportedAttributes}? Or just the ones covered by the capabilities supported by the device?
I have no examples of a "hidden" attribute to test against. I am forced to assume that ${v?.supportedAttributes) is adequate.
I created this when I was working on HubConnect stub drivers and needed to match a "real" driver with a virtual driver written to that spec. I've written lots of virtual drivers trying to mimic the offerings of real drivers. In the above example, for a thermostat, I wrote a more "detailed" virtual driver trying to cover features of that Honeywell driver I support that my "real" thermostat doesn't contain. We don't use Humidity or Emergency Heat in California, for example. I haven't bumbled into a missing attribute... yet.
Thanks guys, that was a huge help and it is now working.
Code below lets you select a device in one selection box and populates the list 'attributeList' which can be selected in a second selection box. Works great.
input "myDevice1", "capability.*", title: "<b>Select Device 1</b>" , multiple: false, required: false, submitOnChange: true, width: 2 String attributeString = myDevice1?.supportedAttributes def attributeList = attributeString.substring(1, attributeString.size() - 1).split(",").collect {it} paragraph "attributeList is ${attributeList.sort()}" input (name: "mySelectedCapability", title: "<b>Select the Attribute for Device 1</b>", type: "enum", options: attributeList.sort() , submitOnChange:true, width:3, defaultValue: 1)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.