2 * Copyright (c) 2010-2021 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.digitalstrom.internal.lib.structure.devices.deviceparameters.constants;
15 import java.util.Arrays;
16 import java.util.HashMap;
17 import java.util.List;
21 * The {@link FunctionalColorGroupEnum} contains all digitalSTROM functional color groups.
23 * @author Michael Ochel - Initial contribution
24 * @author Matthias Siegele - Initial contribution
25 * @see <a href="http://developer.digitalstrom.org/Architecture/ds-basics.pdf">ds-basics.pdf,
26 * "Table 1: digitalSTROM functional groups and their colors", page 9 [04.09.2015]</a>
28 public enum FunctionalColorGroupEnum {
30 * | Number | Name | Color | Function |
31 * --------------------------------------------------------------------------------------
32 * | 1 | Lights | Yellow | Room lights |
33 * | 2 | Blinds | Gray | Blinds or shades outside |
34 * | 12 | Curtains | Gray | Curtains and blinds inside |
35 * | 3 | Heating | Blue | Heating |
36 * | 9 | Cooling | Blue | Cooling |
37 * | 10 | Ventilation | Blue | Ventilation |
38 * | 11 | Window | Blue | Window |
39 * | 48 | Temperature Control | Blue | Single room temperature control |
40 * | 4 | Audio | Cyan | Playing music or radio |
41 * | 5 | Video | Magenta | TV, Video |
42 * | 8 | Joker | Black | Configurable behaviour |
43 * | n/a | Single Device | White | Various, individual per device |
44 * | n/a | Security | Red | Security related functions, Alarms |
45 * | n/a | Access | Green | Access related functions, door bell |
48 YELLOW(Arrays.asList((short) 1)),
49 GREY(Arrays.asList((short) 2, (short) 12)),
50 BLUE(Arrays.asList((short) 3, (short) 9, (short) 10, (short) 11, (short) 48)),
51 CYAN(Arrays.asList((short) 4)),
52 MAGENTA(Arrays.asList((short) 5)),
53 BLACK(Arrays.asList((short) 8)),
54 WHITE(Arrays.asList((short) -1)),
55 RED(Arrays.asList((short) -2)),
56 GREEN(Arrays.asList((short) -3));
58 private final List<Short> colorGroup;
60 static final Map<Short, FunctionalColorGroupEnum> COLOR_GROUPS = new HashMap<>();
63 for (FunctionalColorGroupEnum colorGroup : FunctionalColorGroupEnum.values()) {
64 for (Short colorGroupID : colorGroup.getFunctionalColorGroup()) {
65 COLOR_GROUPS.put(colorGroupID, colorGroup);
71 * Returns true, if contains the given functional color group id in digitalSTROM exits, otherwise false.
73 * @param functionalColorGroupID to be checked
74 * @return true, if contains
76 public static boolean containsColorGroup(Short functionalColorGroupID) {
77 return COLOR_GROUPS.keySet().contains(functionalColorGroupID);
81 * Returns the {@link FunctionalColorGroupEnum} of the given color id.
83 * @param functionalColorGroupID of the {@link FunctionalColorGroupEnum}
84 * @return {@link FunctionalColorGroupEnum} of the id
86 public static FunctionalColorGroupEnum getColorGroup(Short functionalColorGroupID) {
87 return COLOR_GROUPS.get(functionalColorGroupID);
90 private FunctionalColorGroupEnum(List<Short> functionalColorGroupID) {
91 this.colorGroup = functionalColorGroupID;
95 * Returns the functional color group id's as {@link List} of this {@link FunctionalColorGroupEnum}.
97 * @return functional color group id's
99 public List<Short> getFunctionalColorGroup() {