diff --git a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/unit/Units.java b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/unit/Units.java index 824d531f801..f3e220fb152 100644 --- a/bundles/org.openhab.core/src/main/java/org/openhab/core/library/unit/Units.java +++ b/bundles/org.openhab.core/src/main/java/org/openhab/core/library/unit/Units.java @@ -293,7 +293,9 @@ public final class Units extends CustomUnits { SimpleUnitFormat.getInstance().label(MILLIAMPERE_HOUR, "mAh"); SimpleUnitFormat.getInstance().label(MILLIBAR, "mbar"); SimpleUnitFormat.getInstance().label(MILLIMETRE_OF_MERCURY, MILLIMETRE_OF_MERCURY.getSymbol()); - SimpleUnitFormat.getInstance().label(MIRED, "mired"); + SimpleUnitFormat.getInstance().label(MIRED, "MK⁻¹"); + SimpleUnitFormat.getInstance().alias(MIRED, "mired"); + SimpleUnitFormat.getInstance().alias(MIRED, "mirek"); SimpleUnitFormat.getInstance().label(PARTS_PER_BILLION, "ppb"); SimpleUnitFormat.getInstance().label(PARTS_PER_MILLION, "ppm"); SimpleUnitFormat.getInstance().label(PETABYTE, "PB"); diff --git a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/unit/UnitsTest.java b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/unit/UnitsTest.java index 74ef456bb01..f88cb2a6bb5 100644 --- a/bundles/org.openhab.core/src/test/java/org/openhab/core/library/unit/UnitsTest.java +++ b/bundles/org.openhab.core/src/test/java/org/openhab/core/library/unit/UnitsTest.java @@ -431,6 +431,17 @@ public void testYearMonthDay() { assertThat(converted2.doubleValue(), is(closeTo(12.0, DEFAULT_ERROR))); } + @Test + public void testColorTemperatureAliases() { + QuantityType value; + value = QuantityType.valueOf("20 mired"); + assertEquals(Units.MIRED, value.getUnit()); + value = QuantityType.valueOf("20 mirek"); + assertEquals(Units.MIRED, value.getUnit()); + value = QuantityType.valueOf("20 MK⁻¹"); + assertEquals(Units.MIRED, value.getUnit()); + } + private static class QuantityEquals extends IsEqual> { private Quantity quantity;