2 * Copyright (c) 2010-2023 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.binding.hue.internal;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.openhab.core.thing.ThingTypeUID;
22 * The {@link HueBindingConstants} class defines common constants, which are
23 * used across the whole binding.
25 * @author Kai Kreuzer - Initial contribution
26 * @author Jochen Hiller - Added OSRAM Classic A60 RGBW
27 * @author Markus Mazurczak - Added OSRAM PAR16 50
28 * @author Andre Fuechsel - changed to generic thing types
29 * @author Samuel Leisering - Added support for sensor API
30 * @author Christoph Weitkamp - Added support for sensor API
33 public class HueBindingConstants {
35 public static final String BINDING_ID = "hue";
37 // List all Thing Type UIDs, related to the Hue Binding
40 public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge");
42 // generic thing types
43 public static final ThingTypeUID THING_TYPE_ON_OFF_LIGHT = new ThingTypeUID(BINDING_ID, "0000");
44 public static final ThingTypeUID THING_TYPE_ON_OFF_PLUG = new ThingTypeUID(BINDING_ID, "0010");
45 public static final ThingTypeUID THING_TYPE_COLOR_LIGHT = new ThingTypeUID(BINDING_ID, "0200");
46 public static final ThingTypeUID THING_TYPE_COLOR_TEMPERATURE_LIGHT = new ThingTypeUID(BINDING_ID, "0220");
47 public static final ThingTypeUID THING_TYPE_EXTENDED_COLOR_LIGHT = new ThingTypeUID(BINDING_ID, "0210");
48 public static final ThingTypeUID THING_TYPE_DIMMABLE_LIGHT = new ThingTypeUID(BINDING_ID, "0100");
49 public static final ThingTypeUID THING_TYPE_DIMMABLE_PLUG = new ThingTypeUID(BINDING_ID, "0110");
51 public static final ThingTypeUID THING_TYPE_DIMMER_SWITCH = new ThingTypeUID(BINDING_ID, "0820");
52 public static final ThingTypeUID THING_TYPE_TAP_SWITCH = new ThingTypeUID(BINDING_ID, "0830");
53 public static final ThingTypeUID THING_TYPE_CLIP_GENERIC_STATUS = new ThingTypeUID(BINDING_ID, "0840");
54 public static final ThingTypeUID THING_TYPE_CLIP_GENERIC_FLAG = new ThingTypeUID(BINDING_ID, "0850");
55 public static final ThingTypeUID THING_TYPE_PRESENCE_SENSOR = new ThingTypeUID(BINDING_ID, "0107");
56 public static final ThingTypeUID THING_TYPE_GEOFENCE_SENSOR = new ThingTypeUID(BINDING_ID, "geofencesensor");
57 public static final ThingTypeUID THING_TYPE_TEMPERATURE_SENSOR = new ThingTypeUID(BINDING_ID, "0302");
58 public static final ThingTypeUID THING_TYPE_LIGHT_LEVEL_SENSOR = new ThingTypeUID(BINDING_ID, "0106");
59 public static final ThingTypeUID THING_TYPE_GROUP = new ThingTypeUID(BINDING_ID, "group");
61 public static final Set<ThingTypeUID> V1_THING_TYPE_UIDS = Set.of(THING_TYPE_COLOR_LIGHT,
62 THING_TYPE_COLOR_TEMPERATURE_LIGHT, THING_TYPE_DIMMABLE_LIGHT, THING_TYPE_EXTENDED_COLOR_LIGHT,
63 THING_TYPE_ON_OFF_LIGHT, THING_TYPE_ON_OFF_PLUG, THING_TYPE_DIMMABLE_PLUG, THING_TYPE_DIMMER_SWITCH,
64 THING_TYPE_TAP_SWITCH, THING_TYPE_PRESENCE_SENSOR, THING_TYPE_TEMPERATURE_SENSOR,
65 THING_TYPE_LIGHT_LEVEL_SENSOR, THING_TYPE_GROUP);
68 public static final String CHANNEL_COLORTEMPERATURE = "color_temperature";
69 public static final String CHANNEL_COLORTEMPERATURE_ABS = "color_temperature_abs";
70 public static final String CHANNEL_COLOR = "color";
71 public static final String CHANNEL_BRIGHTNESS = "brightness";
72 public static final String CHANNEL_ALERT = "alert";
73 public static final String CHANNEL_EFFECT = "effect";
74 public static final String CHANNEL_SWITCH = "switch";
75 public static final String CHANNEL_DIMMER_SWITCH = "dimmer_switch";
76 public static final String CHANNEL_TAP_SWITCH = "tap_switch";
77 public static final String CHANNEL_PRESENCE = "presence";
78 public static final String CHANNEL_ENABLED = "enabled";
79 public static final String CHANNEL_TEMPERATURE = "temperature";
80 public static final String CHANNEL_LAST_UPDATED = "last_updated";
81 public static final String CHANNEL_BATTERY_LEVEL = "battery_level";
82 public static final String CHANNEL_BATTERY_LOW = "battery_low";
83 public static final String CHANNEL_ILLUMINANCE = "illuminance";
84 public static final String CHANNEL_LIGHT_LEVEL = "light_level";
85 public static final String CHANNEL_DARK = "dark";
86 public static final String CHANNEL_DAYLIGHT = "daylight";
87 public static final String CHANNEL_STATUS = "status";
88 public static final String CHANNEL_FLAG = "flag";
89 public static final String CHANNEL_SCENE = "scene";
92 public static final String EVENT_DIMMER_SWITCH = "dimmer_switch_event";
93 public static final String EVENT_TAP_SWITCH = "tap_switch_event";
95 // Binding configuration properties
96 public static final String REMOVAL_GRACE_PERIOD = "removalGracePeriod";
98 // Bridge config properties
99 public static final String HOST = "ipAddress";
100 public static final String PORT = "port";
101 public static final String PROTOCOL = "protocol";
102 public static final String USER_NAME = "userName";
104 // Thing configuration properties
105 public static final String LIGHT_ID = "lightId";
106 public static final String SENSOR_ID = "sensorId";
107 public static final String PROPERTY_PRODUCT_NAME = "productName";
108 public static final String UNIQUE_ID = "uniqueId";
109 public static final String FADETIME = "fadetime";
110 public static final String GROUP_ID = "groupId";
112 // property names for API v2
113 public static final String PROPERTY_RESOURCE_ID = "resourceId";
114 public static final String PROPERTY_RESOURCE_TYPE = "resourceType";
115 public static final String PROPERTY_RESOURCE_NAME = "resourceName";
116 public static final String PROPERTY_RESOURCE_ARCHETYPE = "resourceArchetype";
117 public static final String PROPERTY_PRODUCT_ARCHETYPE = "productArchetype";
118 public static final String PROPERTY_PRODUCT_CERTIFIED = "productCertified";
119 public static final String PROPERTY_LEGACY_THING_UID = "legacyThingUID";
120 public static final String PROPERTY_OWNER = "owner";
121 public static final String PROPERTY_OWNER_TYPE = "ownerType";
122 public static final String PROPERTY_DIMMING_RANGE = "dimmingRange";
123 public static final String PROPERTY_COLOR_TEMP_RANGE = "colorTemperatureRange";
124 public static final String PROPERTY_COLOR_GAMUT = "colorGamut";
126 public static final String NORMALIZE_ID_REGEX = "[^a-zA-Z0-9_]";
128 public static final String DISCOVERY_LABEL_PATTERN = "Philips Hue (%s)";
130 // I18N string references
131 public static final String TEXT_OFFLINE_COMMUNICATION_ERROR = "@text/offline.communication-error";
132 public static final String TEXT_OFFLINE_CONFIGURATION_ERROR_INVALID_SSL_CERIFICATE = "@text/offline.conf-error-invalid-ssl-certificate";
134 // Config status messages
135 public static final String IP_ADDRESS_MISSING = "missing-ip-address-configuration";
137 // thing types for API v2
138 public static final ThingTypeUID THING_TYPE_BRIDGE_API2 = new ThingTypeUID(BINDING_ID, "bridge-api2");
139 public static final ThingTypeUID THING_TYPE_DEVICE = new ThingTypeUID(BINDING_ID, "device");
140 public static final ThingTypeUID THING_TYPE_ZONE = new ThingTypeUID(BINDING_ID, "zone");
141 public static final ThingTypeUID THING_TYPE_ROOM = new ThingTypeUID(BINDING_ID, "room");
143 // channels for API v2
144 public static final String CHANNEL_2_COLOR = CHANNEL_COLOR;
145 public static final String CHANNEL_2_COLOR_TEMP_PERCENT = "color-temperature";
146 public static final String CHANNEL_2_COLOR_TEMP_ABSOLUTE = "color-temperature-abs";
147 public static final String CHANNEL_2_BRIGHTNESS = CHANNEL_BRIGHTNESS;
148 public static final String CHANNEL_2_SWITCH = CHANNEL_SWITCH;
149 public static final String CHANNEL_2_SCENE = CHANNEL_SCENE;
150 public static final String CHANNEL_2_DYNAMICS = "dynamics";
151 public static final String CHANNEL_2_ALERT = CHANNEL_ALERT;
152 public static final String CHANNEL_2_EFFECT = CHANNEL_EFFECT;
153 public static final String CHANNEL_2_BUTTON_LAST_EVENT = "button-last-event";
154 public static final String CHANNEL_2_ROTARY_STEPS = "rotary-steps";
155 public static final String CHANNEL_2_MOTION = "motion";
156 public static final String CHANNEL_2_MOTION_ENABLED = "motion-enabled";
157 public static final String CHANNEL_2_LIGHT_LEVEL = "light-level";
158 public static final String CHANNEL_2_LIGHT_LEVEL_ENABLED = "light-level-enabled";
159 public static final String CHANNEL_2_TEMPERATURE = CHANNEL_TEMPERATURE;
160 public static final String CHANNEL_2_TEMPERATURE_ENABLED = "temperature-enabled";
161 public static final String CHANNEL_2_BATTERY_LEVEL = "battery-level";
162 public static final String CHANNEL_2_BATTERY_LOW = "battery-low";
163 public static final String CHANNEL_2_LAST_UPDATED = "last-updated";
164 public static final String CHANNEL_2_COLOR_XY_ONLY = "color-xy-only";
165 public static final String CHANNEL_2_DIMMING_ONLY = "dimming-only";
166 public static final String CHANNEL_2_ON_OFF_ONLY = "on-off-only";
168 // channel IDs that (optionally) support dynamics
169 public static final Set<String> DYNAMIC_CHANNELS = Set.of(CHANNEL_2_BRIGHTNESS, CHANNEL_2_COLOR,
170 CHANNEL_2_COLOR_TEMP_PERCENT, CHANNEL_2_COLOR_TEMP_ABSOLUTE, CHANNEL_2_SCENE, CHANNEL_2_EFFECT);
173 * Map of API v1 channel IDs against API v2 channel IDs where, if the v1 channel exists in the system, then we
174 * should try to replicate the channel/item links from the v1 channel into the respective v2 channel.
176 public static final Map<String, String> REPLICATE_CHANNEL_ID_MAP = Map.ofEntries(
177 Map.entry(CHANNEL_BRIGHTNESS, CHANNEL_2_BRIGHTNESS), //
178 Map.entry(CHANNEL_COLOR, CHANNEL_2_COLOR), //
179 Map.entry(CHANNEL_SWITCH, CHANNEL_2_SWITCH), //
180 Map.entry(CHANNEL_SCENE, CHANNEL_2_SCENE), //
181 Map.entry(CHANNEL_COLORTEMPERATURE, CHANNEL_2_COLOR_TEMP_PERCENT), //
182 Map.entry(CHANNEL_COLORTEMPERATURE_ABS, CHANNEL_2_COLOR_TEMP_ABSOLUTE), //
183 Map.entry(CHANNEL_DIMMER_SWITCH, CHANNEL_2_BUTTON_LAST_EVENT), //
184 Map.entry(CHANNEL_LIGHT_LEVEL, CHANNEL_2_LIGHT_LEVEL), //
185 Map.entry(CHANNEL_PRESENCE, CHANNEL_2_MOTION), //
186 Map.entry(CHANNEL_TEMPERATURE, CHANNEL_2_TEMPERATURE), //
187 Map.entry(CHANNEL_BATTERY_LEVEL, CHANNEL_2_BATTERY_LEVEL), //
188 Map.entry(CHANNEL_BATTERY_LOW, CHANNEL_2_BATTERY_LOW), //
189 Map.entry(CHANNEL_LAST_UPDATED, CHANNEL_2_LAST_UPDATED));
191 public static final String ALL_LIGHTS_KEY = "discovery.group.all-lights.label";