I have implemented this now with a rule:
Script:
var group = itemRegistry.getItem("Lights_Indoor");
var lightson = group.members.stream().filter(function(i){ return i.state == "ON" }).count();
var label;
if (lightson == 0) {
label = "Aus";
} else {
label = "Ein (" + lightson + ")";
}
events.postUpdate('Lights_Indoor_Count', label);
Result :
Lights_Indoor --> Group-Item
Lights_Indoor_Count --> In my case a String-Item, but can be a Number-Item in case you only would like to show the Number.
Hope this helps…