]> git.basschouten.com Git - openhab-addons.git/blob
a796305b3fd343d3eb1df53f516fe02e3dde230c
[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.io.imperihome.internal.model.device;
14
15 /**
16  * Device type enumeration. Contains ImperiHome API type strings.
17  *
18  * @author Pepijn de Geus - Initial contribution
19  */
20 public enum DeviceType {
21
22     SWITCH("DevSwitch"),
23     DIMMER("DevDimmer"),
24     CAMERA("DevCamera"),
25     CO2("DevCO2"),
26     CO2_ALERT("DevCO2Alert"),
27     DOOR("DevDoor"),
28     ELECTRICITY("DevElectricity"),
29     FLOOD("DevFlood"),
30     GENERIC_SENSOR("DevGenericSensor"),
31     HYGROMETRY("DevHygrometry"),
32     LOCK("DevLock"),
33     LUMINOSITY("DevLuminosity"),
34     MOTION("DevMotion"),
35     MULTI_SWITCH("DevMultiSwitch"),
36     NOISE("DevNoise"),
37     PLAYER("DevPlayer"),
38     PLAYLIST("DevPlaylist"),
39     PRESSURE("DevPressure"),
40     RAIN("DevRain"),
41     RGB_LIGHT("DevRGBLight"),
42     SCENE("DevScene"),
43     SHUTTER("DevShutter"),
44     SMOKE("DevSmoke"),
45     TEMPERATURE("DevTemperature"),
46     TEMP_HYGRO("DevTempHygro"),
47     THERMOSTAT("DevThermostat", "curmode", "curtemp"),
48     UV("DevUV"),
49     WIND("DevWind");
50
51     private final String apiString;
52     private final String[] requiredLinks;
53
54     DeviceType(String apiString, String... requiredLinks) {
55         this.apiString = apiString;
56         this.requiredLinks = requiredLinks;
57     }
58
59     public String getApiString() {
60         return apiString;
61     }
62
63     public String[] getRequiredLinks() {
64         return requiredLinks;
65     }
66
67     public static DeviceType forApiString(String apiString) {
68         for (DeviceType deviceType : values()) {
69             if (deviceType.getApiString().equalsIgnoreCase(apiString.trim())) {
70                 return deviceType;
71             }
72         }
73
74         return null;
75     }
76 }