]> git.basschouten.com Git - openhab-addons.git/blob
b6858f69dd810fa73674c216e301b80e1316efbe
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.iaqualink.internal.handler;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * Heater States returned by iAquaLink API
20  *
21  * @author Dan Cunningham - Initial contribution
22  *
23  */
24 @NonNullByDefault
25 public enum HeaterState {
26     OFF("0", "off"),
27     HEATING("1", "on"),
28     ENABLED("3", "enabled");
29
30     String value;
31     String label;
32
33     HeaterState(String value, String label) {
34         this.value = value;
35         this.label = label;
36     }
37
38     public String getLabel() {
39         return label;
40     }
41
42     public static @Nullable HeaterState fromValue(String value) {
43         for (HeaterState state : HeaterState.values()) {
44             if (state.value.equals(value)) {
45                 return state;
46             }
47         }
48         return null;
49     }
50 }