CoRE - Variables 101

Now that Lutron Caseta is integrated, I’m trying to account for their rare power failure modes, On 100%. Lutron states the default is to return to the previous state prior to the power failure. In my core script, Power Failure, I attempt to detect lights above 99% and turn them off. I wished to loop over a list of the bulbs to test each of their levels.

I may be able with while loops and switch/case statements to do this.

Let me ask this, if I Save Attribute of Switch with an aggregation of Count I get a number, say 3. If I then loop over the levels of the bulbs and get those, are the ordering guaranteed to be in the same order? Or does this not make sense?

Thinking this through here, I may simply be able to take the MAX of the levels and do an ‘if’ above 99%. That makes more sense than trying to build my own list capability.