Group:Switch:OR(ON, OFF) vs. Group

Hi All,

My name is Dominik and I am pretty new to Openhab. My former project was FHEM, but I think it is now the time to change ;->

I read a lot of documentations in the last days, but I could not figure out the difference between Group:Switch:OR(ON, OFF) vs. Group.

I like to switch a group of power sockets with the rule:

rule "Kino off"
Item Test_Schalter_channel2_short received update ON
gH_Licht_switch.members.forEach[item | sendCommand(item,OFF)]

I tried as items

Group gH_Licht_switch or
Group:Switch:OR(ON, OFF) gH_Licht_switch

First off all, both groups work and switch of the selected items in the group.

But where is the difference between Group and Group:Switch:OR(ON, OFF) - I don’t get it. I am scarred, that I will continue with my development and do something wrong, which will hit me later.

Thanks if you could bring more visibilty in this issue.


Hello and welcome to Openhab. And yes, groups can be a little tricky to grasp at first. Yes, you can do this with rules if you prefer. But if you want a Group Switch, what you want to do is the following:

Set up a Group Switch in your items file, and then assign your lights or outlets to that group. As an example, this what I have for my Family Room Lights.

Group:Switch:OR(ON, OFF) 	Family_Lights 		"All Family Lights [(%d)]" 	    <light>		(All)

Color  FF_Light_FamilyCF_1 			"Ceiling Fan 1"			<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)		["iss:room:FamilyRoom", "iss:type:DevRGBLight"]			{ channel="hue:0210:00178824e7e9:13:color" }
Color  FF_Light_FamilyCF_2 			"Ceiling Fan 2"			<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)		["iss:room:FamilyRoom", "iss:type:DevRGBLight"]			{ channel="hue:0210:00178824e7e9:14:color" }
Color  FF_Light_FamilyCF_3 			"Ceiling Fan 3"			<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)		["iss:room:FamilyRoom", "iss:type:DevRGBLight"]			{ channel="hue:0210:00178824e7e9:15:color" }
Color  FF_Light_FamilyCF_4 			"Ceiling Fan 4"			<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)		["iss:room:FamilyRoom", "iss:type:DevRGBLight"]			{ channel="hue:0210:00178824e7e9:16:color" }
Color  FF_Light_FamilyLeft 			"Family Left"			<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)		["iss:room:FamilyRoom", "iss:type:DevRGBLight"]			{ channel="hue:0210:00178824e7e9:10:color" }
Color  FF_Light_FamilyRight 		"Family Right"			<colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)		["iss:room:FamilyRoom", "iss:type:DevRGBLight"]			{ channel="hue:0210:00178824e7e9:11:color" }
Color  FF_Lightify_LED_TV           "TV Backlighting"       <colorwheel>    (FF_Family, Family_Lights, Lights, gdashboard)      ["iss:room:FamilyRoom", "iss:type:DevRGBLight"]  { channel="osramlightify:rgbw:84-18-26-00-00-04-EA-17:color"}

And then in a sitemap, you can turn them all On or Off with

Switch		item=Family_Lights mappings=[OFF="All Off", ON="All On"]

Thanks Paul,

Yes, groups are really tricky and it tooks me a while to understand it.

So it means, if I would work with rules, it doesn’t matter if I use Groups or Group:Switch.
Only if I would like to use it in a sitemap, I need to have the Group:switch.



There is one case where you will want to use Group:Switch and for this reason I recommend always supplying a type to Group Items.

Rules that try to use the state, updates, or commands sent to a Group Item will not trigger if you do not supply the type.

So, given:

Group allLights
Group:Switch allLightsSwitch

The following Rule will never trigger:

rule "allLights received an update"
    Item allLights received update
    // never triggers

and the following Rule will trigger if any member of allLightsSwitch receives and update:

rule "allLightsSwitch received an update"
    Item allLightsSwitch received update
    // handle one of the lights receiving an update

One final note, the second rule above will trigger multiple times for one update to one of its members.