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

@@ -32,7 +32,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.unit.MetricPrefix;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus;
@@ -167,24 +167,24 @@ public class VelbusVMB4ANHandler extends VelbusSensorWithAlarmClockHandler {
double voltageResolution = 0.25;
double voltageSensorValueState = sensorValue * voltageResolution;
updateState(channelUID,
new QuantityType<>(voltageSensorValueState, MetricPrefix.MILLI(SmartHomeUnits.VOLT)));
new QuantityType<>(voltageSensorValueState, MetricPrefix.MILLI(Units.VOLT)));
break;
case CURRENT_SENSOR_TYPE:
double currentResolution = 5;
double currentSensorValueState = sensorValue * currentResolution;
updateState(channelUID,
new QuantityType<>(currentSensorValueState, MetricPrefix.MICRO(SmartHomeUnits.AMPERE)));
new QuantityType<>(currentSensorValueState, MetricPrefix.MICRO(Units.AMPERE)));
break;
case RESISTANCE_SENSOR_TYPE:
double resistanceResolution = 0.25;
double resistanceSensorValueState = sensorValue * resistanceResolution;
updateState(channelUID, new QuantityType<>(resistanceSensorValueState, SmartHomeUnits.OHM));
updateState(channelUID, new QuantityType<>(resistanceSensorValueState, Units.OHM));
break;
case PERIOD_MEASUREMENT_SENSOR_TYPE:
double periodResolution = 0.5;
double periodSensorValueState = sensorValue * periodResolution;
updateState(channelUID,
new QuantityType<>(periodSensorValueState, MetricPrefix.MICRO(SmartHomeUnits.SECOND)));
new QuantityType<>(periodSensorValueState, MetricPrefix.MICRO(Units.SECOND)));
break;
}
} else if (command == COMMAND_TEXT) {

View File

@@ -28,7 +28,7 @@ import org.openhab.binding.velbus.internal.packets.VelbusSensorReadoutRequestPac
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.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingTypeUID;
@@ -125,7 +125,7 @@ public class VelbusVMBMeteoHandler extends VelbusTemperatureSensorHandler {
double windValue = (((highByteCurrentWindValue & 0xff) << 8) + (lowByteCurrentWindValue & 0xff)) / 10;
QuantityType<Length> rainValueState = new QuantityType<>(rainValue, MetricPrefix.MILLI(SIUnits.METRE));
QuantityType<Illuminance> lightValueState = new QuantityType<>(lightValue, SmartHomeUnits.LUX);
QuantityType<Illuminance> lightValueState = new QuantityType<>(lightValue, Units.LUX);
QuantityType<Speed> windValueState = new QuantityType<>(windValue, SIUnits.KILOMETRE_PER_HOUR);
updateState(rainfallChannel, rainValueState);

View File

@@ -24,7 +24,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.velbus.internal.packets.VelbusLightValueRequestPacket;
import org.openhab.binding.velbus.internal.packets.VelbusPacket;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SmartHomeUnits;
import org.openhab.core.library.unit.Units;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus;
@@ -86,7 +86,7 @@ public class VelbusVMBPIROHandler extends VelbusTemperatureSensorHandler {
byte lowByteCurrentLightValue = packet[7];
double lightValue = (((highByteCurrentLightValue & 0xff) << 8) + (lowByteCurrentLightValue & 0xff));
QuantityType<Illuminance> lightValueState = new QuantityType<>(lightValue, SmartHomeUnits.LUX);
QuantityType<Illuminance> lightValueState = new QuantityType<>(lightValue, Units.LUX);
updateState(illuminanceChannel, lightValueState);
}
}