]> git.basschouten.com Git - openhab-addons.git/blob
291f2fd4851611bf132586a18c23da66a052942a
[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 ApartmentSceneEnum} lists all group independent scenes from digitalSTROM which are callable at the
20  * digitalSTROM web interface.
21  *
22  * @author Alexander Betker - Initial contribution
23  *
24  * @author Michael Ochel - add new scenes and deleted scenes which are show as zone scenes in the dss-web-interface
25  * @author Mathias Siegele - add new scenes and deleted scenes which are show as zone scenes in the dss-web-interface
26  */
27 public enum ApartmentSceneEnum implements Scene {
28     /*
29      * see http://developer.digitalstrom.org/Architecture/ds-basics.pdf , Table 35: Group independent activities and
30      * scene
31      * command values, page 47 and dss-web-interface
32      *
33      */
34     ENERGY_OVERLOAD((short) 66),
35     ZONE_ACTIVE((short) 75),
36     ALARM_SIGNAL((short) 74),
37     AUTO_STANDBY((short) 64),
38     ABSENT((short) 72),
39     PRESENT((short) 71),
40     DOOR_BELL((short) 73),
41     PANIC((short) 65),
42     FIRE((short) 76),
43     ALARM_1((short) 74),
44     ALARM_2((short) 83),
45     ALARM_3((short) 84),
46     ALARM_4((short) 85),
47     WIND((short) 86),
48     NO_WIND((short) 87),
49     RAIN((short) 88),
50     NO_RAIN((short) 89),
51     HAIL((short) 90),
52     NO_HAIL((short) 91);
53
54     private final short sceneNumber;
55     static final Map<Short, ApartmentSceneEnum> APARTAMENT_SCENES = new HashMap<>();
56
57     static {
58         for (ApartmentSceneEnum as : ApartmentSceneEnum.values()) {
59             APARTAMENT_SCENES.put(as.getSceneNumber(), as);
60         }
61     }
62
63     private ApartmentSceneEnum(Short sceneNumber) {
64         this.sceneNumber = sceneNumber;
65     }
66
67     /**
68      * Returns the apartment scene from the given scene number.
69      *
70      * @param sceneNumber of the {@link ApartmentSceneEnum}
71      * @return apartment scene
72      */
73     public static ApartmentSceneEnum getApartmentScene(short sceneNumber) {
74         return APARTAMENT_SCENES.get(sceneNumber);
75     }
76
77     /**
78      * Returns true, if the given scene number contains in digitalSTROM apartment scenes, otherwise false.
79      *
80      * @param sceneNumber to be checked
81      * @return true, if contains, otherwise false
82      */
83     public static boolean containsScene(Short sceneNumber) {
84         return APARTAMENT_SCENES.keySet().contains(sceneNumber);
85     }
86
87     @Override
88     public Short getSceneNumber() {
89         return this.sceneNumber;
90     }
91 }