Set theory operations on groups

See Design Pattern: Working with Groups in Rules for many of the useful Group operations.

The Rule’s DSL is more geared towards pipelining than set theory unfortunately. So you have filter, map, reduce, sort, etc but not native set theory operations. But you can get there from here.

livingroom_lights.members.filter[light | !light.getGroupNames.contains("tv_lights")].forEach[light | light.sendCommand(OFF)]
tv_lights.sendCommand(30) // assumes it is defined as Group:Dimmer tv_lights

Not as elegant as it could be but not too bad either.