Groups - Items & Switches

Hello All -

For some reason I am having a difficult time getting my head wrapped around groups…specifically when it comes to:

  1. A Group of Items
  2. A Switch to control the entire group of items.

in looking at references in the docs and other places I see grouping shown two ways,

First as a line item before the items (Group All)

Group  All
   
Number  Sensor_Temperature  "The Temperature is [%.1f °C]"  <temperature>  {knx="1/0/15+0/0/15"}

and included within the item syntax…(livingroom)

Switch Corner "Breakfast" [ "Switchable" ] (livingroom) {channel="zwave:device:ad34b696:node2:switch_binary"}

So my question is…are both correct or should one be used over the other.

My goal is to have all my lights in one group and I have one switch that can turn off all of the lights.

I have seen multiple approaches to the group switch as well and I’m just not grasping it…

Can someone assist with some direction please?

Here the general description if not yet seen: http://docs.openhab.org/configuration/items.html#groups

there are two basic things for groups:it needs to be defined and needs to have members (well technically a group can exist with zero members, but then what is the point)

a group needs to be defined

does exactly that, it defines a group with the name “All” (without quotes of course)

You need to assign items to a group, ie., you make items a member of one or more groups. In your examples the Switch “Corner” is part of the group “livingroom”, which in turn needs to be defined by the syntax under above somewhere.

Groups can then be nested, in other words your can have groups become members of other groups, for example

Group All
Group Lights (All)

defines a group “All” that includes every item from group "Lights"
Keep in mind that items can belong to more than one group

There is more in the forum regarding all kinds of aspects of groups, but one of my all time favorite entry is:

If you are trying to get you head around these things, check out the tutorials section in the forum or just search for ‘design patterns’;

@lipp_markus

Thank you for stating that the way you did…now I understand defining the group and then marking members of the group, makes perfect sense.

Now to create a switch that controls all members of the group.

Do I use something like this?

Group:Switch:OR(ON,OFF) All

What does the OR mean?

Thanks,

Squid

@KidSquid
You may want to read up here:
http://docs.openhab.org/configuration/items.html#group-item-types
it explains the OR function in this context

Personally, I have little experience with what you are doing, I use the design pattern (link provieded earlier), but a quick search on the forum brought up a few discussions that look like they may help you:


Just two of the threads that came up when I searched for “switching groups”