Well, a quick look showed that I wasn’t too far! device.supportedAttributes
But I didn’t answer entirely your question… it’s about extracting a map of attributes and their respective values
def dvAt = device.supportedAttributes
def dvAtCount = dvAt.count()
and maybe something like this:
def AtMp = [[dvAt[0] : 0], [dvAt[1]: 1], …]
- how do you count how many attributes were listed
- can you automate a map so it builds itself up upon this number of found attributes? That’d be great because it could just allow a smartapp to learn…
For an epic prose in map shenagins:
1 Like
for memo, for the day I’m looking back to this awesome conversation when I need to build more maps and list attributes, I copy paste this:
def getGroupMaps(){
return settings.findAll(){it.key ==~ /g[0-9]+/}.sort{it.key}
}
I don’t knwo what /g[0-9]+/ means, though… and I guess that this is where lies the key (so to say…) to my last question…
1 Like
Here is one blog post for your reading pleasure on ‘slashy’ things…
1 Like