]> git.basschouten.com Git - openhab-addons.git/blob
3bf19acb77c50681387cd72c8d09525fe64406a0
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.luxtronikheatpump.internal.enums;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.luxtronikheatpump.internal.exceptions.InvalidOperationModeException;
17
18 /**
19  * Represents all heat pump cooling operation modes
20  *
21  * @author Stefan Giehl - Initial contribution
22  */
23 @NonNullByDefault
24 public enum HeatpumpCoolingOperationMode {
25     AUTOMATIC(1),
26     OFF(0);
27
28     private int value;
29
30     private HeatpumpCoolingOperationMode(int value) {
31         this.value = value;
32     }
33
34     public int getValue() {
35         return value;
36     }
37
38     public static HeatpumpCoolingOperationMode fromValue(int value) throws InvalidOperationModeException {
39         for (HeatpumpCoolingOperationMode mode : HeatpumpCoolingOperationMode.values()) {
40             if (mode.value == value) {
41                 return mode;
42             }
43         }
44
45         throw new InvalidOperationModeException("Invalid heat pump cooling operation mode: '" + value + "'");
46     }
47 }