]> git.basschouten.com Git - openhab-addons.git/blob
f9b8c94b8052f28364896f5aba2326aae7011eb7
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.homekit.internal;
14
15 import java.util.HashMap;
16 import java.util.Map;
17 import java.util.Optional;
18
19 /**
20  * Enum of the possible device types. The defined tag string can be used
21  * as a tag on an item to enable it for Homekit.
22  *
23  * @author Andy Lintner - Initial contribution
24  */
25 public enum HomekitAccessoryType {
26     ACCESSORY_GROUP("AccessoryGroup"),
27     DUMMY("Dummy"),
28
29     AIR_QUALITY_SENSOR("AirQualitySensor"),
30     BASIC_FAN("BasicFan"),
31     BATTERY("Battery"),
32     CARBON_DIOXIDE_SENSOR("CarbonDioxideSensor"),
33     CARBON_MONOXIDE_SENSOR("CarbonMonoxideSensor"),
34     CONTACT_SENSOR("ContactSensor"),
35     DOOR("Door"),
36     FAN("Fan"),
37     FAUCET("Faucet"),
38     FILTER_MAINTENANCE("Filter"),
39     GARAGE_DOOR_OPENER("GarageDoorOpener"),
40     HEATER_COOLER("HeaterCooler"),
41     HUMIDITY_SENSOR("HumiditySensor"),
42     INPUT_SOURCE("InputSource"),
43     IRRIGATION_SYSTEM("IrrigationSystem"),
44     LEAK_SENSOR("LeakSensor"),
45     LIGHT_SENSOR("LightSensor"),
46     LIGHTBULB("Lighting"),
47     LOCK("Lock"),
48     MICROPHONE("Microphone"),
49     MOTION_SENSOR("MotionSensor"),
50     OCCUPANCY_SENSOR("OccupancySensor"),
51     OUTLET("Outlet"),
52     SECURITY_SYSTEM("SecuritySystem"),
53     SLAT("Slat"),
54     SMART_SPEAKER("SmartSpeaker"),
55     SMOKE_SENSOR("SmokeSensor"),
56     SPEAKER("Speaker"),
57     SWITCH("Switchable"),
58     TELEVISION("Television"),
59     TELEVISION_SPEAKER("TelevisionSpeaker"),
60     TEMPERATURE_SENSOR("TemperatureSensor"),
61     THERMOSTAT("Thermostat"),
62     VALVE("Valve"),
63     WINDOW("Window"),
64     WINDOW_COVERING("WindowCovering");
65
66     private static final Map<String, HomekitAccessoryType> TAG_MAP = new HashMap<>();
67
68     static {
69         for (HomekitAccessoryType type : HomekitAccessoryType.values()) {
70             TAG_MAP.put(type.tag, type);
71         }
72     }
73
74     private final String tag;
75
76     private HomekitAccessoryType(String tag) {
77         this.tag = tag;
78     }
79
80     public String getTag() {
81         return tag;
82     }
83
84     /**
85      * get accessoryType from String
86      *
87      * @param tag the tag string
88      * @return accessoryType or Optional.empty if no accessory type for the tag was found
89      */
90     public static Optional<HomekitAccessoryType> valueOfTag(String tag) {
91         return Optional.ofNullable(TAG_MAP.get(tag));
92     }
93 }