Wildcard for Group.members.filter - Use String Patterns and ConfigItems

Hello,

to add more flexibility in terms of configuration to everyone in my house, I added a bunch of config Items which are part of specific ConfigGroup. NumberItems for ToDs or ColorItem for Scenecolors.

// Setup 1: Kitchen and Living
Group   gConfigMotion_1
Color   configMotionLightSetValue_1     (gConfigMotion_1)
Number  configMotionLumi_1              (gConfigMotion_1)
Number  configMotionStartTod_1          (gConfigMotion_1)
Number  configMotionStopTod_1           (gConfigMotion_1)
Number  configMotionDuration_1          (gConfigMotion_1)

But I want to use those config items in lamda functions. Therefore I need to get the right member and I thougt the best way would be members.filter, but unfortuantely I cant figure out how to use string patterns for the condition. Any Ideas?

// This is inside a lamda
val int MaxLumi = ConfigItem.members.filter[s| matches(s.name, configMotionLumi_)].state

In case not yet seen you may find this resource to be very helpful:

Also see the Associated Items design pattern.

I already knew those, but digging a little bit deeper into java the following worked:

val MaxLumi = ConfigItem.members.filter[s| s.name.startsWith("configMotionLumi")].head.state

Let me know if there is an argument against this solution or even a better way.

That basically is the Associated Items design pattern. I know if no better way.