Group items under one toggle

OH: 3.1.0M3
CentOS 8

I have two pairs of switches that I’d like to group under two toggles on a page. The idea is hit the toggle and both outlets turn on, hit it again and they turn off.

I’ve been trying to figure out groups and I’m just not getting my head wrapped around it. I don’t mind hand jamming an .items file if need be but I was hoping to be able to just create a switch with a group behind it and two of the outlets inside that group.

Where can I find the steps to create that or a tutorial?

I do have toggles already setup for these outlets that work as expected, just trying to create a single toggle to control two at a time.

When you edit the group in the UI there is a box of options for setting the default group member type. You can set this to switch and then select the type of aggregation that best represents the function you want your group to have (e.g., all ON then ON else OFF). Then you can use the group as the item for any toggle-switch, -card, or -cell you want to place on the UI.

Remember though that groups don’t just sent their states to the member items, state information goes two ways (changing the items can change the group state). So if you ever also control the switches individually then you may experience some potential side effects from the group aggregation function depending on which one you’ve chosen.

You can do do this two ways:

  • Create one switch item and add both channels to it.
  • create a Group:Switch item and put the separate switches in the group

<pedant> Groups never send their state to members; Groups distribute a command to members </pedant>

openHAB makes more sense when you keep the distinction in mind.

1 Like

Can’t argue with that. Good catch.

I really thought I had tried that and it wouldn’t work for me. I guess I must have done part of it wrong and don’t have the attempt around to figure out what that was.