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>
// Perform appropriate update based on X10Command received
// Handle ON/OFF commands
if (cmd == X10ReceivedData.X10COMMAND.ON) {
- handleUpdate(channelUid, OnOffType.ON);
+ updateState(channelUid, OnOffType.ON);
handler.setCurrentState(OnOffType.ON);
} else if (cmd == X10ReceivedData.X10COMMAND.OFF) {
- handleUpdate(channelUid, OnOffType.OFF);
+ updateState(channelUid, OnOffType.OFF);
handler.setCurrentState(OnOffType.OFF);
// Handle DIM/Bright commands
} else if (cmd == X10ReceivedData.X10COMMAND.DIM) {
State newState = handler.addDimsToCurrentState(dims);
- handleUpdate(channelUid, newState);
+ updateState(channelUid, newState);
handler.setCurrentState(newState);
logger.debug("Current state set to: {}", handler.getCurrentState().toFullString());
} else if (cmd == X10ReceivedData.X10COMMAND.BRIGHT) {
State newState = handler.addBrightsToCurrentState(dims);
- handleUpdate(channelUid, newState);
+ updateState(channelUid, newState);
handler.setCurrentState(newState);
logger.debug("Current state set to: {}", handler.getCurrentState().toFullString());
} else {
}
}
- /**
- * The default implementation of this method doesn't do anything. We need it to update the ui as done by the
- * updateState function.
- * And, update state can not be called directly because it is protected
- */
- @Override
- public void handleUpdate(ChannelUID channelUID, State newState) {
- updateState(channelUID, newState);
- }
-
/**
* Get the X10Interface
*
import org.openhab.core.thing.ThingStatusDetail;
import org.openhab.core.thing.binding.BaseBridgeHandler;
import org.openhab.core.types.Command;
-import org.openhab.core.types.State;
import tuwien.auto.calimero.IndividualAddress;
import tuwien.auto.calimero.mgmt.Destination;
protected abstract KNXClient getClient();
- @Override
- public void handleUpdate(ChannelUID channelUID, State newState) {
- // Nothing to do here
- }
-
@Override
public void handleCommand(ChannelUID channelUID, Command command) {
// Nothing to do here
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
import org.openhab.core.types.Command;
-import org.openhab.core.types.State;
/**
* Handler for RadioRA dimmers
}
}
- @Override
- public void handleUpdate(ChannelUID channelUID, State newState) {
- if (LutronBindingConstants.CHANNEL_LIGHTLEVEL.equals(channelUID.getId())) {
- PercentType percent = (PercentType) newState.as(PercentType.class);
- updateInternalState(percent.intValue());
- }
- }
-
@Override
public void handleFeedback(RadioRAFeedback feedback) {
if (feedback instanceof LocalZoneChangeFeedback) {
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;
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);
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;
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();
- }
- }
- }
}
import java.util.Map.Entry;
import org.openhab.core.config.core.Configuration;
-import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.PercentType;
import org.openhab.core.library.types.StopMoveType;
}
}
- @Override
- public void handleUpdate(ChannelUID channelUID, State newState) {
- if (CHANNELS_JRM_TIME.equals(channelUID.getGroupId())) {
- times[Integer
- .parseInt(channelUID.getIdWithoutGroup())] = (short) (((DecimalType) newState).floatValue() * 10);
- }
- }
-
@Override
public void handleConfigurationUpdate(Map<String, Object> configurationParameters) {
if (isInitialized()) { // prevents change of address
import org.openhab.core.thing.binding.BaseBridgeHandler;
import org.openhab.core.types.Command;
import org.openhab.core.types.RefreshType;
-import org.openhab.core.types.State;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tellstick.device.TellstickDeviceEvent;
super.handleRemoval();
}
- @Override
- public void handleUpdate(ChannelUID channelUID, State newState) {
- super.handleUpdate(channelUID, newState);
- }
-
@Override
public void thingUpdated(Thing thing) {
super.thingUpdated(thing);
@Override
public void onStateUpdateFromItem(State state) {
- callback.handleUpdate(state);
}
@Override
@Override
public void onStateUpdateFromItem(State state) {
- callback.handleUpdate(state);
}
@Override
@Override
public void onStateUpdateFromItem(State state) {
- callback.handleUpdate(state);
}
@Override
@Override
public void onStateUpdateFromItem(State state) {
- callback.handleUpdate(state);
}
@Override
@Override
public void onStateUpdateFromItem(State state) {
- callback.handleUpdate(state);
}
@Override
@Override
public void onStateUpdateFromItem(State state) {
- callback.handleUpdate(state);
}
@Override
@Override
public void onStateUpdateFromItem(State state) {
- callback.handleUpdate(state);
}
@Override
@Override
public void onStateUpdateFromItem(State state) {
- callback.handleUpdate(state);
}
@Override
@Override
public void onStateUpdateFromItem(State state) {
- callback.handleUpdate(state);
}
@Override