in my case it is not possible, because th group is already on if only one person is ON. but the rule should only execute the action if all users are ON
You could also put all items in a „Count:OFF“ group via expert settings and create your rule to react on state less than number of items and greater than 0 and the second rule to trigger at state 0.
If you can’t or don’t want to use one of the Group aggregation functions then your only choice is to use a Script Condition and go through the members to see if they are all on, which appears to be what you are trying to do. But you can’t use a return statement like that in a Script Condition. It’s designed to take the what ever the last line of the script evaluates to as the return value. Therefore that last line needs to evaluate to a boolean.
g_homies.members.filter[ i | i.state != ON ].size == 0
That evaluates to false is one or more members are not ON and true if they are all ON.
Any time you touch on something from openHAB itself (Group, Item, Action, etc.) you are working with the core Java Objects even though your rule is written in some other language (in this case Rules DSL.
We see that getMembers() returns a Set<Item>. You can even click on that and it will take you to the doc for Set which shows all the methods available to you.
One place where it gets a little weird though is that Xtend, the base language for Rules DSL provides a bunch of wrappers around the core Java Collection Classes to make interacting with the Java Collections Stream API a little easier. Unfortunately that stuff really isn’t documented well by Xtend even which is why I wrote Design Pattern: Working with Groups in Rules.
Note: in some of the rules languages like JS Scripting and jRuby, a pure native abstraction layer is provided so that you never have to mess with the Java stuff directly. In these cases, if you look at the reference docs for the add-on and just generic references for the language you will get everything you need.