I need to get dimming values of each light in a group into an array for use in a rule.
Currently I have this, which works, but it means I need to create switch routines for each light. I’d rather have all values stored into a single array instead of individual variables.
var Number lightcircuit1level = BedroomLights.members.get(0).state as DecimalType var Number lightcircuit2level = BedroomLights.members.get(1).state as DecimalType var Number lightcircuit3level = BedroomLights.members.get(2).state as DecimalType var Number lightcircuit4level = BedroomLights.members.get(3).state as DecimalType
Also I’d like to determine the number of items in the Item group and stop when I have reached this, if that makes sense!
I’m coming from a C background and have struggled with various ways using a basic for loop, what am I doing wrong?