case COMMAND:
if (type instanceof OnOffType) {
command = (type == OnOffType.ON ? Commands.ON : Commands.OFF);
dimmingLevel = 0;
} else {
throw new RFXComException("Can't convert " + type + " to Command");
}
break;
case DIMMING_LEVEL:
if (type instanceof OnOffType) {
command = (type == OnOffType.ON ? Commands.ON : Commands.OFF);
dimmingLevel = 0;
} else if (type instanceof PercentType) {
command = Commands.SET_LEVEL;
dimmingLevel = (byte) getDimLevelFromPercentType((PercentType) type);
if (dimmingLevel == 0) {
command = Commands.OFF;
}
} else if (type instanceof IncreaseDecreaseType) {
command = Commands.SET_LEVEL;
// Evert: I do not know how to get previous object state...
dimmingLevel = 5;
} else {
throw new RFXComException("Can't convert " + type + " to Command");
}
break;
default:
throw new RFXComException("Can't convert " + type + " to "
+ valueSelector);
}
}