Remove deprecated handleUpdate from ThingHandler (#8558)
The handleUpdate method was deprecated when profiles were introduced (see eclipse-archived/smarthome#4108). Instead the "follow profile" can be used which forwards item updates as commands to handlers. This profile works with any binding instead of only those that implement the handleUpdate method. Related to openhab/openhab-core#1669 Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
@@ -22,7 +22,6 @@ import org.openhab.core.library.types.PercentType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.State;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -127,28 +126,6 @@ public class XiaomiActorGatewayHandler extends XiaomiActorBaseHandler {
|
||||
logger.debug("Changed volume to {}", lastVolume);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleUpdate(ChannelUID channelUID, State newState) {
|
||||
logger.debug("Update {} for channel {} received", newState, channelUID);
|
||||
switch (channelUID.getId()) {
|
||||
case CHANNEL_BRIGHTNESS:
|
||||
if (newState instanceof PercentType) {
|
||||
lastBrigthness = ((PercentType) newState).intValue();
|
||||
}
|
||||
break;
|
||||
case CHANNEL_COLOR:
|
||||
if (newState instanceof HSBType) {
|
||||
lastColor = ((HSBType) newState).getRGB();
|
||||
}
|
||||
break;
|
||||
case CHANNEL_GATEWAY_VOLUME:
|
||||
if (newState instanceof DecimalType) {
|
||||
updateLastVolume((DecimalType) newState);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void parseReport(JsonObject data) {
|
||||
parseDefault(data);
|
||||
|
||||
@@ -16,9 +16,7 @@ import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import org.openhab.core.library.types.DecimalType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.types.State;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -87,14 +85,4 @@ public abstract class XiaomiSensorBaseHandlerWithTimer extends XiaomiSensorBaseH
|
||||
timerSetpoint = defaultTimer;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleUpdate(ChannelUID channelUID, State newState) {
|
||||
if (setpointChannel.equals(channelUID.getId())) {
|
||||
if (newState instanceof DecimalType) {
|
||||
logger.debug("Received update for timer setpoint channel: {}", newState);
|
||||
timerSetpoint = ((DecimalType) newState).intValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user