]> git.basschouten.com Git - openhab-addons.git/blob
26a330d40e9a1374ebeae13c6c9a92950c2c1de7
[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.ecobee.internal.enums;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 import com.google.gson.annotations.SerializedName;
19
20 /**
21  * The {@link VentilatorMode} defines the possible ventilator modes.
22  *
23  * @author Mark Hilbush - Initial contribution
24  */
25 @NonNullByDefault
26 public enum VentilatorMode {
27
28     @SerializedName("auto")
29     AUTO("auto"),
30
31     @SerializedName("minontime")
32     MIN_ON_TIME("minontime"),
33
34     @SerializedName("on")
35     ON("on"),
36
37     @SerializedName("off")
38     OFF("off");
39
40     private final String mode;
41
42     private VentilatorMode(String mode) {
43         this.mode = mode;
44     }
45
46     public String value() {
47         return mode;
48     }
49
50     public static VentilatorMode forValue(@Nullable String v) {
51         if (v != null) {
52             for (VentilatorMode vm : VentilatorMode.values()) {
53                 if (vm.mode.equals(v)) {
54                     return vm;
55                 }
56             }
57         }
58         throw new IllegalArgumentException("Invalid vent: " + v);
59     }
60
61     @Override
62     public String toString() {
63         return this.mode;
64     }
65 }