2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.yeelight.internal.lib.device;
15 import java.util.Collections;
16 import java.util.HashMap;
20 * Properties of yeelight devices as described in the specification.
22 * @see <a href="https://www.yeelight.com/download/Yeelight_Inter-Operation_Spec.pdf"></a>
24 * @author Viktor Koop - Initial contribution
26 public enum YeelightDeviceProperty {
33 COLOR_MODE("color_mode"),
36 FLOW_PARAMS("flow_params"),
40 BG_FLOWING("bg_flowing"),
41 BG_FLOW_PARAMS("bg_flow_params"),
44 BG_BRIGHT("bg_bright"),
49 ACTIVE_MODE("active_mode"),
50 MAIN_POWER("main_power");
54 private static final Map<String, YeelightDeviceProperty> ENUM_MAP;
57 final Map<String, YeelightDeviceProperty> tempMap = new HashMap<>();
58 for (YeelightDeviceProperty property : YeelightDeviceProperty.values()) {
59 tempMap.put(property.value, property);
62 ENUM_MAP = Collections.unmodifiableMap(tempMap);
65 YeelightDeviceProperty(String stringValue) {
66 this.value = stringValue;
69 public String getValue() {
73 public static YeelightDeviceProperty fromString(String value) {
74 return ENUM_MAP.get(value);