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.HashMap;
19 * The {@link FuncNameAndColorGroupEnum} contains all digitalSTROM functional group names and links to their
20 * {@link FunctionalColorGroupEnum}.
22 * @author Michael Ochel - Initial contribution
23 * @author Matthias Siegele - Initial contribution
24 * @see <a href="http://developer.digitalstrom.org/Architecture/ds-basics.pdf">ds-basics.pdf
25 * "Table 1: digitalSTROM functional groups and their colors", page 9</a>
27 public enum FuncNameAndColorGroupEnum {
29 * | Number | Name | Color | Function |
30 * --------------------------------------------------------------------------------------
31 * | 1 | Lights | Yellow | Room lights |
32 * | 2 | Blinds | Gray | Blinds or shades outside |
33 * | 12 | Curtains | Gray | Curtains and blinds inside |
34 * | 3 | Heating | Blue | Heating |
35 * | 9 | Cooling | Blue | Cooling |
36 * | 10 | Ventilation | Blue | Ventilation |
37 * | 11 | Window | Blue | Window |
38 * | 48 | Temperature Control | Blue | Single room temperature control |
39 * | 4 | Audio | Cyan | Playing music or radio |
40 * | 5 | Video | Magenta | TV, Video |
41 * | 8 | Joker | Black | Configurable behaviour |
42 * | n/a | Single Device | White | Various, individual per device |
43 * | n/a | Security | Red | Security related functions, Alarms |
44 * | n/a | Access | Green | Access related functions, door bell |
47 LIGHTS((short) 1, FunctionalColorGroupEnum.getColorGroup((short) 1)),
48 BLINDS((short) 2, FunctionalColorGroupEnum.getColorGroup((short) 2)),
49 CURTAINS((short) 12, FunctionalColorGroupEnum.getColorGroup((short) 12)),
50 HEATING((short) 3, FunctionalColorGroupEnum.getColorGroup((short) 3)),
51 COOLING((short) 9, FunctionalColorGroupEnum.getColorGroup((short) 9)),
52 VENTILATION((short) 10, FunctionalColorGroupEnum.getColorGroup((short) 10)),
53 WINDOW((short) 11, FunctionalColorGroupEnum.getColorGroup((short) 11)),
54 TEMPERATION_CONTROL((short) 48, FunctionalColorGroupEnum.getColorGroup((short) 48)),
55 AUDIO((short) 4, FunctionalColorGroupEnum.getColorGroup((short) 4)),
56 VIDEO((short) 5, FunctionalColorGroupEnum.getColorGroup((short) 5)),
57 JOKER((short) 8, FunctionalColorGroupEnum.getColorGroup((short) 8)),
58 SINGLE_DEVICE((short) -1, FunctionalColorGroupEnum.getColorGroup((short) -1)),
59 SECURITY((short) -2, FunctionalColorGroupEnum.getColorGroup((short) -2)),
60 ACCESS((short) -3, FunctionalColorGroupEnum.getColorGroup((short) -3));
62 private final short colorGroup;
63 private final FunctionalColorGroupEnum color;
65 static final Map<Short, FuncNameAndColorGroupEnum> COLOR_GROUPS = new HashMap<>();
68 for (FuncNameAndColorGroupEnum colorGroup : FuncNameAndColorGroupEnum.values()) {
69 COLOR_GROUPS.put(colorGroup.getFunctionalColorGroup(), colorGroup);
74 * Returns true, if contains the given output mode id in DigitalSTROM, otherwise false.
76 * @param functionalNameGroupID to be checked
77 * @return true, if contains
79 public static boolean containsColorGroup(Short functionalNameGroupID) {
80 return COLOR_GROUPS.keySet().contains(functionalNameGroupID);
84 * Returns the {@link FuncNameAndColorGroupEnum} of the given functional name group id.
86 * @param functionalNameGroupID of the {@link FuncNameAndColorGroupEnum}
87 * @return FunctionalNameAndColorGroupEnum
89 public static FuncNameAndColorGroupEnum getMode(Short functionalNameGroupID) {
90 return COLOR_GROUPS.get(functionalNameGroupID);
93 private FuncNameAndColorGroupEnum(short functionalColorGroupID, FunctionalColorGroupEnum functionalColorGroup) {
94 this.colorGroup = functionalColorGroupID;
95 this.color = functionalColorGroup;
99 * Returns the functional name group id form this Object.
101 * @return functional name group id
103 public Short getFunctionalColorGroup() {
108 * Returns the {@link FunctionalColorGroupEnum} form this Object.
110 * @return FunctionalColorGroupEnum
112 public FunctionalColorGroupEnum getFunctionalColor() {