]> git.basschouten.com Git - openhab-addons.git/blob
670fe0b6f31fb51cd1b2d1276cca6795d4fa8cd1
[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.yeelight.internal.lib.device;
14
15 import java.util.Collections;
16 import java.util.HashMap;
17 import java.util.Map;
18
19 /**
20  * Properties of yeelight devices as described in the specification.
21  *
22  * @see <a href="https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf"></a>
23  *
24  * @author Viktor Koop - Initial contribution
25  */
26 public enum YeelightDeviceProperty {
27     POWER("power"),
28     BRIGHT("bright"),
29     CT("ct"),
30     RGB("rgb"),
31     HUE("hue"),
32     SAT("sat"),
33     COLOR_MODE("color_mode"),
34     FLOWING("flowing"),
35     DELAYOFF("delayoff"),
36     FLOW_PARAMS("flow_params"),
37     MUSIC_ON("music_on"),
38     NAME("name"),
39     BG_POWER("bg_power"),
40     BG_FLOWING("bg_flowing"),
41     BG_FLOW_PARAMS("bg_flow_params"),
42     BG_CT("bg_ct"),
43     BG_LMODE("bg_lmode"),
44     BG_BRIGHT("bg_bright"),
45     BG_RGB("bg_rgb"),
46     BG_HUE("bg_hue"),
47     BG_SAT("bg_sat"),
48     NL_BR("nl_br"),
49     ACTIVE_MODE("active_mode"),
50     MAIN_POWER("main_power");
51
52     private String value;
53
54     private static final Map<String, YeelightDeviceProperty> ENUM_MAP;
55
56     static {
57         final Map<String, YeelightDeviceProperty> tempMap = new HashMap<>();
58         for (YeelightDeviceProperty property : YeelightDeviceProperty.values()) {
59             tempMap.put(property.value, property);
60         }
61
62         ENUM_MAP = Collections.unmodifiableMap(tempMap);
63     }
64
65     YeelightDeviceProperty(String stringValue) {
66         this.value = stringValue;
67     }
68
69     public String getValue() {
70         return value;
71     }
72
73     public static YeelightDeviceProperty fromString(String value) {
74         return ENUM_MAP.get(value);
75     }
76 }