]> git.basschouten.com Git - openhab-addons.git/blob
db3475fac4e4f97ac3f82232e8e295c10b2678af
[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.digitalstrom.internal.lib.structure.scene.constants;
14
15 import java.util.HashMap;
16 import java.util.Map;
17
18 /**
19  * The {@link SceneEnum} lists all available scenes of digitalSTROM.
20  *
21  * @author Alexander Betker - Initial contribution
22  * @version digitalSTROM-API 1.14.5
23  *
24  * @author Michael Ochel - add new scenes and missing java-doc
25  * @author Mathias Siegele - add new scenes and missing java-doc
26  *
27  */
28 public enum SceneEnum implements Scene {
29
30     /*
31      * see http://developer.digitalstrom.org/Architecture/ds-basics.pdf appendix B, page 44
32      */
33
34     /* Area scene commands */
35     AREA_1_OFF((short) 1), // Set output value to Preset Area 1 Off (Default: Off)
36     AREA_1_ON((short) 6), // Set output value to Preset Area 1 On (Default: On)
37     AREA_1_INCREMENT((short) 43), // Initial command to increment output value
38     AREA_1_DECREMENT((short) 42), // Initial command to decrement output value
39     AREA_1_STOP((short) 52), // Stop output value change at current position
40     AREA_STEPPING_CONTINUE((short) 10), // Next step to increment or decrement
41
42     AREA_2_OFF((short) 2), // Set output value to Area 2 Off (Default: Off)
43     AREA_2_ON((short) 7), // Set output value to Area 2 On (Default: On)
44     AREA_2_INCREMENT((short) 45), // Initial command to increment output value
45     AREA_2_DECREMENT((short) 44), // Initial command to decrement output value
46     AREA_2_STOP((short) 53), // Stop output value change at current position
47
48     AREA_3_OFF((short) 3), // Set output value to Area 3 Off (Default: Off)
49     AREA_3_ON((short) 8), // Set output value to Area 3 On (Default: On)
50     AREA_3_INCREMENT((short) 47), // Initial command to increment output value
51     AREA_3_DECREMENT((short) 46), // Initial command to decrement output value
52     AREA_3_STOP((short) 54), // Stop output value change at current position
53
54     AREA_4_OFF((short) 4), // Set output value to Area 4 Off (Default: Off)
55     AREA_4_ON((short) 9), // Set output value to Area 4 On (Default: On)
56     AREA_4_INCREMENT((short) 49), // Initial command to increment output value
57     AREA_4_DECREMENT((short) 48), // Initial command to decrement output value
58     AREA_4_STOP((short) 55), // Stop output value change at current position
59
60     /* local pushbutton scene commands */
61     DEVICE_ON((short) 51), // Local on
62     DEVICE_OFF((short) 50), // Local off
63     DEVICE_STOP((short) 15), // Stop output value change at current position
64
65     /* special scene commands */
66     MINIMUM((short) 13), // Minimum output value
67     MAXIMUM((short) 14), // Maximum output value
68     STOP((short) 15), // Stop output value change at current position
69     AUTO_OFF((short) 40), // slowly fade down to off
70
71     /* stepping scene commands */
72     INCREMENT((short) 12), // Increment output value (in the basic.pdf it is 11 but its wrong)
73     DECREMENT((short) 11), // Decrement output value (in the basic.pdf it is 12 but its wrong)
74
75     /* presets */
76     PRESET_0((short) 0), // Set output value to Preset 0 (Default: Off)
77     PRESET_1((short) 5), // Set output value to Preset 1 (Default: On)
78     PRESET_2((short) 17), // Set output value to Preset 2
79     PRESET_3((short) 18), // Set output value to Preset 3
80     PRESET_4((short) 19), // Set output value to Preset 4
81
82     PRESET_10((short) 32), // Set output value to Preset 10 (Default: Off)
83     PRESET_11((short) 33), // Set output value to Preset 11 (Default: On)
84     PRESET_12((short) 20), // Set output value to Preset 12
85     PRESET_13((short) 21), // Set output value to Preset 13
86     PRESET_14((short) 22), // Set output value to Preset 14
87
88     PRESET_20((short) 34), // Set output value to Preset 20 (Default: Off)
89     PRESET_21((short) 35), // Set output value to Preset 21 (Default: On)
90     PRESET_22((short) 23), // Set output value to Preset 22
91     PRESET_23((short) 24), // Set output value to Preset 23
92     PRESET_24((short) 25), // Set output value to Preset 24
93
94     PRESET_30((short) 36), // Set output value to Preset 30 (Default: Off)
95     PRESET_31((short) 37), // Set output value to Preset 31 (Default: On)
96     PRESET_32((short) 26), // Set output value to Preset 32
97     PRESET_33((short) 27), // Set output value to Preset 33
98     PRESET_34((short) 28), // Set output value to Preset 34
99
100     PRESET_40((short) 38), // Set output value to Preset 40 (Default: Off)
101     PRESET_41((short) 39), // Set output value to Preset 41 (Default: On)
102     PRESET_42((short) 29), // Set output value to Preset 42
103     PRESET_43((short) 30), // Set output value to Preset 43
104     PRESET_44((short) 31), // Set output value to Preset 44
105
106     /* group independent scene commands */
107     DEEP_OFF((short) 68),
108     ENERGY_OVERLOAD((short) 66),
109     STANDBY((short) 67),
110     ZONE_ACTIVE((short) 75),
111     ALARM_SIGNAL((short) 74),
112     AUTO_STANDBY((short) 64),
113     ABSENT((short) 72),
114     PRESENT((short) 71),
115     SLEEPING((short) 69),
116     WAKEUP((short) 70),
117     DOOR_BELL((short) 73),
118     PANIC((short) 65),
119     FIRE((short) 76),
120     ALARM_1((short) 74),
121     ALARM_2((short) 83),
122     ALARM_3((short) 84),
123     ALARM_4((short) 85),
124     WIND((short) 86),
125     NO_WIND((short) 87),
126     RAIN((short) 88),
127     NO_RAIN((short) 89),
128     HAIL((short) 90),
129     NO_HAIL((short) 91);
130
131     private final short sceneNumber;
132     static final Map<Short, SceneEnum> DIGITALSTROM_SCENES = new HashMap<>();
133
134     static {
135         for (SceneEnum zs : SceneEnum.values()) {
136             DIGITALSTROM_SCENES.put(zs.getSceneNumber(), zs);
137         }
138     }
139
140     private SceneEnum(short sceneNumber) {
141         this.sceneNumber = sceneNumber;
142     }
143
144     /**
145      * Returns the {@link SceneEnum} for the given scene number.
146      *
147      * @param sceneNumber of the {@link SceneEnum}
148      * @return SceneEnum
149      */
150     public static SceneEnum getScene(short sceneNumber) {
151         return DIGITALSTROM_SCENES.get(sceneNumber);
152     }
153
154     /**
155      * Returns true, if the given scene number contains in digitalSTROM scenes, otherwise false.
156      *
157      * @param sceneNumber to be checked
158      * @return true, if contains otherwise false
159      */
160     public static boolean containsScene(Short sceneNumber) {
161         return DIGITALSTROM_SCENES.keySet().contains(sceneNumber);
162     }
163
164     @Override
165     public Short getSceneNumber() {
166         return this.sceneNumber;
167     }
168 }