openhab-core
openhab-core copied to clipboard
support " and ' as a valid units for inches and feet
Prior to openHAB 4, you could define a item with:
Number:Length nRainMonth "Rain This Month [%.03f\"]" {channel="netatmo:rain:home:indoor:rain:rainThisMonth"}
And events.log would properly convert the value to inches in events.log file. Now the file converts to ft instead of " (inches)
2023-04-03 17:57:48.838 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'nRainMonth' updated to 0.025590551181102362 ft
The request is to not only support in and ft as a valid units, but " and ' as well.
As I already said: You can set the state description to %.2f in and it's fine.
I see your use-case (and I agree that it is very common to use " for inch and ' for foot), but I also see that " is used as alias for seconds and ' for minutes. This is a problem, because unit labels are global, they are not restricted to the dimension "length" or "time". So we can't infer the dimension from the unit. The question is whether we think that " for inch is far more common than for seconds, in that case we could probably implement it.
In parts of world where inch and feet are not used, simple and double quotes are naturally for seconds and minutes.