Use renamed Units class (#9267)

Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
Wouter Born
2020-12-07 10:34:02 +01:00
committed by GitHub
parent d0480d0f2e
commit ac6f08908f
208 changed files with 1087 additions and 1169 deletions

View File

@@ -14,7 +14,7 @@ package org.openhab.binding.lcn.internal.converter;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.library.unit.SIUnits;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
/**
* Holds all Converter objects.
@@ -34,12 +34,12 @@ public class Converters {
static {
TEMPERATURE = new ValueConverter(SIUnits.CELSIUS, n -> (n - 1000) / 10d, h -> Math.round(h * 10) + 1000);
LIGHT = new ValueConverter(SmartHomeUnits.LUX, Converters::lightToHumanReadable, Converters::lightToNative);
CO2 = new ValueConverter(SmartHomeUnits.PARTS_PER_MILLION, n -> (double) n, Math::round);
CURRENT = new ValueConverter(SmartHomeUnits.AMPERE, n -> n / 100d, h -> Math.round(h * 100));
VOLTAGE = new ValueConverter(SmartHomeUnits.VOLT, n -> n / 400d, h -> Math.round(h * 400));
ANGLE = new ValueConverter(SmartHomeUnits.DEGREE_ANGLE, n -> (n - 1000) / 10d, Converters::angleToNative);
WINDSPEED = new ValueConverter(SmartHomeUnits.METRE_PER_SECOND, n -> n / 10d, h -> Math.round(h * 10));
LIGHT = new ValueConverter(Units.LUX, Converters::lightToHumanReadable, Converters::lightToNative);
CO2 = new ValueConverter(Units.PARTS_PER_MILLION, n -> (double) n, Math::round);
CURRENT = new ValueConverter(Units.AMPERE, n -> n / 100d, h -> Math.round(h * 100));
VOLTAGE = new ValueConverter(Units.VOLT, n -> n / 400d, h -> Math.round(h * 400));
ANGLE = new ValueConverter(Units.DEGREE_ANGLE, n -> (n - 1000) / 10d, Converters::angleToNative);
WINDSPEED = new ValueConverter(Units.METRE_PER_SECOND, n -> n / 10d, h -> Math.round(h * 10));
IDENTITY = new ValueConverter(null, n -> (double) n, Math::round);
}

View File

@@ -16,7 +16,7 @@ import java.math.BigDecimal;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,7 +31,7 @@ public class S0Converter extends ValueConverter {
protected double pulsesPerKwh;
public S0Converter(@Nullable Object parameter) {
super(SmartHomeUnits.WATT, n -> 0d, h -> 0L);
super(Units.WATT, n -> 0d, h -> 0L);
if (parameter == null) {
pulsesPerKwh = 1000;