[Solved] Group Switch for Lights (both dimmers and on/off)

I’ve been moving from items and sitemap files to using UI and the semantic model. In my old configuration I had

Group   gLight             "Lights"         <lightbulb>
        Group item=gLight
		Switch item=gLight mappings=[ON="All On"]
        Switch item=gLight mappings=[OFF="All Off"]

I removed the gLight from the items file and created it in the UI. I associated a grouping of lights on dimmers and lights on on/off switches. I chose type “group”, category “light” and then Symantec class “switch” and property “light”.

When I toggle the group light on, I see “Item ‘gLight’ received command ON” and my lights turn on. When I toggle the group light off, I don’t see any received command to turn off. I played around with Group Settings but I just could get it right. What’s the proper way to set a group switch item in the UI?

Thank you!

First off, if you have only moved over the gLight group then you are unlikely to see the correct behavior anyway. There are known issues with trying to mix UI managed groups and file managed items going back all the way to the beginning of OH3 and I don’t believe they have been resolved because they come from fundamental differences in how/when these items are loaded. So if you want to test this you need to make sure you are moving ALL the items in the group as well as the group.

To your question: in the UI when you create a group, there is an option to set the default type of group members. If you want your group to register as having a state derived from the group member states then you need to set this option to the appropriate item type which will then give you the choice of aggregation functions (e.g., All ON = ON else OFF as one of the options for switch item based groups). This is really extra, however, as long as the items are correctly added to a group any command sent to that group will be distributed to the member items. So you only need the aggregation function if you want to see some summary state of the items as the group state.

This was done, but it’s good to know as I am working on moving everything over from files to UI.

I changed the “Members base type” to “Switch” and the “Aggregate Function” to “All ON = ON else OFF” and so far it seems to have resulted in the behavior that I am looking for. I am now seeing “Item ‘gLight’ received command OFF” when I switch off in the interface. That wasn’t showing prior to including the Aggregate Function command.

Thank you very much!!