Description
A common scenario for a thermostat's is that they have a limited operation range. To support these ranges the xml thing type structure has min, max and step xml attributes. After the introduction of UoM, these attributes where not adapted. Binding's now typically have a state pattern of %unit%
and a unitHint
set. The min/max/step is hardcoded to a value and it is not known to what unit it relates.
To workaround this, bindings often choose to support the widest range. With that i mean, the min is set to the value corrosponding to the Celsius and max to the Fahrenheit representation of the operating range. It is obvious that this gives issues. as the actual operating range is more limited.
I would propose to add a xml attribute next to min, max, step to specify the unit for that range: "rangeUnit" It's value would be the actual unit just like unitHint
. This attribute could be used to determine the min/max/step. This can happen at the same place, just with a little UoM logic added.
If the attribute is missing it would fallback to the current behaviour. So an opt-in, full backwards comptable solution that handles all cases.
Alternatives:
Use unitHint
to determine the used unit. Rules out here: openhab/openhab-addons#17638 (comment) (in essence: this is a UI hint and should not be misused for something else)
Use state
pattern. This would not cover all bindings as many have it set to %unit%
Related to: #3132
Related to: openhab/openhab-addons#17638 (solving this for just mireds/mireks)