Group type and member base type for color picker?

Is there no current means to have a group type and member base type of color picker? The purpose would be to control multiple colorpicker items at once. For example, a room has 5 items with a color picker. A group called Living Room Color would allow controlling all of them simultaneously and in sync.

Right now the only way I am seeing to do it is to make specific scenes using rules. OH 3.1.0 release if it matters.

No. There is no such Item type.
You may create Items of type Color, and Groups of type Color.

Note that putting a bunch of Items in a Group does not automatically synch them up.
Sending commands to the Group will pass commands to the member Items.
Adjusting individual members by command or local controls will not automatically be reflected in other members.
Not sure what you want here.

In theory, you can represent a Group on a UI with say a colorpicker cotrol, and when you click the control it will do as described above - pass the commands to all members.
But I think there are "gotcha"s here.
The colorpicker widget won’t work without an initial HSV state.
Groups don’t have any state by default.
Groups can derive their state from members by choosing an aggegation function … but I don’t think any of the current available functions work to produce an HSV (what would an average colour look like?)

You could make a “master control” with an extra dummy Color type Item.
Put that (not the Group) in your UI with a colopicker widget.
Have some rule of yours produce some worked out state for it by averaging the Group member Item states, so that it works with the widget.
Have another rule simply pass commands to the dummy onwards to the Group, which will in turn pass to members.

The former. For example, i have a ceiling light with two RGBW wifi bulbs in it. There are no circumstances where I’d ever want the two bulbs to do different things. Using a group to issue commands would be the best way to control them together.

But as you’ve noted, the support for this is not there I guess. So I’m having to write scenes with scripts and triggers.

The support is there for a Group to distribute single commands to all members.

Doing things in response to triggers is exactly the business of rules.

The bit that is clumsy here is the UI, do you need that at all?

For this unique case, you could link both channels to the same Item.

You mean I could use the group to distribute a command from a rule/script? Just not via the UI due to the lack of UI support? I hadn’t thought of trying that after I saw the UI not working.

Holy crap. I never realized you could do such a thing. That just accomplished exactly what I needed. Thank you!

It’s a bit of a kludge; obviously the Item can only show you the state of one device at a time - the last one to “check in”.
Should the devices not be exactly identical, you might find your Item state dithering between them.

Depending on the binding/technology, sometimes you can manage parallel devices better by making one channel write-only.

I do this using the master control @rossko57 mentions.

I have several rooms which have lights that are ‘color’ capable and wanted to have them integrated with Alexa. In order to do this I started by creating a group that would mimic a single-bulb. As I use a naming convention I ended up with something like:

Grp_Lights_FF_KI_Spots                        - Alexa Metadata = Lighting
    Grp_Lights_FF_KI_Spots_Brightness         - Alexa Metadata = BrightnessController.brightness
    Grp_Lights_FF_KI_Spots_ColorTemperature   - Alexa Metadata = ColorTemperatureController.colorTemperatureInKelvin
    Grp_Lights_FF_KI_Spots_Color              - Alexa Metadata is not set
    Grp_Lights_FF_KI_Spots_Switch             - Alexa Metadata = ColorController.color
    Grp_Lights_FF_KI_Spots_ColorChanger       - Alexa Metadata = PowerController.powerState

Note: whilst the last entry is named ‘Grp’ it is actually an Item of Type Color.

Due to the fact I have many of these I then created a ‘Settings_ColorChanger’ group so that I can place all the ‘Grp_Lights_XX_YY_ZZZ_ColorChanger’ in. This allows the following rule:

triggers:
  - id: "1"
    configuration:
      groupName: Settings_ColorChanger
    type: core.GroupStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: >
        // remove the 'Changer' from the triggeringItemName
        val groupName = triggeringItemName.toString.substring(0, triggeringItemName.toString.length - 7) 
        sendCommand(groupName, newState.toString)
    type: script.ScriptAction

Now when I change the value of the Grp_Lights_FF_KI_Spots_ColorChanger the rule gets run and this in turn sends the command to the Grp_Lights_FF_KI_Spots_Color group.

The above works for my use case since I mostly use voice, but it should be noted that this won’t sync a color change from one bulb.

As a side note, when I did set this up the Color Picker would not be displayed if the ColorChanger item did not have a value. I fixed this by running a rule on startup to set all members of the Settings_ColorChanger group to a default value.

For further reference:

1 Like