Use renamed Units class (#9267)
Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
@@ -24,7 +24,7 @@ import org.openhab.binding.jeelink.internal.RollingReadingAverage;
|
||||
import org.openhab.binding.jeelink.internal.config.BufferedSensorConfig;
|
||||
import org.openhab.core.library.types.DecimalType;
|
||||
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.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.slf4j.Logger;
|
||||
@@ -61,13 +61,12 @@ public class Ec3kSensorHandler extends JeeLinkSensorHandler<Ec3kReading> {
|
||||
getThing().getUID().getId(), currentWatt, reading.getCurrentWatt(), maxWatt,
|
||||
reading.getConsumptionTotal(), reading.getApplianceTime(), reading.getSensorTime());
|
||||
|
||||
updateState(CURRENT_POWER_CHANNEL, new QuantityType<>(currentWatt, SmartHomeUnits.WATT));
|
||||
updateState(MAX_POWER_CHANNEL, new QuantityType<>(maxWatt, SmartHomeUnits.WATT));
|
||||
updateState(CURRENT_POWER_CHANNEL, new QuantityType<>(currentWatt, Units.WATT));
|
||||
updateState(MAX_POWER_CHANNEL, new QuantityType<>(maxWatt, Units.WATT));
|
||||
updateState(CONSUMPTION_CHANNEL,
|
||||
new QuantityType<>(reading.getConsumptionTotal(), SmartHomeUnits.WATT_HOUR));
|
||||
updateState(APPLIANCE_TIME_CHANNEL,
|
||||
new QuantityType<>(reading.getApplianceTime(), SmartHomeUnits.HOUR));
|
||||
updateState(SENSOR_TIME_CHANNEL, new QuantityType<>(reading.getSensorTime(), SmartHomeUnits.HOUR));
|
||||
new QuantityType<>(reading.getConsumptionTotal(), Units.WATT_HOUR));
|
||||
updateState(APPLIANCE_TIME_CHANNEL, new QuantityType<>(reading.getApplianceTime(), Units.HOUR));
|
||||
updateState(SENSOR_TIME_CHANNEL, new QuantityType<>(reading.getSensorTime(), Units.HOUR));
|
||||
updateState(RESETS_CHANNEL, new DecimalType(reading.getResets()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.openhab.binding.jeelink.internal.config.LaCrosseTemperatureSensorConf
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
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.Channel;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
@@ -130,8 +130,7 @@ public class LaCrosseTemperatureSensorHandler extends JeeLinkSensorHandler<LaCro
|
||||
getThing().getLabel(), getThing().getUID().getId(), temp, reading.getTemperature(),
|
||||
reading.getHumidity(), reading.isBatteryNew(), reading.isBatteryLow());
|
||||
updateState(TEMPERATURE_CHANNEL, new QuantityType<>(temp, SIUnits.CELSIUS));
|
||||
updateState(HUMIDITY_CHANNEL,
|
||||
new QuantityType<>(reading.getHumidity(), SmartHomeUnits.PERCENT));
|
||||
updateState(HUMIDITY_CHANNEL, new QuantityType<>(reading.getHumidity(), Units.PERCENT));
|
||||
updateState(BATTERY_NEW_CHANNEL, reading.isBatteryNew() ? OnOffType.ON : OnOffType.OFF);
|
||||
updateState(BATTERY_LOW_CHANNEL, reading.isBatteryLow() ? OnOffType.ON : OnOffType.OFF);
|
||||
} else {
|
||||
@@ -141,7 +140,7 @@ public class LaCrosseTemperatureSensorHandler extends JeeLinkSensorHandler<LaCro
|
||||
updateState(TEMPERATURE_CHANNEL + reading.getChannel(),
|
||||
new QuantityType<>(temp, SIUnits.CELSIUS));
|
||||
updateState(HUMIDITY_CHANNEL + reading.getChannel(),
|
||||
new QuantityType<>(reading.getHumidity(), SmartHomeUnits.PERCENT));
|
||||
new QuantityType<>(reading.getHumidity(), Units.PERCENT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.openhab.binding.jeelink.internal.JeeLinkSensorHandler;
|
||||
import org.openhab.binding.jeelink.internal.ReadingPublisher;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
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.ThingStatus;
|
||||
@@ -84,8 +84,7 @@ public class LgwSensorHandler extends JeeLinkSensorHandler<LgwReading> {
|
||||
hasHumidityChannel = true;
|
||||
}
|
||||
|
||||
updateState(HUMIDITY_CHANNEL,
|
||||
new QuantityType<>(reading.getHumidity(), SmartHomeUnits.PERCENT));
|
||||
updateState(HUMIDITY_CHANNEL, new QuantityType<>(reading.getHumidity(), Units.PERCENT));
|
||||
}
|
||||
|
||||
if (reading.hasPressure()) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.openhab.binding.jeelink.internal.ReadingPublisher;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
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.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.slf4j.Logger;
|
||||
@@ -63,8 +63,7 @@ public class Tx22SensorHandler extends JeeLinkSensorHandler<Tx22Reading> {
|
||||
updateState(TEMPERATURE_CHANNEL, new QuantityType<>(temp, SIUnits.CELSIUS));
|
||||
}
|
||||
if (reading.hasHumidity()) {
|
||||
updateState(HUMIDITY_CHANNEL,
|
||||
new QuantityType<>(reading.getHumidity(), SmartHomeUnits.PERCENT));
|
||||
updateState(HUMIDITY_CHANNEL, new QuantityType<>(reading.getHumidity(), Units.PERCENT));
|
||||
}
|
||||
if (reading.hasRain()) {
|
||||
updateState(RAIN_CHANNEL, new QuantityType<>(reading.getRain(), MILLI(SIUnits.METRE)));
|
||||
@@ -74,15 +73,15 @@ public class Tx22SensorHandler extends JeeLinkSensorHandler<Tx22Reading> {
|
||||
}
|
||||
if (reading.hasWindDirection()) {
|
||||
updateState(WIND_ANGLE_CHANNEL,
|
||||
new QuantityType<>(reading.getWindDirection(), SmartHomeUnits.DEGREE_ANGLE));
|
||||
new QuantityType<>(reading.getWindDirection(), Units.DEGREE_ANGLE));
|
||||
}
|
||||
if (reading.hasWindSpeed()) {
|
||||
updateState(WIND_STENGTH_CHANNEL,
|
||||
new QuantityType<>(reading.getWindSpeed(), SmartHomeUnits.METRE_PER_SECOND));
|
||||
new QuantityType<>(reading.getWindSpeed(), Units.METRE_PER_SECOND));
|
||||
}
|
||||
if (reading.hasWindGust()) {
|
||||
updateState(GUST_STRENGTH_CHANNEL,
|
||||
new QuantityType<>(reading.getWindGust(), SmartHomeUnits.METRE_PER_SECOND));
|
||||
new QuantityType<>(reading.getWindGust(), Units.METRE_PER_SECOND));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.openhab.binding.jeelink.internal.ReadingPublisher;
|
||||
import org.openhab.binding.jeelink.internal.config.Pca301SensorConfig;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
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.types.Command;
|
||||
@@ -105,8 +105,8 @@ public class Pca301SensorHandler extends JeeLinkSensorHandler<Pca301Reading> {
|
||||
BigDecimal current = new BigDecimal(reading.getCurrent()).setScale(1, RoundingMode.HALF_UP);
|
||||
state = reading.isOn() ? OnOffType.ON : OnOffType.OFF;
|
||||
|
||||
updateState(CURRENT_POWER_CHANNEL, new QuantityType<>(current, SmartHomeUnits.WATT));
|
||||
updateState(CONSUMPTION_CHANNEL, new QuantityType<>(reading.getTotal(), SmartHomeUnits.WATT_HOUR));
|
||||
updateState(CURRENT_POWER_CHANNEL, new QuantityType<>(current, Units.WATT));
|
||||
updateState(CONSUMPTION_CHANNEL, new QuantityType<>(reading.getTotal(), Units.WATT_HOUR));
|
||||
updateState(SWITCHING_STATE_CHANNEL, state);
|
||||
|
||||
logger.debug("updated states for thing {} ({}): state={}, current={}, total={}",
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.openhab.binding.jeelink.internal.JeeLinkSensorHandler;
|
||||
import org.openhab.binding.jeelink.internal.ReadingPublisher;
|
||||
import org.openhab.core.library.types.DecimalType;
|
||||
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.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.slf4j.Logger;
|
||||
@@ -60,13 +60,12 @@ public class RevoltSensorHandler extends JeeLinkSensorHandler<RevoltReading> {
|
||||
getThing().getUID().getId(), power, powerFactor, consumption, current, reading.getVoltage(),
|
||||
reading.getFrequency());
|
||||
|
||||
updateState(CURRENT_POWER_CHANNEL, new QuantityType<>(power, SmartHomeUnits.WATT));
|
||||
updateState(CURRENT_POWER_CHANNEL, new QuantityType<>(power, Units.WATT));
|
||||
updateState(POWER_FACTOR_CHANNEL, new DecimalType(powerFactor));
|
||||
updateState(CONSUMPTION_CHANNEL, new QuantityType<>(consumption, SmartHomeUnits.WATT_HOUR));
|
||||
updateState(ELECTRIC_CURRENT_CHANNEL, new QuantityType<>(current, SmartHomeUnits.AMPERE));
|
||||
updateState(ELECTRIC_POTENTIAL_CHANNEL,
|
||||
new QuantityType<>(reading.getVoltage(), SmartHomeUnits.VOLT));
|
||||
updateState(FREQUENCY_CHANNEL, new QuantityType<>(reading.getFrequency(), SmartHomeUnits.HERTZ));
|
||||
updateState(CONSUMPTION_CHANNEL, new QuantityType<>(consumption, Units.WATT_HOUR));
|
||||
updateState(ELECTRIC_CURRENT_CHANNEL, new QuantityType<>(current, Units.AMPERE));
|
||||
updateState(ELECTRIC_POTENTIAL_CHANNEL, new QuantityType<>(reading.getVoltage(), Units.VOLT));
|
||||
updateState(FREQUENCY_CHANNEL, new QuantityType<>(reading.getFrequency(), Units.HERTZ));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user