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 ControlModes} contains all digitalSTROM heating control modes.
18 * @author Michael Ochel - Initial contribution
19 * @author Matthias Siegele - Initial contribution
21 public enum ControlModes {
23 OFF((short) 0, "off"),
24 PID_CONTROL((short) 1, "pid-control"),
25 ZONE_FOLLOWER((short) 2, "zone-follower"),
26 FIXED_VALUE((short) 3, "fixed-value"),
27 MANUAL((short) 4, "manual");
29 private final Short id;
30 private final String key;
32 private static final ControlModes[] CONTROL_MODES = new ControlModes[ControlModes.values().length];
35 for (ControlModes controlMode : ControlModes.values()) {
36 CONTROL_MODES[controlMode.id] = controlMode;
40 private ControlModes(short id, String key) {
46 * Returns the key of the operation mode.
50 public String getKey() {
55 * Returns the ID of the operation mode.
59 public Short getID() {
64 * Returns the {@link ControlModes} of the given control mode id.
66 * @param id of the control mode
67 * @return control mode
69 public static ControlModes getControlMode(short id) {
71 return CONTROL_MODES[id];
72 } catch (IndexOutOfBoundsException e) {