OK… I think I’ve got it…***, but I’m not sure “exactly” what your SmartApp is doing, so you’ll have to test…
Your original lines…
@spencejs:
"bulbs${n}"*.setLevel(bulbNewValue.level)
"bulbsOn${n}"*.on()
"bulbsOff${n}"*.off()
Change this to:
settings."bulbs${n}"*.setLevel(bulbNewValue.level)
settings."bulbsOn${n}"*.on()
settings."bulbsOff${n}"*.off()
Quite a small change, right? Since the Preferences are actually stored in a Map called settings
, you “need” or “can” refer to the full Map name when referencing the Devices.
By using the “settings
” Map name, the string expansion appears to work correctly. I notice that I did this in one of my SmartApps before, and didn’t recall why … but I figured I had a reason.
Please let me know if this works.