Handle group commands in binding

Is there a way that an item’s binding can handle and consolidate commands to a group?

My use case is the following: My Thing has multiple dimmer outputs (each is one Channel), which can be controlled all at the same time with a single native command. Using OpenHAB groups would be possible, but the outputs would not dim 100% synchronously, because the commands are sent one after the other and one dimmer output would start slightly before the other.

Thanks!

I would expect a binding like that to offer a separate Channel to control the set of Dimmers with one Item. That Channel would basically represent that single native command.

I can’t speak for how to code it, but that is how I would expect it to work from a user’s perspective.

I guess one way of doing it would be:

  1. Create a separate set of ‘value’ dimmer channels that save what they have been set to in the ThingHandler but do not immediately propagate the update commands
  2. Create a ‘set’ channel that triggers sending the single command with the values of all the ‘value’ channels.

If you wanted to get really fancy you may even be able to create a ‘scene’ channel using that kind of method.

Thank you both for your ideas! A third approach came to my mind, which I finally realized:

I implemented a Profile, which can be optionally applied to a dimmer output Item. When the Profile’s argument is true, all outputs are controlled when switching the Item:

Dimmer Out {channel="lcn:module:aaa:bbb:output#1"[profile="lcn:output", controlAllOutputs=true]}

Wow, I’m curious now …

Bindings can add custom profile capabilities? Are those restricted to the binding’s own channels?

Profiles can affect the Item -> channel -> binding path? Only seen them used for channel -> Item to date.

Profiles can handle commands from Items, before they arrive at the binding. In this case, the Profile translates the PercentType/OnOffType into a custom Command object, to which the argument from the Item definition is added. The binding handler can handle this custom Command object in a special manner, then. I don’t think Profiles packaged with a binding are restricted to the binding’s Channels.

I must admit, I don’t know if this is the intented use for a Profile, but it works.

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