Program: 62500
Project: 62500
Buggy source:
/** 
 * Handle the commands for switchable outlets or heating thermostats. TODO: test switch behaviour on PL546E stand-alone
 */
@Override public void handleCommand(ChannelUID channelUID,Command command){
  String channelId=channelUID.getIdWithoutGroup();
  logger.debug("String_Node_Str",command,channelId);
  FritzahaWebInterface fritzBox=getWebInterface();
  if (fritzBox == null) {
    return;
  }
  String ain=getThing().getConfiguration().get(THING_AIN).toString();
switch (channelId) {
case CHANNEL_MODE:
case CHANNEL_LOCKED:
case CHANNEL_DEVICE_LOCKED:
case CHANNEL_TEMP:
case CHANNEL_ENERGY:
case CHANNEL_POWER:
case CHANNEL_ACTUALTEMP:
case CHANNEL_ECOTEMP:
case CHANNEL_COMFORTTEMP:
case CHANNEL_NEXTCHANGE:
case CHANNEL_NEXTTEMP:
case CHANNEL_BATTERY:
    logger.debug("String_Node_Str",channelId,command);
  break;
case CHANNEL_SWITCH:
if (command instanceof OnOffType) {
  state.getSwitch().setState(OnOffType.ON.equals(command) ? SwitchModel.ON : SwitchModel.OFF);
  fritzBox.setSwitch(ain,OnOffType.ON.equals(command));
}
 else {
  logger.warn("String_Node_Str",command,CHANNEL_SWITCH);
}
break;
case CHANNEL_SETTEMP:
if (command instanceof DecimalType) {
BigDecimal temperature=new BigDecimal(command.toString());
state.getHkr().setTsoll(temperature);
fritzBox.setSetTemp(ain,HeatingModel.fromCelsius(temperature));
updateState(CHANNEL_RADIATOR_MODE,new StringType(state.getHkr().getRadiatorMode()));
}
 else if (command instanceof IncreaseDecreaseType) {
BigDecimal temperature=state.getHkr().getTsoll();
if (IncreaseDecreaseType.INCREASE.equals(command)) {
temperature.add(BigDecimal.ONE);
}
 else {
temperature.subtract(BigDecimal.ONE);
}
state.getHkr().setTsoll(temperature);
fritzBox.setSetTemp(ain,temperature);
updateState(CHANNEL_RADIATOR_MODE,new StringType(state.getHkr().getRadiatorMode()));
}
 else if (command instanceof OnOffType) {
BigDecimal temperature=OnOffType.ON.equals(command) ? HeatingModel.TEMP_FRITZ_ON : HeatingModel.TEMP_FRITZ_OFF;
state.getHkr().setTsoll(temperature);
fritzBox.setSetTemp(ain,temperature);
updateState(CHANNEL_RADIATOR_MODE,new StringType(state.getHkr().getRadiatorMode()));
}
 else {
logger.warn("String_Node_Str",command,CHANNEL_SETTEMP);
}
break;
case CHANNEL_RADIATOR_MODE:
if (command instanceof StringType) {
String commandString=command.toString();
if (MODE_ON.equals(commandString)) {
state.getHkr().setTsoll(HeatingModel.TEMP_FRITZ_ON);
fritzBox.setSetTemp(ain,HeatingModel.TEMP_FRITZ_ON);
updateState(CHANNEL_SETTEMP,new DecimalType(HeatingModel.toCelsius(HeatingModel.TEMP_FRITZ_ON)));
}
 else if (MODE_OFF.equals(commandString)) {
state.getHkr().setTsoll(HeatingModel.TEMP_FRITZ_OFF);
fritzBox.setSetTemp(ain,HeatingModel.TEMP_FRITZ_OFF);
updateState(CHANNEL_SETTEMP,new DecimalType(HeatingModel.toCelsius(HeatingModel.TEMP_FRITZ_OFF)));
}
 else if (MODE_COMFORT.equals(commandString)) {
BigDecimal comfort_temp=state.getHkr().getKomfort();
state.getHkr().setTsoll(comfort_temp);
fritzBox.setSetTemp(ain,comfort_temp);
updateState(CHANNEL_SETTEMP,new DecimalType(HeatingModel.toCelsius(comfort_temp)));
}
 else if (MODE_ECO.equals(commandString)) {
BigDecimal eco_temp=state.getHkr().getAbsenk();
state.getHkr().setTsoll(eco_temp);
fritzBox.setSetTemp(ain,eco_temp);
updateState(CHANNEL_SETTEMP,new DecimalType(HeatingModel.toCelsius(eco_temp)));
}
 else if (MODE_BOOST.equals(commandString)) {
state.getHkr().setTsoll(HeatingModel.TEMP_FRITZ_MAX);
fritzBox.setSetTemp(ain,HeatingModel.TEMP_FRITZ_MAX);
updateState(CHANNEL_SETTEMP,new DecimalType(HeatingModel.toCelsius(HeatingModel.TEMP_FRITZ_MAX)));
}
 else {
logger.warn("String_Node_Str",command,CHANNEL_RADIATOR_MODE);
}
}
break;
default :
logger.debug("String_Node_Str",channelId);
break;
}
}

