2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.knx.internal.channel;
15 import static org.openhab.binding.knx.internal.KNXBindingConstants.*;
17 import java.util.Objects;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
22 import tuwien.auto.calimero.dptxlator.DPTXlator3BitControlled;
23 import tuwien.auto.calimero.dptxlator.DPTXlator8BitUnsigned;
24 import tuwien.auto.calimero.dptxlator.DPTXlatorBoolean;
27 * dimmer channel type description
29 * @author Simon Kaufmann - initial contribution and API.
33 class TypeDimmer extends KNXChannelType {
36 super(CHANNEL_DIMMER, CHANNEL_DIMMER_CONTROL);
40 protected Set<String> getAllGAKeys() {
41 return Set.of(SWITCH_GA, POSITION_GA, INCREASE_DECREASE_GA);
45 protected String getDefaultDPT(String gaConfigKey) {
46 if (Objects.equals(gaConfigKey, INCREASE_DECREASE_GA)) {
47 return DPTXlator3BitControlled.DPT_CONTROL_DIMMING.getID();
49 if (Objects.equals(gaConfigKey, SWITCH_GA)) {
50 return DPTXlatorBoolean.DPT_SWITCH.getID();
52 if (Objects.equals(gaConfigKey, POSITION_GA)) {
53 return DPTXlator8BitUnsigned.DPT_SCALING.getID();
55 throw new IllegalArgumentException("GA configuration '" + gaConfigKey + "' is not supported");