public boolean setVolume(String value) {
if(value != null && isConfigured()) {
Service service = device.findService(new UDAServiceId("RenderingControl"));
Action action = service.getAction("SetVolume");
ActionInvocation invocation = new ActionInvocation(action);
try {
String newValue = value;
if(value.equals("INCREASE")) {
int i = Integer.valueOf(this.getVolume());
newValue = String.valueOf(Math.min(100, i+1));
} else if (value.equals("DECREASE")) {
int i = Integer.valueOf(this.getVolume());
newValue = String.valueOf(Math.max(0, i-1));
} else if (value.equals("ON")) {
newValue = "100";
} else if (value.equals("OFF")) {
newValue = "0";
} else {
newValue = value;
}
invocation.setInput("Channel", "Master");
invocation.setInput("DesiredVolume",newValue);
} catch (InvalidValueException ex) {
logger.error("Action Invalid Value Exception {}",ex.getMessage());
} catch (NumberFormatException ex) {
logger.error("Action Invalid Value Format Exception {}",ex.getMessage());
}