Group aggregation fails

I try to make a group that represents the state of all lights in the house. So it should be on, if any light is on and off if all lights are off. This is the group:

I tried all the aggregation functions, but they all give an error like this:
Error: Group function ‘AND’ requires two arguments. Using Equality instead.

And the group remains in NULL state. Also the aggregation function is back at None if you click on Edit again.

I’m guessing it’s due to the group members being three different types of items. How is the group to know that 0,0,100 means ON?

1 Like

idk, but if that is the problem, is there any fix / workarround for it?

Assuming I’m correct (I don’t know for sure), the fix would be for all of your items to be of the same type.

If you’re trying to aggregate whether they are ON or OFF, logically the items would all have to report one of those two states. You can either add more items that are switch types and use these in your group, or abandon the group in favour of a virtual rule that can interpret the states that are reported by your actual items.

It may also be possible for your existing items to have their states transposed into ON or OFF, but I can’t help you with that.

I am never sure how correct what I do is but you can use metadata state description so switches take the values 0 and 100 or the dimmer take on and off so the states are consistent. The dimmer looks like this.

The switch to dimmer is more obvious with ON=100 and OFF=0.

The result is a group that works either way

1 Like

Well the problem is your misunderstanding so best to fix that :wink:
As Russ indicated the system cannot know what “ON” means for a color light. For HSB (0,0,100) or RGB (100,100,100) most may think means ON but what about (0,0,1) or (90,50,1) ? It’s undefined.
So for aggregation functions to work, all group members must have the same type i.e. you cannot mix color and on/off lighting.

1 Like

Perhaps you would tell us which one you settled on as the most likely to work.
MainUI doesn’t offer all the possibilities at OH3.0

I think aggregation functions work on raw Item state, taking no notice at all of presentation metadata.

It is smart enough to internally do “as on/off type” though.
A Group of type Switch with a function OR(ON,OFF) will cope happily with a mix of Switch,Dimmer and Color members,no special fiddles required.

I’ll dispute that- for example you can get state “as OnOffType” in a rule. Group aggregation appears to be capable of the same trick.
0,0,1 appears to treated as ON.


Of course you can because you can typecast anything, and even if at times it does what you think it should do that’s more of an implementation side effect than intentional.
At least it’s AFAIK not documented so definitely nothing you should rely on in general.

1 Like

Thanks for the info. I will duck out as you guys know this better than I will ever. I will have a look again in light of what you are saying and see if it was an error in my group setup or specific to the devices I was using. Thanks for the info in your posts.

1 Like

Thanks, setting the base type to switch worked!

1 Like

I have a feeling this probably was documented in the old archived Eclipse Smarthome stuff, which did get into this level of detail that OH docs do not.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.