use of org.openhab.binding.novelanheatpump.HeatpumpOperationMode in project openhab1-addons by openhab.
the class HeatPumpBinding method internalReceiveCommand.
@Override
protected void internalReceiveCommand(String itemName, Command command) {
HeatPumpGenericBindingProvider provider = findFirstProvider();
if (provider != null) {
HeatPumpBindingConfig bindingConfig = provider.getHeatPumpBindingConfig(itemName);
HeatpumpCommandType commandType = bindingConfig.getType();
switch(commandType) {
case TYPE_HEATING_OPERATION_MODE:
if (command instanceof DecimalType) {
int value = ((DecimalType) command).intValue();
HeatpumpOperationMode mode = HeatpumpOperationMode.fromValue(value);
if (mode != null) {
if (sendParamToHeatpump(PARAM_HEATING_OPERATION_MODE, mode.getValue())) {
logger.info("Heatpump heating operation mode set to {}.", mode.name());
}
} else {
logger.warn("Heatpump heating operation mode with value {} is unknown.", value);
}
} else {
logger.warn("Heatpump heating operation mode item {} must be from type:{}.", itemName, DecimalType.class.getSimpleName());
}
break;
case TYPE_HEATING_TEMPERATURE:
if (command instanceof DecimalType) {
float temperature = ((DecimalType) command).floatValue();
int value = (int) (temperature * 10.);
if (sendParamToHeatpump(PARAM_HEATING_TEMPERATURE, value)) {
logger.info("Heatpump heating temperature set to {}.", temperature);
}
} else {
logger.warn("Heatpump heating temperature item {} must be from type:{}.", itemName, DecimalType.class.getSimpleName());
}
break;
case TYPE_WARMWATER_OPERATION_MODE:
if (command instanceof DecimalType) {
int value = ((DecimalType) command).intValue();
HeatpumpOperationMode mode = HeatpumpOperationMode.fromValue(value);
if (mode != null) {
if (sendParamToHeatpump(PARAM_WARMWATER_OPERATION_MODE, mode.getValue())) {
logger.info("Heatpump warmwater operation mode set to: {}. ", mode.name());
}
} else {
logger.warn("Heatpump warmwater operation mode with value {} is unknown.", value);
}
} else {
logger.warn("Heatpump warmwater operation mode item {} must be from type: {}.", itemName, DecimalType.class.getSimpleName());
}
break;
case TYPE_WARMWATER_TEMPERATURE:
if (command instanceof DecimalType) {
float temperature = ((DecimalType) command).floatValue();
int value = (int) (temperature * 10.);
if (sendParamToHeatpump(PARAM_WARMWATER_TEMPERATURE, value)) {
logger.info("Heatpump warmwater temperature set to {}.", temperature);
}
} else {
logger.warn("Heatpump warmwater temperature item {} must be from type: {}.", itemName, DecimalType.class.getSimpleName());
}
break;
case TYPE_COOLING_OPERATION_MODE:
if (command instanceof DecimalType) {
int value = ((DecimalType) command).intValue();
HeatpumpCoolingOperationMode mode = HeatpumpCoolingOperationMode.fromValue(value);
if (mode != null) {
if (sendParamToHeatpump(PARAM_COOLING_OPERATION_MODE, mode.getValue())) {
logger.info("Heatpump cooling operation mode set to {}.", mode.name());
}
} else {
logger.warn("Heatpump cooling operation mode with value {} is unknown.", value);
}
} else {
logger.warn("Heatpump cooling operation mode item {} must be from type: {}.", itemName, DecimalType.class.getSimpleName());
}
break;
case TYPE_COOLING_RELEASE_TEMPERATURE:
if (command instanceof DecimalType) {
float temperature = ((DecimalType) command).floatValue();
int value = (int) (temperature * 10.);
if (sendParamToHeatpump(PARAM_COOLING_RELEASE_TEMP, value)) {
logger.info("Heatpump cooling release temperature set to {}.", temperature);
}
} else {
logger.warn("Heatpump cooling release temperature item {} must be from type: {}.", itemName, DecimalType.class.getSimpleName());
}
break;
case TYPE_COOLING_INLET_TEMP:
if (command instanceof DecimalType) {
float temperature = ((DecimalType) command).floatValue();
int value = (int) (temperature * 10.);
if (sendParamToHeatpump(PARAM_COOLING_INLET_TEMP, value)) {
logger.info("Heatpump cooling target temp MK1 set to {}.", temperature);
}
} else {
logger.warn("Heatpump cooling target temp MK1 item {} must be from type: {}.", itemName, DecimalType.class.getSimpleName());
}
break;
case TYPE_COOLING_START_AFTER_HOURS:
if (command instanceof DecimalType) {
float hours = ((DecimalType) command).floatValue();
int value = (int) (hours * 10.);
if (sendParamToHeatpump(PARAM_COOLING_START, value)) {
logger.info("Heatpump cooling start after hours set to {}.", hours);
}
} else {
logger.warn("Heatpump cooling start after hours item {} must be from type: {}.", itemName, DecimalType.class.getSimpleName());
}
break;
case TYPE_COOLING_STOP_AFTER_HOURS:
if (command instanceof DecimalType) {
float hours = ((DecimalType) command).floatValue();
int value = (int) (hours * 10.);
if (sendParamToHeatpump(PARAM_COOLING_STOP, value)) {
logger.info("Heatpump cooling stop after hours set to {}.", hours);
}
} else {
logger.warn("Heatpump cooling stop after hours item {} must be from type: {}.", itemName, DecimalType.class.getSimpleName());
}
break;
default:
}
}
}
Aggregations