import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
lightLevel = 0.0;
}
try {
- dimmerHandler.setLightLevel(new BigDecimal(lightLevel).setScale(2, BigDecimal.ROUND_HALF_UP),
+ dimmerHandler.setLightLevel(new BigDecimal(lightLevel).setScale(2, RoundingMode.HALF_UP),
new LutronDuration(fadeTime), new LutronDuration(delayTime));
} catch (IllegalArgumentException e) {
logger.debug("Ignoring setLevel command due to illegal argument exception: {}", e.getMessage());
}
private void stopPolling() {
+ ScheduledFuture<?> pollJob = this.pollJob;
if (pollJob != null) {
+ this.pollJob = null;
logger.debug("Canceling green mode polling job for integration ID {}", integrationId);
pollJob.cancel(true);
- pollJob = null;
}
}
} else if (command == OnOffType.OFF) {
greenMode(ACTION_STEP, 1);
} else if (command instanceof Number) {
- Integer step = new Integer(((Number) command).intValue());
+ Integer step = ((Number) command).intValue();
if (step.intValue() >= GREENSTEP_MIN) {
greenMode(ACTION_STEP, step);
}
try {
if (type == LutronCommandType.MODE && parameters.length > 1
&& ACTION_STEP.toString().equals(parameters[0])) {
- Long step = new Long(parameters[1]);
+ Long step = Long.valueOf(parameters[1]);
if (getThing().getStatus() == ThingStatus.UNKNOWN) {
updateStatus(ThingStatus.ONLINE);
startPolling();
if (channelUID.getId().equals(CHANNEL_CLOCKMODE)) {
if (command instanceof DecimalType) {
- Integer mode = new Integer(((DecimalType) command).intValue());
+ Integer mode = ((DecimalType) command).intValue();
timeclock(ACTION_CLOCKMODE, mode);
} else if (command instanceof RefreshType) {
queryTimeclock(ACTION_CLOCKMODE);
}
} else if (channelUID.getId().equals(CHANNEL_EXECEVENT)) {
if (command instanceof DecimalType) {
- Integer index = new Integer(((DecimalType) command).intValue());
+ Integer index = ((DecimalType) command).intValue();
timeclock(ACTION_EXECEVENT, index);
} else {
logger.debug("Invalid command type for execevent channnel");
}
} else if (channelUID.getId().equals(CHANNEL_ENABLEEVENT)) {
if (command instanceof DecimalType) {
- Integer index = new Integer(((DecimalType) command).intValue());
+ Integer index = ((DecimalType) command).intValue();
timeclock(ACTION_SETEVENT, index, EVENT_ENABLE);
} else {
logger.debug("Invalid command type for enableevent channnel");
}
} else if (channelUID.getId().equals(CHANNEL_DISABLEEVENT)) {
if (command instanceof DecimalType) {
- Integer index = new Integer(((DecimalType) command).intValue());
+ Integer index = ((DecimalType) command).intValue();
timeclock(ACTION_SETEVENT, index, EVENT_DISABLE);
} else {
logger.debug("Invalid command type for disableevent channnel");
try {
if (parameters.length >= 2 && ACTION_CLOCKMODE.toString().equals(parameters[0])) {
- Integer mode = new Integer(parameters[1]);
+ Integer mode = Integer.valueOf(parameters[1]);
if (getThing().getStatus() == ThingStatus.UNKNOWN) {
updateStatus(ThingStatus.ONLINE);
}
}
} else if (parameters.length >= 2 && ACTION_EXECEVENT.toString().equals(parameters[0])) {
- Integer index = new Integer(parameters[1]);
+ Integer index = Integer.valueOf(parameters[1]);
updateState(CHANNEL_EXECEVENT, new DecimalType(index));
} else if (parameters.length >= 3 && ACTION_SETEVENT.toString().equals(parameters[0])) {
- Integer index = new Integer(parameters[1]);
- Integer state = new Integer(parameters[2]);
+ Integer index = Integer.valueOf(parameters[1]);
+ Integer state = Integer.valueOf(parameters[2]);
if (state.equals(EVENT_ENABLE)) {
updateState(CHANNEL_ENABLEEVENT, new DecimalType(index));
} else if (state.equals(EVENT_DISABLE)) {