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.digitalstrom.internal.lib.climate.constants;
16 * The {@link ControlStates} contains all digitalSTROM heating control states.
18 * @author Michael Ochel - Initial contribution
19 * @author Matthias Siegele - Initial contribution
21 public enum ControlStates {
23 INTERNAL((short) 0, "internal"),
24 EXTERNAL((short) 1, "external"),
25 EXBACKUP((short) 2, "exbackup"),
26 EMERGENCY((short) 3, "emergency");
28 private final Short id;
29 private final String key;
30 private static final ControlStates[] CONTROL_STATES = new ControlStates[ControlStates.values().length];
33 for (ControlStates controlState : ControlStates.values()) {
34 CONTROL_STATES[controlState.id] = controlState;
38 private ControlStates(short id, String key) {
44 * Returns the key of the operation mode.
48 public String getKey() {
53 * Returns the ID of the operation mode.
57 public Short getID() {
62 * Returns the {@link ControlStates} of the given control state id.
64 * @param id of the control state
65 * @return control state
67 public static ControlStates getControlState(short id) {
69 return CONTROL_STATES[id];
70 } catch (IndexOutOfBoundsException e) {