Now I could copy that for each lightbulb and change the name, which is obviously not very elegant.
Here (But How Do I…? — openHAB Helper Libraries documentation) is indicated that it might not work in that language, but maybe that’s outdated or is there a different way to achieve this?
What are you really trying to do here?
We can interpret that as “turn all lamps off” (brightness=0), which is easy enough. events.sendCommand(yourGroup,OFF);
When your devices report their new state as off, it’s likely the HS part of HSB gets zeroed as well, depending on the binding and device technology.
Does that happen already with your individual commands?
Thank you, this indeed works fine for the current task.
However, I’d be interested in a general solution. Let’s say I wanted to set the brightness to 30 (or the color to a specific value), then this wouldn’t work. And there might be many rules where changing entire groups instead of individual items would be handy.
In truth you can send Dimmer style commands to Color Items, just like ON/OFF. events.sendCommand(yourGroup,30);
but that’s not your point.
Let’s say, add 10 to existing H value, where they may not all be the same to begin with
No, there are no pre-written functions to “select all members of a Group and add 10 to H value”.
It is not even possible to just update all members of a Group in one hit. Only send a command, which gets propagated out to all members (and might have eventual consequences on the states).
This what rules are for.
I think what you are looking for is to iterate through all members of a Group and do whatever you do to each one in turn.