String configPart = configPartArray[1];
if (configPart.equals("thermostat")) {
if (cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT
&& cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT_PLUS
&& cfg.getDeviceType() != MaxCulDevice.WALL_THERMOSTAT)
throw new BindingConfigParseException(
"Invalid device feature. Can only use 'thermostat' on radiator or wall thermostats. This is a "
+ cfg.getDeviceType());
cfg.setFeature(MaxCulFeature.THERMOSTAT);
} else if (configPart.equals("temperature")) {
if (cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT
&& cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT_PLUS
&& cfg.getDeviceType() != MaxCulDevice.WALL_THERMOSTAT)
throw new BindingConfigParseException(
"Invalid device feature. Can only use 'temperature' on radiator or wall thermostats. This is a "
+ cfg.getDeviceType());
cfg.setFeature(MaxCulFeature.TEMPERATURE);
} else if (configPart.equals("battery")) {
cfg.setFeature(MaxCulFeature.BATTERY);
} else if (configPart.equals("mode")) {
if (cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT
&& cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT_PLUS
&& cfg.getDeviceType() != MaxCulDevice.WALL_THERMOSTAT)
throw new BindingConfigParseException(
"Invalid device feature. Can only use 'temperature' on radiator or wall thermostats. This is a "
+ cfg.getDeviceType());
cfg.setFeature(MaxCulFeature.MODE);
} else if (configPart.equals("switch")) {
if (cfg.getDeviceType() != MaxCulDevice.PUSH_BUTTON
&& cfg.getDeviceType() != MaxCulDevice.SHUTTER_CONTACT)
throw new BindingConfigParseException(
"Invalid device feature. Can only use 'switch' on PushButton or ShutterContact. This is a {}"
+ cfg.getDeviceType());
cfg.setFeature(MaxCulFeature.TEMPERATURE);
} else if (configPart.equals("valvepos")) {
if (cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT
&& cfg.getDeviceType() != MaxCulDevice.RADIATOR_THERMOSTAT_PLUS)
throw new BindingConfigParseException(
"Invalid device feature. Can only use 'switch' on RadiatorThermostat or RadiatorThermostatPlus. This is a "
+ cfg.getDeviceType());
cfg.setFeature(MaxCulFeature.VALVE_POS);
} else if (configPart.equals("reset")) {
cfg.setFeature(MaxCulFeature.RESET);