private static <T> void addCommand(T[] cache, int index, T newValue, String commandType,
Map<AnelCommandType, State> result) {
if (newValue != null) {
if (!newValue.equals(cache[index])) {
final AnelCommandType cmd = AnelCommandType.getCommandType(commandType);
final State state;
if (newValue instanceof String) {
state = new StringType((String) newValue);
} else if (newValue instanceof Boolean) {
state = (Boolean) newValue ? OnOffType.ON : OnOffType.OFF;
} else {