my concrete example
@JRuleName("init_DI_LED16")
@JRuleWhen(item = _BT_SW_LED16_TOGGLER.ITEM, trigger = _BT_SW_LED16_TOGGLER.TRIGGER_RECEIVED_COMMAND)
public void init_DI_LED16(final JRuleEvent event) {
_G_DI.members().stream()
.filter(memberItemName -> memberItemName.startsWith("DI_LED16_"))
.map(memberItemName -> itemRegistry.getItem(memberItemName)) // <--- how get an item by its name?
.forEach(memberItem -> {
if (memberItem.state == "LED_OFF") { //<--- use state of member item identified by name
...
sendCommand(memberItemName, "LED_RED")
}
}
}
}
where _G_DI
is a group of LEDs.
If it is possible to send a command/update the state of an item identified by its name it should also be possible to read the item state by its name.
I could introduce more groups and use operations on these groups (intersections, slices, …) but this does not feel natural to me.