Fixed version (ground truth):
/** 
 * Handle the commands for switchable outlets or heating thermostats. TODO: test switch behaviour on PL546E stand-alone
 */
@Override public void handleCommand(ChannelUID channelUID,Command command){
  String channelId=channelUID.getIdWithoutGroup();
  logger.debug("String_Node_Str",command,channelId);
  FritzahaWebInterface fritzBox=getWebInterface();
  if (fritzBox == null) {
    return;
  }
  String ain=getThing().getConfiguration().get(THING_AIN).toString();
switch (channelId) {
case CHANNEL_MODE:
case CHANNEL_LOCKED:
case CHANNEL_DEVICE_LOCKED:
case CHANNEL_TEMP:
case CHANNEL_ENERGY:
case CHANNEL_POWER:
case CHANNEL_ACTUALTEMP:
case CHANNEL_ECOTEMP:
case CHANNEL_COMFORTTEMP:
case CHANNEL_NEXTCHANGE:
case CHANNEL_NEXTTEMP:
case CHANNEL_BATTERY:
    logger.debug("String_Node_Str",channelId,command);
  break;
case CHANNEL_SWITCH:
if (command instanceof OnOffType) {
  state.getSwitch().setState(OnOffType.ON.equals(command) ? SwitchModel.ON : SwitchModel.OFF);
  fritzBox.setSwitch(ain,OnOffType.ON.equals(command));
}
 else {
  logger.warn("String_Node_Str",command,CHANNEL_SWITCH);
}
break;
case CHANNEL_SETTEMP:
if (command instanceof DecimalType) {
BigDecimal temperature=((DecimalType)command).toBigDecimal();
state.getHkr().setTsoll(temperature);
fritzBox.setSetTemp(ain,HeatingModel.fromCelsius(temperature));
updateState(CHANNEL_RADIATOR_MODE,new StringType(state.getHkr().getRadiatorMode()));
}
 else if (command instanceof IncreaseDecreaseType) {
BigDecimal temperature=state.getHkr().getTsoll();
if (IncreaseDecreaseType.INCREASE.equals(command)) {
temperature.add(BigDecimal.ONE);
}
 else {
temperature.subtract(BigDecimal.ONE);
}
state.getHkr().setTsoll(temperature);
fritzBox.setSetTemp(ain,temperature);
updateState(CHANNEL_RADIATOR_MODE,new StringType(state.getHkr().getRadiatorMode()));
}
 else if (command instanceof OnOffType) {
BigDecimal temperature=OnOffType.ON.equals(command) ? HeatingModel.TEMP_FRITZ_ON : HeatingModel.TEMP_FRITZ_OFF;
state.getHkr().setTsoll(temperature);
fritzBox.setSetTemp(ain,temperature);
updateState(CHANNEL_RADIATOR_MODE,new StringType(state.getHkr().getRadiatorMode()));
}
 else {
logger.warn("String_Node_Str",command,CHANNEL_SETTEMP);
}
break;
case CHANNEL_RADIATOR_MODE:
if (command instanceof StringType) {
String commandString=command.toString();
if (MODE_ON.equals(commandString)) {
state.getHkr().setTsoll(HeatingModel.TEMP_FRITZ_ON);
fritzBox.setSetTemp(ain,HeatingModel.TEMP_FRITZ_ON);
updateState(CHANNEL_SETTEMP,new DecimalType(HeatingModel.toCelsius(HeatingModel.TEMP_FRITZ_ON)));
}
 else if (MODE_OFF.equals(commandString)) {
state.getHkr().setTsoll(HeatingModel.TEMP_FRITZ_OFF);
fritzBox.setSetTemp(ain,HeatingModel.TEMP_FRITZ_OFF);
updateState(CHANNEL_SETTEMP,new DecimalType(HeatingModel.toCelsius(HeatingModel.TEMP_FRITZ_OFF)));
}
 else if (MODE_COMFORT.equals(commandString)) {
BigDecimal comfort_temp=state.getHkr().getKomfort();
state.getHkr().setTsoll(comfort_temp);
fritzBox.setSetTemp(ain,comfort_temp);
updateState(CHANNEL_SETTEMP,new DecimalType(HeatingModel.toCelsius(comfort_temp)));
}
 else if (MODE_ECO.equals(commandString)) {
BigDecimal eco_temp=state.getHkr().getAbsenk();
state.getHkr().setTsoll(eco_temp);
fritzBox.setSetTemp(ain,eco_temp);
updateState(CHANNEL_SETTEMP,new DecimalType(HeatingModel.toCelsius(eco_temp)));
}
 else if (MODE_BOOST.equals(commandString)) {
state.getHkr().setTsoll(HeatingModel.TEMP_FRITZ_MAX);
fritzBox.setSetTemp(ain,HeatingModel.TEMP_FRITZ_MAX);
updateState(CHANNEL_SETTEMP,new DecimalType(HeatingModel.toCelsius(HeatingModel.TEMP_FRITZ_MAX)));
}
 else {
logger.warn("String_Node_Str",command,CHANNEL_RADIATOR_MODE);
}
}
break;
default :
logger.debug("String_Node_Str",channelId);
break;
}
}