Group Definition types/functions in .items

HI There,

I have a question around groups in items. Yes, I am a total newbie.

I have created a few easy groups from exapmples like:
Group:Switch:OR(ON,OFF) gGuestBedroomLights “Guest Bedroom Lights”

And they work well. But I want to get/set a color for a bunch of LIFX mini colour lights.

But how does I create a group for a color? I would assume that the colorpicker is a range.
Group:color:<What function? Min Max?> gGuestBedroomColourPicker “Guest Bedroom Lights Colour”

I read the docs and it wasnt very clear other than a few items, but not what I was after.

Any suggestions, would be greatly appreciated.

Regards,
Andy

You don’t need to set a function. This is the part, how openHAB does build the state of the group item.

There are many usecases for Groups:

Grouping Items for:

  1. sorting (especially in VSCode)
  2. sitemaps (Group Widget)
  3. trigger (Rules)
  4. charts
  5. summarize

When grouping for the 5th point, you have some options, what and how to summarize. For example it would be nice to have the average temperature for the house. Just build a Group:number:AVG Temperature (i.e. summarize all items and divide it by the count of items) and put all Measurement items in this group. Or you have some lights, you want to know how many lights are ON, so group it: Group:Switch:OR(ON,OFF) lights (i.e. Count all lights which are ON)
In question of color, I see no meaningful sum, so just don’t use a sum:
Group:color myColorGroup.
Of course, the Group will not have a meaningful state.

1 Like

Hi Udo,

So if I did this in default.items
//Define Group
Group:colour gLoungeLightsColour “Lounge Colour”
//Define Items
Color Color_Lounge_Light2 “Lounge Light2 Color” (gLoungeLightsColour){ channel=“lifx:colorlight:LoungeLight2:color” }
Color Color_Lounge_Light1 “Lounge Light1 Color” (gLoungeLightsColour){ channel=“lifx:colorlight:LoungeLight1:color” }

It should work in my default.sitemap with:
Colorpicker item=gLoungeLightsColour label="Lounge colour" icon="colorwheel"

Should work? Or do I need to add these color channels in default.things as well? Just trying to get my head around this internal things discovered in PaperUI. Does Openhab use them, or does it default to “.things”?

in my default.things:
Thing lifx:colorlight:LoungeLight1 [ deviceId=“D066D53394AA” ]
Thing lifx:colorlight:LoungeLight2 [ deviceId=“D066D53394C1” ]

if I explicitly DONT define my channels does things add ALL channels?

Thanks,
Andy

Yes
When you choose a colour for the group it will cascade down to the items in the group
The channel binding are for the individuals lights only.

Slight typo.

Group:Number:SUM lights

With Group:Switch:OR(ON,OFF) the Group will be ON if one or more members are ON and OFF if all are OFF.

Another typo:

Group:Color gLoungeLightsColour “Lounge Colour”

It needs to be capitalized and it uses the American spelling.

With the typos corrected yes, it should work.

Things represent the Device to OH. Things have Channels to represent all the individual values reported by the Thing and all the individual ways there is to control the Thing. So for a color light you might have a switch Channel, a dimmer Channel, and a color Channel representing three ways you can control that light.

Items are used to model your home automation. All the values you care about and all the ways to control your home automation are represented by Items. Pretty much everything in OH (Persistence, UIs, etc.) work with Items.

Items may or may not be linked to one or more Channels on a Thing. When a Channel is linked to an Item, updates to the Thing will cause the state of the Item to be updated and commands to the Item get sent to the Thing and therefore on to the device.

The answer to that is in the binding README. LIFX - Bindings | openHAB

Based on the examples it does look like you need to define the Channels yourself unless you use autodiscovery.

Well, yes, the state will be ON, but the group will also count or at least will show how many group members are ON:

Text item=lights label="All lights [(%d)]"

I did not know that. Thanks!