diff --git a/bundles/org.connectorio.addons.binding.askoheat/src/main/java/org/connectorio/addons/binding/askoheat/internal/handler/AskoheatBridgeHandler.java b/bundles/org.connectorio.addons.binding.askoheat/src/main/java/org/connectorio/addons/binding/askoheat/internal/handler/AskoheatBridgeHandler.java index e049e83d..4442fc1b 100644 --- a/bundles/org.connectorio.addons.binding.askoheat/src/main/java/org/connectorio/addons/binding/askoheat/internal/handler/AskoheatBridgeHandler.java +++ b/bundles/org.connectorio.addons.binding.askoheat/src/main/java/org/connectorio/addons/binding/askoheat/internal/handler/AskoheatBridgeHandler.java @@ -108,9 +108,9 @@ public void run() { ValueBlock params = client.getValueBlock(); getCallback().stateUpdated(new ChannelUID(getThing().getUID(), "status"), new DecimalType(params.getStatus())); getCallback().stateUpdated(new ChannelUID(getThing().getUID(), "load"), QuantityType.valueOf(params.getLoad(), Units.WATT)); - getCallback().stateUpdated(new ChannelUID(getThing().getUID(), "temperatureLimit"), QuantityType.valueOf(params.getTemperatureLimit(), tec.uom.se.unit.Units.CELSIUS)); - getCallback().stateUpdated(new ChannelUID(getThing().getUID(), "temperatureSensor0"), QuantityType.valueOf(params.getTemperatureSensor0(), tec.uom.se.unit.Units.CELSIUS)); - getCallback().stateUpdated(new ChannelUID(getThing().getUID(), "maximumTemperature"), QuantityType.valueOf(params.getMaximumTemperature(), tec.uom.se.unit.Units.CELSIUS)); + getCallback().stateUpdated(new ChannelUID(getThing().getUID(), "temperatureLimit"), QuantityType.valueOf(params.getTemperatureLimit(), tech.units.indriya.unit.Units.CELSIUS)); + getCallback().stateUpdated(new ChannelUID(getThing().getUID(), "temperatureSensor0"), QuantityType.valueOf(params.getTemperatureSensor0(), tech.units.indriya.unit.Units.CELSIUS)); + getCallback().stateUpdated(new ChannelUID(getThing().getUID(), "maximumTemperature"), QuantityType.valueOf(params.getMaximumTemperature(), tech.units.indriya.unit.Units.CELSIUS)); } }, 1000L, getRefreshInterval(), TimeUnit.MILLISECONDS)); tasks.add(scheduler.scheduleAtFixedRate(new Runnable() { diff --git a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/TAUnits.java b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/TAUnits.java index 04631953..924d0f7f 100644 --- a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/TAUnits.java +++ b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/TAUnits.java @@ -22,10 +22,10 @@ import javax.measure.quantity.Length; import org.openhab.core.library.unit.MetricPrefix; import org.openhab.core.library.unit.SIUnits; -import tec.uom.se.AbstractConverter; -import tec.uom.se.AbstractUnit; -import tec.uom.se.format.SimpleUnitFormat; -import tec.uom.se.unit.TransformedUnit; +import tech.units.indriya.AbstractUnit; +import tech.units.indriya.format.SimpleUnitFormat; +import tech.units.indriya.function.AbstractConverter; +import tech.units.indriya.unit.TransformedUnit; public class TAUnits { diff --git a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/config/AnalogUnit.java b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/config/AnalogUnit.java index bf18e6c1..8705e0ed 100644 --- a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/config/AnalogUnit.java +++ b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/config/AnalogUnit.java @@ -30,7 +30,7 @@ import org.openhab.core.library.unit.MetricPrefix; import org.openhab.core.library.unit.SIUnits; import org.openhab.core.library.unit.Units; -import tec.uom.se.AbstractUnit; +import tech.units.indriya.AbstractUnit; public enum AnalogUnit implements TAUnit { @@ -58,14 +58,14 @@ public enum AnalogUnit implements TAUnit { /* 22 analog */ LITRE_PER_MINUTE (22, Units.LITRE_PER_MINUTE, 1), /* 23 analog */ BAR (23, Units.BAR, 0.01), /* 24 analog */ POWER_FACTOR(24, AbstractUnit.ONE, 0.01), - /* 25 analog */ KILO_METRE (25, MetricPrefix.KILO(tec.uom.se.unit.Units.METRE), 1), - /* 26 analog */ METRE (26, tec.uom.se.unit.Units.METRE, 1), - /* 27 analog */ MILLIMETER (27, MetricPrefix.MILLI(tec.uom.se.unit.Units.METRE), 1), - /* 28 analog */ CUBIC_METRE (28, tec.uom.se.unit.Units.CUBIC_METRE, 1), - /* 29 analog */ HERTZ_KM_HOUR (29, Units.HERTZ.divide(MetricPrefix.KILO(tec.uom.se.unit.Units.METRE).divide(Units.HOUR)), 1), - /* 30 analog */ HERTZ_M_SECOND (30, Units.HERTZ.divide(tec.uom.se.unit.Units.METRE.divide(Units.SECOND)), 1), + /* 25 analog */ KILO_METRE (25, MetricPrefix.KILO(SIUnits.METRE), 1), + /* 26 analog */ METRE (26, SIUnits.METRE, 1), + /* 27 analog */ MILLIMETER (27, MetricPrefix.MILLI(SIUnits.METRE), 1), + /* 28 analog */ CUBIC_METRE (28, SIUnits.CUBIC_METRE, 1), + /* 29 analog */ HERTZ_KM_HOUR (29, Units.HERTZ.divide(MetricPrefix.KILO(SIUnits.METRE).divide(Units.HOUR)), 1), + /* 30 analog */ HERTZ_M_SECOND (30, Units.HERTZ.divide(SIUnits.METRE.divide(Units.SECOND)), 1), /* 31 analog */ KILOWATT_PER_IMPULSE (31, Units.KILOWATT_HOUR.divide(TAUnits.IMPULSE), 1), - /* 32 analog */ CUBICMETRE_PER_IMPULSE (32, tec.uom.se.unit.Units.CUBIC_METRE.divide(TAUnits.IMPULSE), 1), + /* 32 analog */ CUBICMETRE_PER_IMPULSE (32, SIUnits.CUBIC_METRE.divide(TAUnits.IMPULSE), 1), /* 33 analog */ MILLIMETRE_PER_IMPULSE(33, TAUnits.MILLIMETRE.divide(TAUnits.IMPULSE), 1), /* 34 analog */ LITER_PER_IMPULSE (34, Units.LITRE.divide(TAUnits.IMPULSE), 1), /* 35 analog */ LITER_PER_DAY (35, Units.LITRE.divide(Units.DAY), 1), diff --git a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/config/ComplexUnit.java b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/config/ComplexUnit.java index f68b4243..78bf0b11 100644 --- a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/config/ComplexUnit.java +++ b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/config/ComplexUnit.java @@ -24,8 +24,8 @@ import java.util.stream.Collectors; import org.connectorio.addons.binding.canopen.ta.internal.type.TAUnit; -import tec.uom.se.quantity.Quantities; -import tec.uom.se.unit.Units; +import org.openhab.core.library.unit.SIUnits; +import tech.units.indriya.quantity.Quantities; /** * Compound units whcih require additional parsing. Result of computation is list and not single value. @@ -38,7 +38,7 @@ public enum ComplexUnit implements TAUnit { double value = 0.1 * (raw & 0x1FF) * (negative ? -1 : 1); return Arrays.asList( - Quantities.getQuantity(value, Units.CELSIUS), + Quantities.getQuantity(value, SIUnits.CELSIUS), (raw & 0x600) >> 9 ); }); diff --git a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/handler/channel/AnalogChannelHandler.java b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/handler/channel/AnalogChannelHandler.java index 7e0bd8d6..4221de49 100644 --- a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/handler/channel/AnalogChannelHandler.java +++ b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/handler/channel/AnalogChannelHandler.java @@ -32,7 +32,7 @@ import org.openhab.core.thing.binding.ThingHandlerCallback; import org.openhab.core.types.Command; import org.openhab.core.types.State; -import tec.uom.se.quantity.Quantities; +import tech.units.indriya.quantity.Quantities; public class AnalogChannelHandler extends BaseChannelHandler { diff --git a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/handler/channel/RASChannelHandler.java b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/handler/channel/RASChannelHandler.java index 1ce47ed2..943297e9 100644 --- a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/handler/channel/RASChannelHandler.java +++ b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/handler/channel/RASChannelHandler.java @@ -36,7 +36,7 @@ import org.openhab.core.types.State; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import tec.uom.se.quantity.Quantities; +import tech.units.indriya.quantity.Quantities; public class RASChannelHandler extends BaseChannelHandler { diff --git a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/type/TAValue.java b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/type/TAValue.java index d1fb3330..0eae88c7 100644 --- a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/type/TAValue.java +++ b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/internal/type/TAValue.java @@ -20,7 +20,7 @@ import org.connectorio.addons.binding.canopen.ta.internal.config.AnalogUnit; import org.connectorio.addons.binding.canopen.ta.internal.config.ComplexUnit; import org.connectorio.addons.binding.canopen.ta.internal.config.DigitalUnit; -import tec.uom.se.quantity.Quantities; +import tech.units.indriya.quantity.Quantities; public class TAValue { diff --git a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/tapi/val/BaseAnalogValue.java b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/tapi/val/BaseAnalogValue.java index 626982b2..9817865c 100644 --- a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/tapi/val/BaseAnalogValue.java +++ b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/tapi/val/BaseAnalogValue.java @@ -21,7 +21,7 @@ import javax.measure.Quantity; import org.connectorio.addons.binding.canopen.ta.internal.config.AnalogUnit; import org.connectorio.addons.binding.canopen.ta.internal.type.TAUnit; -import tec.uom.se.quantity.Quantities; +import tech.units.indriya.quantity.Quantities; public abstract class BaseAnalogValue implements AnalogValue { diff --git a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/tapi/val/RASValue.java b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/tapi/val/RASValue.java index d23a0d0d..d4701c7c 100644 --- a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/tapi/val/RASValue.java +++ b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/tapi/val/RASValue.java @@ -24,7 +24,7 @@ import org.apache.plc4x.java.spi.generation.WriteBuffer; import org.connectorio.addons.binding.canopen.ta.internal.config.AnalogUnit; import org.connectorio.addons.binding.canopen.ta.internal.type.TAUnit; -import tec.uom.se.quantity.Quantities; +import tech.units.indriya.quantity.Quantities; public class RASValue extends ShortAnalogValue { diff --git a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/tapi/val/ShortAnalogValue.java b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/tapi/val/ShortAnalogValue.java index 0ec44a10..ea437401 100644 --- a/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/tapi/val/ShortAnalogValue.java +++ b/bundles/org.connectorio.addons.binding.canopen.ta/src/main/java/org/connectorio/addons/binding/canopen/ta/tapi/val/ShortAnalogValue.java @@ -20,7 +20,6 @@ import javax.measure.Quantity; import org.connectorio.addons.binding.canopen.ta.internal.config.AnalogUnit; import org.connectorio.addons.binding.canopen.ta.internal.type.TAUnit; -import tec.uom.se.quantity.Quantities; public class ShortAnalogValue extends BaseAnalogValue { diff --git a/bundles/org.connectorio.addons.binding.canopen.ta/src/test/java/org/connectorio/addons/binding/canopen/ta/tapi/val/AnalogValueTest.java b/bundles/org.connectorio.addons.binding.canopen.ta/src/test/java/org/connectorio/addons/binding/canopen/ta/tapi/val/AnalogValueTest.java index d680afb8..ea94775e 100644 --- a/bundles/org.connectorio.addons.binding.canopen.ta/src/test/java/org/connectorio/addons/binding/canopen/ta/tapi/val/AnalogValueTest.java +++ b/bundles/org.connectorio.addons.binding.canopen.ta/src/test/java/org/connectorio/addons/binding/canopen/ta/tapi/val/AnalogValueTest.java @@ -25,8 +25,8 @@ import org.connectorio.addons.binding.canopen.ta.internal.config.AnalogUnit; import org.junit.jupiter.api.Test; import org.openhab.core.library.unit.Units; -import tec.uom.se.ComparableQuantity; -import tec.uom.se.quantity.Quantities; +import tech.units.indriya.ComparableQuantity; +import tech.units.indriya.quantity.Quantities; class AnalogValueTest { diff --git a/bundles/org.connectorio.addons.binding.canopen.ta/src/test/java/org/connectorio/addons/binding/canopen/ta/tapi/val/RASValueTest.java b/bundles/org.connectorio.addons.binding.canopen.ta/src/test/java/org/connectorio/addons/binding/canopen/ta/tapi/val/RASValueTest.java index ac86680d..00db7e7b 100644 --- a/bundles/org.connectorio.addons.binding.canopen.ta/src/test/java/org/connectorio/addons/binding/canopen/ta/tapi/val/RASValueTest.java +++ b/bundles/org.connectorio.addons.binding.canopen.ta/src/test/java/org/connectorio/addons/binding/canopen/ta/tapi/val/RASValueTest.java @@ -27,8 +27,8 @@ import org.connectorio.addons.binding.canopen.ta.internal.config.AnalogUnit; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import tec.uom.se.quantity.Quantities; -import tec.uom.se.unit.Units; +import org.openhab.core.library.unit.SIUnits; +import tech.units.indriya.quantity.Quantities; class RASValueTest { @@ -37,7 +37,7 @@ class RASValueTest { void verifyRasValue(Argument argument) { RASValue rasValue = new RASValue(argument.raw, AnalogUnit.TEMPERATURE_REGULATOR); - Quantity quantity = Quantities.getQuantity(argument.temperature, Units.CELSIUS); + Quantity quantity = Quantities.getQuantity(argument.temperature, SIUnits.CELSIUS); assertThat(rasValue.getValue().getValue().doubleValue()) .isCloseTo(quantity.getValue().doubleValue(), Percentage.withPercentage(1)); assertThat(rasValue.getMode()).isEqualTo(argument.mode); diff --git a/bundles/org.connectorio.addons.binding.canopen/src/main/java/org/connectorio/addons/binding/canopen/internal/statistics/BandwidthStatisticCollector.java b/bundles/org.connectorio.addons.binding.canopen/src/main/java/org/connectorio/addons/binding/canopen/internal/statistics/BandwidthStatisticCollector.java index 0e7ecc53..47d032c1 100644 --- a/bundles/org.connectorio.addons.binding.canopen/src/main/java/org/connectorio/addons/binding/canopen/internal/statistics/BandwidthStatisticCollector.java +++ b/bundles/org.connectorio.addons.binding.canopen/src/main/java/org/connectorio/addons/binding/canopen/internal/statistics/BandwidthStatisticCollector.java @@ -24,7 +24,7 @@ import org.openhab.core.library.dimension.DataAmount; import org.openhab.core.library.dimension.DataTransferRate; import org.openhab.core.library.unit.Units; -import tec.uom.se.quantity.Quantities; +import tech.units.indriya.quantity.Quantities; /** * Bit ratio calculation. diff --git a/bundles/org.connectorio.addons.binding.canopen/src/main/java/org/connectorio/addons/binding/canopen/internal/statistics/RatioStatisticCollector.java b/bundles/org.connectorio.addons.binding.canopen/src/main/java/org/connectorio/addons/binding/canopen/internal/statistics/RatioStatisticCollector.java index 414b0f6e..88e4df53 100644 --- a/bundles/org.connectorio.addons.binding.canopen/src/main/java/org/connectorio/addons/binding/canopen/internal/statistics/RatioStatisticCollector.java +++ b/bundles/org.connectorio.addons.binding.canopen/src/main/java/org/connectorio/addons/binding/canopen/internal/statistics/RatioStatisticCollector.java @@ -21,8 +21,8 @@ import java.util.function.Supplier; import javax.measure.Quantity; import javax.measure.quantity.Dimensionless; -import tec.uom.se.AbstractUnit; -import tec.uom.se.quantity.Quantities; +import tech.units.indriya.AbstractUnit; +import tech.units.indriya.quantity.Quantities; /** * Ratio calculation. diff --git a/bundles/org.connectorio.addons.binding.canopen/src/main/java/org/connectorio/addons/binding/canopen/internal/statistics/SysfsReader.java b/bundles/org.connectorio.addons.binding.canopen/src/main/java/org/connectorio/addons/binding/canopen/internal/statistics/SysfsReader.java index 882fc0d0..0c6f51e9 100644 --- a/bundles/org.connectorio.addons.binding.canopen/src/main/java/org/connectorio/addons/binding/canopen/internal/statistics/SysfsReader.java +++ b/bundles/org.connectorio.addons.binding.canopen/src/main/java/org/connectorio/addons/binding/canopen/internal/statistics/SysfsReader.java @@ -25,7 +25,7 @@ import javax.measure.Unit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import tec.uom.se.quantity.Quantities; +import tech.units.indriya.quantity.Quantities; public class SysfsReader> { diff --git a/bundles/org.connectorio.addons.binding.canopen/src/test/java/org/connectorio/addons/binding/canopen/internal/statistics/BandwidthStatisticCollectorTest.java b/bundles/org.connectorio.addons.binding.canopen/src/test/java/org/connectorio/addons/binding/canopen/internal/statistics/BandwidthStatisticCollectorTest.java index e9bc69b2..8b023dce 100644 --- a/bundles/org.connectorio.addons.binding.canopen/src/test/java/org/connectorio/addons/binding/canopen/internal/statistics/BandwidthStatisticCollectorTest.java +++ b/bundles/org.connectorio.addons.binding.canopen/src/test/java/org/connectorio/addons/binding/canopen/internal/statistics/BandwidthStatisticCollectorTest.java @@ -30,7 +30,7 @@ import org.openhab.core.library.dimension.DataAmount; import org.openhab.core.library.dimension.DataTransferRate; import org.openhab.core.library.unit.Units; -import tec.uom.se.quantity.Quantities; +import tech.units.indriya.quantity.Quantities; @ExtendWith(MockitoExtension.class) class BandwidthStatisticCollectorTest { @@ -52,8 +52,8 @@ protected Quantity readStatistic() { statistic.set(Quantities.getQuantity(0, Units.BYTE)); assertThat(collector.getStatistic()) .extracting(Quantity::getValue) - .extracting(Number::intValue) - .isEqualTo(0); + .extracting(Number::doubleValue) + .isEqualTo(0.0); // one second and one byte later we expect 8 bit/s ratio. when(clock.get()).thenReturn(2000L); diff --git a/bundles/org.connectorio.addons.binding.canopen/src/test/java/org/connectorio/addons/binding/canopen/internal/statistics/RatioStatisticCollectorTest.java b/bundles/org.connectorio.addons.binding.canopen/src/test/java/org/connectorio/addons/binding/canopen/internal/statistics/RatioStatisticCollectorTest.java index f7eab5f8..6acd2d15 100644 --- a/bundles/org.connectorio.addons.binding.canopen/src/test/java/org/connectorio/addons/binding/canopen/internal/statistics/RatioStatisticCollectorTest.java +++ b/bundles/org.connectorio.addons.binding.canopen/src/test/java/org/connectorio/addons/binding/canopen/internal/statistics/RatioStatisticCollectorTest.java @@ -28,8 +28,8 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import tec.uom.se.AbstractUnit; -import tec.uom.se.quantity.Quantities; +import tech.units.indriya.AbstractUnit; +import tech.units.indriya.quantity.Quantities; @ExtendWith(MockitoExtension.class) class RatioStatisticCollectorTest { diff --git a/bundles/org.connectorio.addons.binding.relayweblog/src/main/java/org/connectorio/addons/binding/relayweblog/internal/handler/AbstractMeterThingHandler.java b/bundles/org.connectorio.addons.binding.relayweblog/src/main/java/org/connectorio/addons/binding/relayweblog/internal/handler/AbstractMeterThingHandler.java index 09dae412..83a5df42 100644 --- a/bundles/org.connectorio.addons.binding.relayweblog/src/main/java/org/connectorio/addons/binding/relayweblog/internal/handler/AbstractMeterThingHandler.java +++ b/bundles/org.connectorio.addons.binding.relayweblog/src/main/java/org/connectorio/addons/binding/relayweblog/internal/handler/AbstractMeterThingHandler.java @@ -53,6 +53,7 @@ import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.QuantityType; import org.openhab.core.library.unit.MetricPrefix; +import org.openhab.core.library.unit.SIUnits; import org.openhab.core.library.unit.Units; import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelUID; @@ -78,11 +79,11 @@ abstract class AbstractMeterThingHandler MAPPING = Map.of( - "kW", new MappingEntry(Power.class, MetricPrefix.KILO(tec.uom.se.unit.Units.WATT)), + "kW", new MappingEntry(Power.class, MetricPrefix.KILO(Units.WATT)), "kWh", new MappingEntry(Energy.class, Units.KILOWATT_HOUR), - "m^3", new MappingEntry(Volume.class, tec.uom.se.unit.Units.CUBIC_METRE), + "m^3", new MappingEntry(Volume.class, SIUnits.CUBIC_METRE), "m^3/h", new MappingEntry(VolumetricFlowRate.class, Units.CUBICMETRE_PER_HOUR), - "C", new MappingEntry(Temperature.class, tec.uom.se.unit.Units.CELSIUS), + "C", new MappingEntry(Temperature.class, SIUnits.CELSIUS), "h", new MappingEntry(Time.class, Units.HOUR), "s", new MappingEntry(Time.class, Units.SECOND) ); diff --git a/bundles/org.connectorio.addons.io.transport.serial.purejavacomm/src/main/java/org/connectorio/addons/io/transport/serial/purejavacomm/internal/PureJavaCommSerialPort.java b/bundles/org.connectorio.addons.io.transport.serial.purejavacomm/src/main/java/org/connectorio/addons/io/transport/serial/purejavacomm/internal/PureJavaCommSerialPort.java index c2794a89..a38cc6b5 100644 --- a/bundles/org.connectorio.addons.io.transport.serial.purejavacomm/src/main/java/org/connectorio/addons/io/transport/serial/purejavacomm/internal/PureJavaCommSerialPort.java +++ b/bundles/org.connectorio.addons.io.transport.serial.purejavacomm/src/main/java/org/connectorio/addons/io/transport/serial/purejavacomm/internal/PureJavaCommSerialPort.java @@ -49,6 +49,26 @@ public void setSerialPortParams(int baudrate, int dataBits, int stopBits, int pa } } + @Override + public int getBaudRate() { + return port.getBaudRate(); + } + + @Override + public int getDataBits() { + return port.getDataBits(); + } + + @Override + public int getStopBits() { + return port.getStopBits(); + } + + @Override + public int getParity() { + return port.getParity(); + } + @Override public InputStream getInputStream() throws IOException { return port.getInputStream(); @@ -114,6 +134,31 @@ public void notifyOnParityError(boolean enable) { port.notifyOnParityError(enable); } + @Override + public void notifyOnOutputEmpty(boolean enable) { + port.notifyOnOutputEmpty(enable); + } + + @Override + public void notifyOnCTS(boolean enable) { + port.notifyOnCTS(enable); + } + + @Override + public void notifyOnDSR(boolean enable) { + port.notifyOnDSR(enable); + } + + @Override + public void notifyOnRingIndicator(boolean enable) { + port.notifyOnRingIndicator(enable); + } + + @Override + public void notifyOnCarrierDetect(boolean enable) { + port.notifyOnCarrierDetect(enable); + } + @Override public void enableReceiveTimeout(int timeout) throws UnsupportedCommOperationException, IllegalArgumentException { try { @@ -137,6 +182,11 @@ public void setFlowControlMode(int flowcontrolRtsctsOut) throws UnsupportedCommO } } + @Override + public int getFlowControlMode() { + return port.getFlowControlMode(); + } + @Override public void enableReceiveThreshold(int i) throws UnsupportedCommOperationException { try { @@ -151,4 +201,44 @@ public void setRTS(boolean rts) { port.setRTS(rts); } + @Override + public boolean isRTS() { + return port.isRTS(); + } + + @Override + public void setDTR(boolean enable) { + port.setDTR(enable); + } + + @Override + public boolean isDTR() { + return port.isDTR(); + } + + @Override + public boolean isCTS() { + return port.isCTS(); + } + + @Override + public boolean isDSR() { + return port.isDSR(); + } + + @Override + public boolean isCD() { + return port.isCD(); + } + + @Override + public boolean isRI() { + return port.isRI(); + } + + @Override + public void sendBreak(int duration) { + port.sendBreak(duration); + } + } diff --git a/bundles/org.connectorio.addons.io.transport.serial.purejavacomm/src/main/java/org/connectorio/addons/io/transport/serial/purejavacomm/internal/PureJavaCommSerialPortIdentifier.java b/bundles/org.connectorio.addons.io.transport.serial.purejavacomm/src/main/java/org/connectorio/addons/io/transport/serial/purejavacomm/internal/PureJavaCommSerialPortIdentifier.java index 76323e11..c63b8a23 100644 --- a/bundles/org.connectorio.addons.io.transport.serial.purejavacomm/src/main/java/org/connectorio/addons/io/transport/serial/purejavacomm/internal/PureJavaCommSerialPortIdentifier.java +++ b/bundles/org.connectorio.addons.io.transport.serial.purejavacomm/src/main/java/org/connectorio/addons/io/transport/serial/purejavacomm/internal/PureJavaCommSerialPortIdentifier.java @@ -43,9 +43,7 @@ public SerialPort open(String owner, int timeout) throws PortInUseException { try { return new PureJavaCommSerialPort((purejavacomm.SerialPort) identifier.open(owner, timeout)); } catch (purejavacomm.PortInUseException e) { - PortInUseException exception = new PortInUseException(); - exception.initCause(e); - throw exception; + throw new PortInUseException(e); } } diff --git a/bundles/org.connectorio.addons.profile.boundary/src/test/java/org/connectorio/addons/profile/boundary/internal/LimitBottomQuantityProfileTest.java b/bundles/org.connectorio.addons.profile.boundary/src/test/java/org/connectorio/addons/profile/boundary/internal/LimitBottomQuantityProfileTest.java index a6208aae..82672658 100644 --- a/bundles/org.connectorio.addons.profile.boundary/src/test/java/org/connectorio/addons/profile/boundary/internal/LimitBottomQuantityProfileTest.java +++ b/bundles/org.connectorio.addons.profile.boundary/src/test/java/org/connectorio/addons/profile/boundary/internal/LimitBottomQuantityProfileTest.java @@ -20,6 +20,7 @@ import static org.mockito.Mockito.when; import java.util.HashMap; +import javax.measure.MetricPrefix; import javax.measure.Unit; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -31,8 +32,9 @@ import org.openhab.core.library.types.QuantityType; import org.openhab.core.thing.profiles.ProfileCallback; import org.openhab.core.thing.profiles.ProfileContext; -import tec.uom.se.unit.MetricPrefix; -import tec.uom.se.unit.Units; +import tech.units.indriya.unit.Units; +import javax.measure.MetricPrefix; +import javax.measure.Unit; @ExtendWith(MockitoExtension.class) public class LimitBottomQuantityProfileTest { diff --git a/bundles/org.connectorio.addons.profile.boundary/src/test/java/org/connectorio/addons/profile/boundary/internal/LimitRangeQuantityProfileTest.java b/bundles/org.connectorio.addons.profile.boundary/src/test/java/org/connectorio/addons/profile/boundary/internal/LimitRangeQuantityProfileTest.java index bbe9aec1..22405b8d 100644 --- a/bundles/org.connectorio.addons.profile.boundary/src/test/java/org/connectorio/addons/profile/boundary/internal/LimitRangeQuantityProfileTest.java +++ b/bundles/org.connectorio.addons.profile.boundary/src/test/java/org/connectorio/addons/profile/boundary/internal/LimitRangeQuantityProfileTest.java @@ -31,8 +31,8 @@ import org.openhab.core.library.types.QuantityType; import org.openhab.core.thing.profiles.ProfileCallback; import org.openhab.core.thing.profiles.ProfileContext; -import tec.uom.se.unit.MetricPrefix; -import tec.uom.se.unit.Units; +import javax.measure.MetricPrefix; +import tech.units.indriya.unit.Units; @ExtendWith(MockitoExtension.class) public class LimitRangeQuantityProfileTest { diff --git a/bundles/org.connectorio.addons.profile.boundary/src/test/java/org/connectorio/addons/profile/boundary/internal/LimitTopQuantityProfileTest.java b/bundles/org.connectorio.addons.profile.boundary/src/test/java/org/connectorio/addons/profile/boundary/internal/LimitTopQuantityProfileTest.java index 220ad38a..072c81ee 100644 --- a/bundles/org.connectorio.addons.profile.boundary/src/test/java/org/connectorio/addons/profile/boundary/internal/LimitTopQuantityProfileTest.java +++ b/bundles/org.connectorio.addons.profile.boundary/src/test/java/org/connectorio/addons/profile/boundary/internal/LimitTopQuantityProfileTest.java @@ -30,7 +30,7 @@ import org.openhab.core.library.types.QuantityType; import org.openhab.core.thing.profiles.ProfileCallback; import org.openhab.core.thing.profiles.ProfileContext; -import tec.uom.se.unit.Units; +import tech.units.indriya.unit.Units; @ExtendWith(MockitoExtension.class) public class LimitTopQuantityProfileTest { diff --git a/bundles/org.connectorio.addons.profile.counter/src/main/java/org/connectorio/addons/profile/counter/internal/EnergyCounterProfile.java b/bundles/org.connectorio.addons.profile.counter/src/main/java/org/connectorio/addons/profile/counter/internal/EnergyCounterProfile.java index 57be9ec4..ec07e247 100644 --- a/bundles/org.connectorio.addons.profile.counter/src/main/java/org/connectorio/addons/profile/counter/internal/EnergyCounterProfile.java +++ b/bundles/org.connectorio.addons.profile.counter/src/main/java/org/connectorio/addons/profile/counter/internal/EnergyCounterProfile.java @@ -27,13 +27,13 @@ import org.connectorio.addons.profile.counter.internal.state.DummyStateRetriever; import org.openhab.core.library.types.DecimalType; import org.openhab.core.library.types.QuantityType; +import org.openhab.core.library.unit.MetricPrefix; import org.openhab.core.library.unit.Units; import org.openhab.core.thing.profiles.ProfileCallback; import org.openhab.core.thing.profiles.ProfileContext; import org.openhab.core.thing.profiles.ProfileTypeUID; import org.openhab.core.types.Type; -import tec.uom.se.unit.MetricPrefix; -import tec.uom.se.unit.ProductUnit; +import tech.units.indriya.unit.ProductUnit; /** * Little utility profile which, based on power reading will calculate energy consumption.