If I override the default standalone widget (by the metadata menu) with Knob for instance the default range is 0 to 100.
If I select a value (10 for instance) it will be passed to the “org.openhab.core.thing.binding.ThingHandler.handleCommand(ChannelUID, Command)” method even if that channel as a min of 1700.
Is that normal ?
Should I retrieve the state configuration min/max inside this method to compare it with the value set by the user ? Is that even possible ?
Does the state is only used by item type that have a user action by default ? Like dimmer ?
If I set my item-type to Dimmer instead of Number the default widget looks good but it fail to set the state since It expect a value between 0 and 100.
My understanding, which could be way off, is that a binding can set some default parameters for the State Description metadata on an Item at Link time. However, if the user comes along and changes that metadata later, whatever the user does takes precedence (as it should)…
I think the min, max, options and such in the State Description metadata are applied when the default widget as chosen by MainUI is used. For example, if I have a Setpoint tagged Item, a Slider widget will be selected by MainUI and it will use the min/max/etc values from the State Description.
However, if the user supplies their own default widget metadata, the State Description values are ignored (unless the user explicitly references them which I’m not entirely certain is even possible actually).
I do not think there is a way for a binding to supply a default widget Item metadata.
Interesting,
My understanding was that since the binding channel is the link to the device the state from the channel-type would have been the limit of the thing.
Is there a way to retrieve the “default state” of the channel-type from code ?
If I create an item with class “Point_Setpoint” linked to my channel of type Number with min and max I get an oh-input-card without any min/max: