openhab-core icon indicating copy to clipboard operation
openhab-core copied to clipboard

support " and ' as a valid units for inches and feet

Open robnielsen opened this issue 2 years ago • 2 comments

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.

robnielsen avatar Apr 14 '23 19:04 robnielsen

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.

J-N-K avatar Apr 15 '23 13:04 J-N-K

In parts of world where inch and feet are not used, simple and double quotes are naturally for seconds and minutes.

lolodomo avatar May 02 '24 10:05 lolodomo