Open lsiepel opened 15 hours ago
TLDR think of DynamicStateDescriptionProvider providing state options for the channels.
Long version: Have a look at the tado binding which I think does this quite well. Its speciality is that the tado a/c thermostats can talk to a/c units from a huge range of manufacturers. And as you know different a/c manufactures do multi speed fans in multiple different ways .. ranging from the "classic" LOW/MEDIUM/HIGH to more "exotic" ones with (e.g. ECO, SILENT, BOOST, TURBO etc.).
On start up, the tado binding asks the thermostat for its range of state options (SILENT/LOW/MEDIUM/HIGH/TURBO or whatever) and it creates a DynamicStateDescriptionProvider component that provides those particular state options for the respective fan speed channel.
If I'm reading you right, the more exotic ones are an argument for Number (or even String, in the case of Tado) channels, with descriptions for each option. I don't think a DynamicStateDescriptionProvider really factors in to this - some bindings may be dynamic, while some bindings are static and can just put the information in the thing type XML.
But you bring up something I don't normally think of - when I say "fan" I'm referring more to "ceiling fan" or "exhaust fan", and less "blower in an air circulation system, connected to a thermostat". I think the latter is more likely to have the exotic modes, though the Wiz binding is definitely for ceiling fans, and has a "Breeze" mode (separate from numeric speed control).
I think my preference would be:
I would model a multi speed fan as a string with multiple state options (which can as you say be modelled either statically in the state options xml, or dynamically via a state description provider.
The latter two have a little bit of precedent when dealing with a light bulb that supports dimming (or color) and color temperature. My experience with those things is it can be very inconsistent if the color temperature channel goes to NULL or UNDEF when the light is OFF, or if it stays at its previous value (and what it would return to if it turns back on). It's also inconsistent if sending a command to the color temperature channel will turn the bulb on if it's currently off.
In a slightly different way, there is precedent with color temperature to model as a Dimmer and a Number.
So... thoughts?
All of these questions could probably use some explanation and reasoning in the FAQ at https://www.openhab.org/docs/developer/addons/faq.html#modelling-channels.
Originally posted by @ccutrer in https://github.com/openhab/openhab-addons/issues/17813#issuecomment-2505109193