Hey,
I’ve moved from openHAB 1.x to 2.0 (latest Snapshot) and I wanted to clean up my rule mess.
Basically I’m looking for a smart solution to switch my lights on/off.
At the very beginning I thought it would be easy to use a group switch but I thought it would be possible to assign a single subgroup to multiple parent groups for instance:
Group All
Group:Switch:OR(ON, OFF) AllLight
Group:Switch:OR(ON, OFF) GuestLight
Group LowerGroundLightA (AllLight)
Group LowerGroundLightB (AllLight)
Group GroundLightA (AllLight)
Group GroundLightB (AllLight, GuestLight)
but this didn’t work. Then I decided to use forEach loop (see below) but I don’t know if there’s something smarter I could do? I want to minimize my group assignments as much as possible.
Btw what’s the meaning of the question mark if I use a forEach loop (e.g. gLightAll?.allMembers.forEach).
Thanks a lot, Manuel
Let me share a sample rule which is used to switch off all lights:
gLightAll.allMembers.forEach [ item | item.sendCommand(OFF) ]
gLightGuest.allMembers.forEach [ item | item.sendCommand(OFF) ]
gLightLiving.allMembers.forEach [ item | item.sendCommand(OFF) ]
Item setup:
Group All
Group gKG "KG" (All)
Group gEG "EG" (All)
Group gOG "OG" (All)
Group gOUT "Außen" (All)
Group gMISC "Control" (All)
Group gKGController "KG" (All)
Group gEGController "EG" (All)
Group gOGController "OG" (All)
Group gOUTController "Außen" (All)
Group gMISCController "Andere" (All)
// SCENE GROUPS
Group gScene "Szenen" (All)
Group gLightAll "Zentral Licht" (gScene)
Group gLightGuest "Zentral Licht o. Gast" (gScene)
Group gLightLiving "Zentral Licht o. Wohnen" (gScene)
Group gKGLight "KG Licht" (gLightAll)
Group gEGLight "EG Licht" (gLightAll)
Group gOGLight "OG Licht" (gLightAll)
Group gOUTLight "Außen Licht" (gLightAll)