[SOLVED] Clarification required for use of prefixes with UoM (Units of Measurements)

Hi all,

According to the docs:

The ‘MetricPrefix’ class provides prefixes like MILLI, CENTI, HECTO, etc. which are wrappers to create derived units.

Sounds great!

But what it the syntax to use for the prefixes?
Are there any examples?

Thanks

The Reference:
https://www.eclipse.org/smarthome/blog/2018/02/22/units-of-measurement.html
Example:

Thanks @hr3
I have read that and there is virtually no information about the use of prefixes and the syntax.

All there is is:

Coding the UoM
Packages
When using units, metric prefixes (like MILLI, CENTI, HECTO, …) and dimensions please make sure to use the following package imports: For units and metric prefixes use org.eclipse.smarthome.core.library.unit package, for dimensions use the org.eclipse.smarthome.core.library.dimension or the official javax.measure.quantity package.

That’s it…

That is why I am asking about the prefixes

The example to convert temperature to Fahrenheit, use °C to get Celsius etc.

Number:Temperature temperature "Outside [%.2f °F]" { channel="...:current#temperature" }

Show the unit

"Outside [%.2f %unit%]"

Thanks I know that
I am asking specifically about the use of PREFIXES

MILLI, CENTI, KILO, YOTTA…

1 Like

@hr3
Thanks but I know what the SI prefixes are. What I am asking is how do I use then in openHAB. What is the syntax?

Is it just to add m in front of the symbol like mA for millamps?

Thanks

Yes, try out.

Cool thanks

A other interesting possibility

var fahrenheit = myTemperature.toUnit("°F")

Oooohhhhhh!!!
Me Likey