]> git.basschouten.com Git - openhab-addons.git/blob
4bb6667b08dcbb569c6a3966b6e35407432f741b
[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.elerotransmitterstick.internal.stick;
14
15 /**
16  * The {@link CommandType} is the type of the {@link Command}.
17  *
18  * @author Volker Bier - Initial contribution
19  */
20 public enum CommandType {
21     UP,
22     INTERMEDIATE,
23     VENTILATION,
24     DOWN,
25     STOP,
26     INFO,
27     CHECK,
28     NONE;
29
30     public static CommandType getForPercent(int percentage) {
31         if (percentage == 0) {
32             return UP;
33         }
34
35         if (percentage == 25) {
36             return CommandType.INTERMEDIATE;
37         }
38
39         if (percentage == 75) {
40             return CommandType.VENTILATION;
41         }
42
43         if (percentage == 100) {
44             return CommandType.DOWN;
45         }
46
47         return null;
48     }
49 }