import java.nio.ByteBuffer;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Objects;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import javax.measure.quantity.Power;
import javax.measure.quantity.Time;
-import org.apache.commons.lang3.StringUtils;
import org.openhab.binding.keba.internal.KebaBindingConstants.KebaSeries;
import org.openhab.binding.keba.internal.KebaBindingConstants.KebaType;
import org.openhab.core.cache.ExpiringCacheMap;
import org.openhab.core.types.Command;
import org.openhab.core.types.RefreshType;
import org.openhab.core.types.State;
+import org.openhab.core.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
String response = new String(byteBuffer.array(), 0, byteBuffer.limit());
- response = StringUtils.chomp(response);
+ response = Objects.requireNonNull(StringUtils.chomp(response));
if (response.contains("TCH-OK")) {
// ignore confirmation messages which are not JSON
switch (channelUID.getId()) {
case CHANNEL_MAX_PRESET_CURRENT: {
if (command instanceof QuantityType<?> quantityCommand) {
- QuantityType<?> value = quantityCommand.toUnit("mA");
+ QuantityType<?> value = Objects.requireNonNull(quantityCommand.toUnit("mA"));
transceiver.send("curr " + Math.min(Math.max(6000, value.intValue()), maxSystemCurrent), this);
}
} else if (command == OnOffType.OFF) {
newValue = 6000;
} else if (command instanceof QuantityType<?> quantityCommand) {
- QuantityType<?> value = quantityCommand.toUnit("%");
+ QuantityType<?> value = Objects.requireNonNull(quantityCommand.toUnit("%"));
newValue = Math.round(6000 + (maxSystemCurrent - 6000) * value.doubleValue() / 100.0);
} else {
return;
}
case CHANNEL_SETENERGY: {
if (command instanceof QuantityType<?> quantityCommand) {
- QuantityType<?> value = quantityCommand.toUnit(Units.WATT_HOUR);
+ QuantityType<?> value = Objects.requireNonNull(quantityCommand.toUnit(Units.WATT_HOUR));
transceiver.send(
"setenergy " + Math.min(Math.max(0, Math.round(value.doubleValue() * 10.0)), 999999999),
this);