Binding filtering selection list based on thing brand/model

I’m looking for a binding that filters the list for selection widget based on thing brand/model. I have a Denon DRA-100 device that has 9 source inputs and current denonmarant binding captures only 3 of them, but shows 40 in total. I want to make the binding more usable by showing only those inputs relevant to my model, not all possible options, most of them not working. The background info.
I could probably code it myself, but if there is an existing solution I’d be happy to copy it :grinning:

Alternatively if there is a typical openHAB solution that allows showing only the source inputs relevant to my thing model - please enlighten me :grinning:

Maybe a ConfigOptionProvider would be the solution?

Another solution would be to have different Thing-types for different models, and define the state options on the Channel for each model instead of on the Channel-type. But in either case it would mean you’d have to know the configuration of every different supported model (or have a generic Thing-type with all different inputs and add specific models as required).

1 Like

If you think of config parameters for binding then there are several combinations you can use. First of call declare <context> in your parameter, then you can pick one of below values handled out of the box by main-ui:

Namely, if you declare parameter such as:

      <parameter name="referenceThing" type="text" >
        <label>Another thing</label>
        <context>Thing</context>
      </parameter>

You will get thing selection dropbox for that parameter when editing configuration.

1 Like

Thank you both! I need to do more reading to fully understand your answers - I started playing with openhab a few days ago.
At the usability level: could I assume all currently supported models use all currently provided source inputs, and initially only my model (DRA-100) would get proper source input list? That would keep the functionality for all existing users at the same level (I mean: “here you have your 40 inputs”). Later on the new code could be used to improve the situation, if we have testers with other denon/marantz devices.

A little more to the story: It’s possible on many receivers to delete input sources - from the manual of my good old AVR-3808:

Source Delete
Remove input sources that are not used from the display.

Additionally, you can rename the corresponding texts, for example “DVR” → “Squeeze” etc.

So the ideal filtering would take this into account. For me, model-specific filtering would only be a slight improvement, since I would still have too many sources compared to the ones actually assigned and used. And I wouldn’t be able to remember their usages from the raw names printed on the back of the receiver.

So using the input source list in the current form directly in a UI seems not ideal or even intended. You will get better results from filtering in the widget, sitemap or other UI you are using.

1 Like

I mis-interpreted the original request, I didn’t notice we are not talking about channel configuration but channel state.

I guess you can get the available texts from the device, correct? Then a StateDescriptionProvider would be the way to go. You add a new DenonStateDescriptionProvider (extending BaseDynamicStateDescriptionProvider), that is injected into handler factory and pass it to the thing handler (see e.g. deconz binding how to do that) . The thing handler then can set the available inputs for each channel (identified by the UID, so if you have different things, you can set different options per thing).

1 Like

Thanks again for all replies!
My device doesn’t give the Source Inputs - it’s from the manual. I think the best would be allow user to select which one should show up - I have 9 inputs, but only 3 are in use.
I’ll try to code in the direction provided by Jan, we’ll se how far I can go :grinning: