]> git.basschouten.com Git - openhab-addons.git/blob
b77eb7d60be4263fd651f1cf585a14f8e06ee179
[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.devices.deviceparameters.constants;
14
15 /**
16  * This enum contains all binary inputs with they id. <br>
17  *
18  * @author Michael Ochel - initial contributer
19  * @author Matthias Siegele - initial contributer
20  */
21 public enum DeviceBinarayInputEnum {
22
23     /*
24      * Taken from http://developer.digitalstrom.org/Architecture/ds-basics.pdf#5f
25      *
26      * Input Type | Assigned Index | Natural Device and Description
27      * Presence | 1 | Presence detector
28      * Brightness | 2 | ---
29      * Presence in darkness | 3 | Presence detector with activated internal twilight sensor
30      * Twilight | 4 | Twilight sensor
31      * Motion | 5 | Motion detector
32      * Motion in darkness | 6 | Motion detect or with activated internal twilight sensor
33      * Smoke | 7 | Smoke Detector
34      * Wind strength above limit | 8 | Wind monitor with user-adjusted wind strength threshold
35      * Rain | 9 | Rain monitor
36      * Sun radiation | 10 | Sun light above threshold
37      * Temperature below limit | 11 | Room thermostat with used-adjusted temperature threshold
38      * Battery status is low | 12 | electric battery is running out of power
39      * Window is open | 13 | Window contact
40      * Door is open | 14 | Door contact
41      * Window is tilted | 15 | Window handle; window is tilted instead of fully opened
42      * Garage door is open | 16 | Garage door contact
43      * Sun protection | 17 | Protect against too much sun light
44      * Frost | 18 | Frost detector
45      * --dS-Basics Version: v1.3-branch August 19, 2015, Table 16: Binary input types--
46      *
47      * Heating operation on/off | 19 |
48      * Change-over heating/cooling | 20 |
49      * --dS-web-interface server-version: 1.21.1--
50      *
51      *
52      * Target Function | Assigned Index
53      * Joker | 8
54      * --dS-Basics Version: v1.3-branch August 19, 2015, Table 17: Binary input target functions--
55      */
56
57     PRESENCE((short) 1),
58     BRIGHTNESS((short) 2),
59     PRESENCE_IN_DARKNESS((short) 3),
60     TWILIGHT((short) 4),
61     MOTION((short) 5),
62     MOTION_IN_DARKNESS((short) 6),
63     SMOKE((short) 7),
64     WIND_STRENGHT_ABOVE_LIMIT((short) 8),
65     RAIN((short) 9),
66     SUN_RADIATION((short) 10),
67     TEMPERATION_BELOW_LIMIT((short) 11),
68     BATTERY_STATUS_IS_LOW((short) 12),
69     WINDOW_IS_OPEN((short) 13),
70     DOOR_IS_OPEN((short) 14),
71     WINDOW_IS_TILTED((short) 15),
72     GARAGE_DOOR_IS_OPEN((short) 16),
73     SUN_PROTECTION((short) 17),
74     FROST((short) 18),
75     HEATING_OPERATION_ON_OFF((short) 19),
76     CHANGE_OVER_HEATING_COOLING((short) 20);
77
78     private final Short binaryInputType;
79     private static DeviceBinarayInputEnum[] deviceBinarayInputs = new DeviceBinarayInputEnum[DeviceBinarayInputEnum
80             .values().length];
81
82     static {
83         for (DeviceBinarayInputEnum deviceBinarayInput : DeviceBinarayInputEnum.values()) {
84             deviceBinarayInputs[deviceBinarayInput.binaryInputType - 1] = deviceBinarayInput;
85         }
86     }
87
88     private DeviceBinarayInputEnum(Short binaryInputType) {
89         this.binaryInputType = binaryInputType;
90     }
91
92     /**
93      * Returns the id of this {@link DeviceBinarayInputEnum}.
94      *
95      * @return id
96      */
97     public Short getBinaryInputType() {
98         return binaryInputType;
99     }
100
101     /**
102      * Returns the {@link DeviceBinarayInputEnum} of the given id or null, if no {@link DeviceBinarayInputEnum} exist
103      * for the id.
104      *
105      * @param binaryInputTypeID of the {@link DeviceBinarayInputEnum}
106      * @return the {@link DeviceBinarayInputEnum} of the id
107      */
108     public static DeviceBinarayInputEnum getdeviceBinarayInput(Short binaryInputTypeID) {
109         try {
110             return deviceBinarayInputs[binaryInputTypeID - 1];
111         } catch (IndexOutOfBoundsException e) {
112             return null;
113         }
114     }
115 }