]> git.basschouten.com Git - openhab-addons.git/blob
d4f21794a3d928ce3cb3b793a0096ed0d3c21508
[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.bluetooth.daikinmadoka.internal.model;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * This class contains the enums for the various modes supported by the BLE thermostat
19  *
20  * @author Benjamin Lafois - Initial contribution
21  *
22  */
23 @NonNullByDefault
24 public class MadokaProperties {
25
26     public enum FanSpeed {
27         MAX(5),
28         MEDIUM(3),
29         LOW(1),
30         AUTO(0);
31
32         private int v;
33
34         FanSpeed(int v) {
35             this.v = v;
36         }
37
38         public static FanSpeed valueOf(int v) {
39             if (v == 5) {
40                 return MAX;
41             } else if (v >= 2 && v <= 4) {
42                 return MEDIUM;
43             } else if (v == 1) {
44                 return LOW;
45             } else {
46                 return AUTO;
47             }
48         }
49
50         public int value() {
51             return v;
52         }
53     }
54
55     public enum OperationMode {
56         FAN(0),
57         DRY(1),
58         AUTO(2),
59         COOL(3),
60         HEAT(4),
61         VENTILATION(5);
62
63         private int v;
64
65         OperationMode(int v) {
66             this.v = v;
67         }
68
69         public static OperationMode valueOf(int v) {
70             for (OperationMode m : values()) {
71                 if (m.v == v) {
72                     return m;
73                 }
74             }
75             // Should never happen
76             return HEAT;
77         }
78
79         public int value() {
80             return v;
81         }
82     }
83 }