]> git.basschouten.com Git - openhab-addons.git/blob
79f2ce6e766e7c91a9ce9b3fbce3dba82b2e2b6d
[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 ZoneSceneEnum} lists all zone scenes which are available on the dSS-web-interface.
20  *
21  * @author Michael Ochel - Initial contribution
22  * @author Matthias Siegele - Initial contribution
23  */
24 public enum ZoneSceneEnum implements Scene {
25
26     DEEP_OFF((short) 68),
27     STANDBY((short) 67),
28     SLEEPING((short) 69),
29     WAKEUP((short) 70);
30
31     private final short sceneNumber;
32     static final Map<Short, ZoneSceneEnum> ZONE_SCENES = new HashMap<>();
33
34     static {
35         for (ZoneSceneEnum zs : ZoneSceneEnum.values()) {
36             ZONE_SCENES.put(zs.getSceneNumber(), zs);
37         }
38     }
39
40     private ZoneSceneEnum(short sceneNumber) {
41         this.sceneNumber = sceneNumber;
42     }
43
44     /**
45      * Returns the {@link ZoneSceneEnum} of the given scene number.
46      *
47      * @param sceneNumber of the {@link ZoneSceneEnum}
48      * @return ZoneSceneEnum
49      */
50     public static ZoneSceneEnum getZoneScene(short sceneNumber) {
51         return ZONE_SCENES.get(sceneNumber);
52     }
53
54     /**
55      * Returns true, if the given scene number contains in digitalSTROM zone scenes, otherwise false.
56      *
57      * @param sceneNumber to be checked
58      * @return true, if contains, otherwise false
59      */
60     public static boolean containsScene(Short sceneNumber) {
61         return ZONE_SCENES.keySet().contains(sceneNumber);
62     }
63
64     @Override
65     public Short getSceneNumber() {
66         return this.sceneNumber;
67     }
68 }