Use renamed Units class (#9267)
Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
@@ -23,7 +23,7 @@ import org.openhab.core.library.types.DecimalType;
|
||||
import org.openhab.core.library.types.IncreaseDecreaseType;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.types.UpDownType;
|
||||
import org.openhab.core.library.unit.SmartHomeUnits;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.StateDescriptionFragmentBuilder;
|
||||
import org.openhab.core.types.UnDefType;
|
||||
@@ -110,7 +110,7 @@ public class NumberValue extends Value {
|
||||
} else if (command instanceof QuantityType<?>) {
|
||||
QuantityType<?> qType = (QuantityType<?>) command;
|
||||
|
||||
if (qType.getUnit().isCompatible(SmartHomeUnits.ONE)) {
|
||||
if (qType.getUnit().isCompatible(Units.ONE)) {
|
||||
newValue = qType.toBigDecimal();
|
||||
} else {
|
||||
qType = qType.toUnit(unit);
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.openhab.core.library.types.PercentType;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.library.types.UpDownType;
|
||||
import org.openhab.core.library.unit.SmartHomeUnits;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.StateDescriptionFragmentBuilder;
|
||||
import org.openhab.core.types.UnDefType;
|
||||
@@ -87,7 +87,7 @@ public class PercentageValue extends Value {
|
||||
} else //
|
||||
// A quantity type need to be converted according to the current min/max values
|
||||
if (command instanceof QuantityType) {
|
||||
QuantityType<?> qty = ((QuantityType<?>) command).toUnit(SmartHomeUnits.PERCENT);
|
||||
QuantityType<?> qty = ((QuantityType<?>) command).toUnit(Units.PERCENT);
|
||||
if (qty != null) {
|
||||
BigDecimal v = qty.toBigDecimal();
|
||||
v = v.subtract(min).multiply(HUNDRED).divide(max.subtract(min), MathContext.DECIMAL128);
|
||||
|
||||
Reference in New Issue
Block a user