2 * Copyright (c) 2010-2022 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.io.homekit.internal;
15 import java.util.HashMap;
17 import java.util.Optional;
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.
23 * @author Andy Lintner - Initial contribution
25 public enum HomekitAccessoryType {
26 HUMIDITY_SENSOR("HumiditySensor"),
27 LIGHTBULB("Lighting"),
29 TEMPERATURE_SENSOR("TemperatureSensor"),
30 THERMOSTAT("Thermostat"),
31 CONTACT_SENSOR("ContactSensor"),
33 LEAK_SENSOR("LeakSensor"),
34 MOTION_SENSOR("MotionSensor"),
35 OCCUPANCY_SENSOR("OccupancySensor"),
36 WINDOW_COVERING("WindowCovering"),
39 SMOKE_SENSOR("SmokeSensor"),
40 CARBON_MONOXIDE_SENSOR("CarbonMonoxideSensor"),
41 CARBON_DIOXIDE_SENSOR("CarbonDioxideSensor"),
44 SECURITY_SYSTEM("SecuritySystem"),
47 SMART_SPEAKER("SmartSpeaker"),
48 GARAGE_DOOR_OPENER("GarageDoorOpener"),
49 HEATER_COOLER("HeaterCooler"),
50 LIGHT_SENSOR("LightSensor"),
51 AIR_QUALITY_SENSOR("AirQualitySensor"),
53 FILTER_MAINTENANCE("Filter"),
55 MICROPHONE("Microphone"),
59 private static final Map<String, HomekitAccessoryType> TAG_MAP = new HashMap<>();
62 for (HomekitAccessoryType type : HomekitAccessoryType.values()) {
63 TAG_MAP.put(type.tag, type);
67 private final String tag;
69 private HomekitAccessoryType(String tag) {
73 public String getTag() {
78 * get accessoryType from String
80 * @param tag the tag string
81 * @return accessoryType or Optional.empty if no accessory type for the tag was found
83 public static Optional<HomekitAccessoryType> valueOfTag(String tag) {
84 return Optional.ofNullable(TAG_MAP.get(tag));