]> git.basschouten.com Git - openhab-addons.git/blob
04dee188bdef156a856e9ca50d956aad3238b4f4
[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.binding.shelly.internal;
14
15 import static org.openhab.binding.shelly.internal.discovery.ShellyThingCreator.*;
16
17 import java.util.Set;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.core.thing.ThingTypeUID;
21
22 /**
23  * The {@link ShellyBindingConstants} class defines common constants, which are
24  * used across the whole binding.
25  *
26  * @author Markus Michels - Initial contribution
27  */
28 @NonNullByDefault
29 public class ShellyBindingConstants {
30
31     public static final String VENDOR = "Shelly";
32     public static final String BINDING_ID = "shelly";
33     public static final String SYSTEM_ID = "system";
34
35     public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_SHELLY1, //
36             THING_TYPE_SHELLY1L, //
37             THING_TYPE_SHELLY1PM, //
38             THING_TYPE_SHELLYEM, //
39             THING_TYPE_SHELLY3EM, //
40             THING_TYPE_SHELLY2_RELAY, //
41             THING_TYPE_SHELLY2_ROLLER, //
42             THING_TYPE_SHELLY25_RELAY, //
43             THING_TYPE_SHELLY25_ROLLER, //
44             THING_TYPE_SHELLY4PRO, //
45             THING_TYPE_SHELLYPLUG, //
46             THING_TYPE_SHELLYPLUGS, //
47             THING_TYPE_SHELLYPLUGU1, //
48             THING_TYPE_SHELLYUNI, //
49             THING_TYPE_SHELLYDIMMER, //
50             THING_TYPE_SHELLYDIMMER2, //
51             THING_TYPE_SHELLYIX3, //
52             THING_TYPE_SHELLYBULB, //
53             THING_TYPE_SHELLYDUO, //
54             THING_TYPE_SHELLYVINTAGE, //
55             THING_TYPE_SHELLYDUORGBW, //
56             THING_TYPE_SHELLYRGBW2_COLOR, //
57             THING_TYPE_SHELLYRGBW2_WHITE, //
58             THING_TYPE_SHELLYHT, //
59             THING_TYPE_SHELLYTRV, //
60             THING_TYPE_SHELLYSENSE, //
61             THING_TYPE_SHELLYEYE, //
62             THING_TYPE_SHELLYSMOKE, //
63             THING_TYPE_SHELLYGAS, //
64             THING_TYPE_SHELLYFLOOD, //
65             THING_TYPE_SHELLYDOORWIN, //
66             THING_TYPE_SHELLYDOORWIN2, //
67             THING_TYPE_SHELLYBUTTON1, //
68             THING_TYPE_SHELLYBUTTON2, //
69             THING_TYPE_SHELLMOTION, //
70
71             // Shelly Plus
72             THING_TYPE_SHELLYPLUS1, //
73             THING_TYPE_SHELLYPLUS1PM, //
74             THING_TYPE_SHELLYPLUS2PM_RELAY, //
75             THING_TYPE_SHELLYPLUS2PM_ROLLER, //
76             THING_TYPE_SHELLYPLUSI4, //
77             THING_TYPE_SHELLYPLUSI4DC, //
78             THING_TYPE_SHELLYPLUSHT, //
79             THING_TYPE_SHELLYPLUSSMOKE, //
80             THING_TYPE_SHELLYPLUSPLUGS, //
81             THING_TYPE_SHELLYPLUSPLUGUS, //
82             THING_TYPE_SHELLYPLUSDIMMERUS, //
83
84             // Shelly Wall Display
85             THING_TYPE_SHELLYPLUSWALLDISPLAY, //
86
87             // Shelly Plus Mini
88             THING_TYPE_SHELLYMINI1, //
89             THING_TYPE_SHELLYMINIPM, //
90             THING_TYPE_SHELLYMINI1PM, //
91
92             // Shelly Pro
93             THING_TYPE_SHELLYPRO1, //
94             THING_TYPE_SHELLYPRO1PM, //
95             THING_TYPE_SHELLYPRO2_RELAY, //
96             THING_TYPE_SHELLYPRO2PM_RELAY, //
97             THING_TYPE_SHELLYPRO2PM_ROLLER, //
98             THING_TYPE_SHELLYPRO3, //
99             THING_TYPE_SHELLYPRO3EM, //
100             THING_TYPE_SHELLYPROEM50, //
101             THING_TYPE_SHELLYPRO4PM, //
102
103             // Shelly BLU
104             THING_TYPE_SHELLYBLUBUTTON, //
105             THING_TYPE_SHELLYBLUDW, //
106             THING_TYPE_SHELLYBLUMOTION, //
107             THING_TYPE_SHELLYBLUGW, //
108
109             THING_TYPE_SHELLYPROTECTED, //
110             THING_TYPE_SHELLYUNKNOWN);
111
112     // Thing Configuration Properties
113     public static final String CONFIG_DEVICEIP = "deviceIp";
114     public static final String CONFIG_DEVICEADDRESS = "deviceAddress";
115     public static final String CONFIG_HTTP_USERID = "userId";
116     public static final String CONFIG_HTTP_PASSWORD = "password";
117     public static final String CONFIG_UPDATE_INTERVAL = "updateInterval";
118
119     public static final String PROPERTY_SERVICE_NAME = "serviceName";
120     public static final String PROPERTY_DEV_NAME = "deviceName";
121     public static final String PROPERTY_DEV_TYPE = "deviceType";
122     public static final String PROPERTY_DEV_MODE = "deviceMode";
123     public static final String PROPERTY_DEV_GEN = "deviceGeneration";
124     public static final String PROPERTY_DEV_AUTH = "deviceAuth";
125     public static final String PROPERTY_GW_DEVICE = "gatewayDevice";
126     public static final String PROPERTY_HWREV = "deviceHwRev";
127     public static final String PROPERTY_HWBATCH = "deviceHwBatch";
128     public static final String PROPERTY_UPDATE_PERIOD = "devUpdatePeriod";
129     public static final String PROPERTY_NUM_RELAYS = "numberRelays";
130     public static final String PROPERTY_NUM_ROLLERS = "numberRollers";
131     public static final String PROPERTY_NUM_METER = "numberMeters";
132     public static final String PROPERTY_LAST_ACTIVE = "lastActive";
133     public static final String PROPERTY_WIFI_NETW = "wifiNetwork";
134     public static final String PROPERTY_UPDATE_STATUS = "updateStatus";
135     public static final String PROPERTY_UPDATE_AVAILABLE = "updateAvailable";
136     public static final String PROPERTY_UPDATE_CURR_VERS = "updateCurrentVersion";
137     public static final String PROPERTY_UPDATE_NEW_VERS = "updateNewVersion";
138     public static final String PROPERTY_COAP_DESCR = "coapDeviceDescr";
139     public static final String PROPERTY_COAP_VERSION = "coapVersion";
140     public static final String PROPERTY_COIOTAUTO = "coiotAutoEnable";
141
142     // Relay
143     public static final String CHANNEL_GROUP_RELAY_CONTROL = "relay";
144     public static final String CHANNEL_OUTPUT_NAME = "outputName";
145     public static final String CHANNEL_OUTPUT = "output";
146     public static final String CHANNEL_INPUT = "input";
147     public static final String CHANNEL_INPUT1 = "input1";
148     public static final String CHANNEL_INPUT2 = "input2";
149     public static final String CHANNEL_BRIGHTNESS = "brightness";
150
151     public static final String CHANNEL_TIMER_AUTOON = "autoOn";
152     public static final String CHANNEL_TIMER_AUTOOFF = "autoOff";
153     public static final String CHANNEL_TIMER_ACTIVE = "timerActive";
154
155     // Roller
156     public static final String CHANNEL_GROUP_ROL_CONTROL = "roller";
157     public static final String CHANNEL_ROL_CONTROL_CONTROL = "control";
158     public static final String CHANNEL_ROL_CONTROL_POS = "rollerpos";
159     public static final String CHANNEL_ROL_CONTROL_FAV = "rollerFav";
160     public static final String CHANNEL_ROL_CONTROL_TIMER = "timer";
161     public static final String CHANNEL_ROL_CONTROL_STATE = "state";
162     public static final String CHANNEL_ROL_CONTROL_STOPR = "stopReason";
163     public static final String CHANNEL_ROL_CONTROL_SAFETY = "safety";
164
165     // Dimmer
166     public static final String CHANNEL_GROUP_DIMMER_CONTROL = CHANNEL_GROUP_RELAY_CONTROL;
167
168     // Power meter
169     public static final String CHANNEL_GROUP_METER = "meter";
170     public static final String CHANNEL_METER_CURRENTWATTS = "currentWatts";
171     public static final String CHANNEL_METER_LASTMIN = "lastPower";
172     public static final String CHANNEL_METER_LASTMIN1 = CHANNEL_METER_LASTMIN + "1";
173     public static final String CHANNEL_METER_TOTALKWH = "totalKWH";
174     public static final String CHANNEL_EMETER_TOTALRET = "returnedKWH";
175     public static final String CHANNEL_EMETER_REACTWATTS = "reactiveWatts";
176     public static final String CHANNEL_EMETER_VOLTAGE = "voltage";
177     public static final String CHANNEL_EMETER_CURRENT = "current";
178     public static final String CHANNEL_EMETER_PFACTOR = "powerFactor";
179     public static final String CHANNEL_EMETER_RESETTOTAL = "resetTotals";
180
181     public static final String CHANNEL_GROUP_SENSOR = "sensors";
182     public static final String CHANNEL_SENSOR_TEMP = "temperature";
183     public static final String CHANNEL_SENSOR_HUM = "humidity";
184     public static final String CHANNEL_SENSOR_LUX = "lux";
185     public static final String CHANNEL_SENSOR_PPM = "ppm";
186     public static final String CHANNEL_SENSOR_VOLTAGE = "voltage";
187     public static final String CHANNEL_SENSOR_ILLUM = "illumination";
188     public static final String CHANNEL_SENSOR_VIBRATION = "vibration";
189     public static final String CHANNEL_SENSOR_TILT = "tilt";
190     public static final String CHANNEL_SENSOR_FLOOD = "flood";
191     public static final String CHANNEL_SENSOR_SMOKE = "smoke";
192     public static final String CHANNEL_SENSOR_MUTE = "mute";
193     public static final String CHANNEL_SENSOR_STATE = "state";
194     public static final String CHANNEL_SENSOR_VALVE = "valve";
195     public static final String CHANNEL_SENSOR_SSTATE = "status"; // Shelly Gas
196     public static final String CHANNEL_SENSOR_MOTION_ACT = "motionActive";
197     public static final String CHANNEL_SENSOR_MOTION = "motion";
198     public static final String CHANNEL_SENSOR_MOTION_TS = "motionTimestamp";
199     public static final String CHANNEL_SENSOR_SLEEPTIME = "sensorSleepTime";
200     public static final String CHANNEL_SENSOR_ALARM_STATE = "alarmState";
201     public static final String CHANNEL_SENSOR_ERROR = "lastError";
202
203     // TRV
204     public static final String CHANNEL_CONTROL_SETTEMP = "targetTemp";
205     public static final String CHANNEL_CONTROL_POSITION = "position";
206     public static final String CHANNEL_CONTROL_MODE = "mode";
207     public static final String CHANNEL_CONTROL_BCONTROL = "boost";
208     public static final String CHANNEL_CONTROL_BTIMER = "boostTimer";
209     public static final String CHANNEL_CONTROL_SCHEDULE = "schedule";
210     public static final String CHANNEL_CONTROL_PROFILE = "selectedProfile";
211
212     // External sensors for Shelly1/1PM
213     public static final String CHANNEL_ESENSOR_TEMP1 = CHANNEL_SENSOR_TEMP + "1";
214     public static final String CHANNEL_ESENSOR_TEMP2 = CHANNEL_SENSOR_TEMP + "2";
215     public static final String CHANNEL_ESENSOR_TEMP3 = CHANNEL_SENSOR_TEMP + "3";
216     public static final String CHANNEL_ESENSOR_TEMP4 = CHANNEL_SENSOR_TEMP + "4";
217     public static final String CHANNEL_ESENSOR_TEMP5 = CHANNEL_SENSOR_TEMP + "5";
218     public static final String CHANNEL_ESENSOR_HUMIDITY = CHANNEL_SENSOR_HUM;
219     public static final String CHANNEL_ESENSOR_VOLTAGE = CHANNEL_SENSOR_VOLTAGE;
220     public static final String CHANNEL_ESENSOR_DIGITALINPUT = "digitalInput";
221     public static final String CHANNEL_ESENSOR_ANALOGINPUT = "analogInput";
222     public static final String CHANNEL_ESENSOR_INPUT = "input";
223     public static final String CHANNEL_ESENSOR_INPUT1 = CHANNEL_ESENSOR_INPUT + "1";
224
225     public static final String CHANNEL_GROUP_CONTROL = "control";
226     public static final String CHANNEL_SENSE_KEY = "key";
227
228     public static final String CHANNEL_GROUP_BATTERY = "battery";
229     public static final String CHANNEL_SENSOR_BAT_LEVEL = "batteryLevel";
230     public static final String CHANNEL_SENSOR_BAT_LOW = "lowBattery";
231
232     public static final String CHANNEL_GROUP_LIGHT_CONTROL = "control";
233     public static final String CHANNEL_LIGHT_COLOR_MODE = "mode";
234     public static final String CHANNEL_LIGHT_POWER = "power";
235     public static final String CHANNEL_LIGHT_DEFSTATE = "defaultState";
236     public static final String CHANNEL_GROUP_LIGHT_CHANNEL = "channel";
237
238     // Bulb/RGBW2 in color mode
239     public static final String CHANNEL_GROUP_COLOR_CONTROL = "color";
240     public static final String CHANNEL_COLOR_PICKER = "hsb";
241     public static final String CHANNEL_COLOR_FULL = "full";
242     public static final String CHANNEL_COLOR_RED = "red";
243     public static final String CHANNEL_COLOR_GREEN = "green";
244     public static final String CHANNEL_COLOR_BLUE = "blue";
245     public static final String CHANNEL_COLOR_WHITE = "white";
246     public static final String CHANNEL_COLOR_GAIN = "gain";
247     public static final String CHANNEL_COLOR_EFFECT = "effect";
248
249     // Bulb/RGBW2/Dup in White Mode
250     public static final String CHANNEL_GROUP_WHITE_CONTROL = "white";
251     public static final String CHANNEL_COLOR_TEMP = "temperature";
252
253     // Device Status
254     public static final String CHANNEL_GROUP_DEV_STATUS = "device";
255     public static final String CHANNEL_DEVST_NAME = "deviceName";
256     public static final String CHANNEL_DEVST_GATEWAY = "gatewayDevice";
257     public static final String CHANNEL_DEVST_UPTIME = "uptime";
258     public static final String CHANNEL_DEVST_HEARTBEAT = "heartBeat";
259     public static final String CHANNEL_DEVST_RSSI = "wifiSignal";
260     public static final String CHANNEL_DEVST_ITEMP = "internalTemp";
261     public static final String CHANNEL_DEVST_WAKEUP = "wakeupReason";
262     public static final String CHANNEL_DEVST_ALARM = "alarm";
263     public static final String CHANNEL_DEVST_ACCUWATTS = "accumulatedWatts";
264     public static final String CHANNEL_DEVST_ACCUTOTAL = "accumulatedWTotal";
265     public static final String CHANNEL_DEVST_ACCURETURNED = "accumulatedReturned";
266     public static final String CHANNEL_DEVST_RESETTOTAL = CHANNEL_EMETER_RESETTOTAL;
267
268     public static final String CHANNEL_DEVST_CHARGER = "charger";
269     public static final String CHANNEL_DEVST_UPDATE = "updateAvailable";
270     public static final String CHANNEL_DEVST_SELFTTEST = "selfTest";
271     public static final String CHANNEL_DEVST_VOLTAGE = "supplyVoltage";
272     public static final String CHANNEL_DEVST_CALIBRATED = "calibrated";
273
274     public static final String CHANNEL_LED_STATUS_DISABLE = "statusLed";
275     public static final String CHANNEL_LED_POWER_DISABLE = "powerLed";
276     // Button/xi3
277     public static final String CHANNEL_GROUP_STATUS = "status";
278     public static final String CHANNEL_STATUS_EVENTTYPE = "lastEvent";
279     public static final String CHANNEL_STATUS_EVENTTYPE1 = CHANNEL_STATUS_EVENTTYPE + "1";
280     public static final String CHANNEL_STATUS_EVENTTYPE2 = CHANNEL_STATUS_EVENTTYPE + "2";
281     public static final String CHANNEL_STATUS_EVENTCOUNT = "eventCount";
282     public static final String CHANNEL_STATUS_EVENTCOUNT1 = CHANNEL_STATUS_EVENTCOUNT + "1";
283     public static final String CHANNEL_STATUS_EVENTCOUNT2 = CHANNEL_STATUS_EVENTCOUNT + "2";
284
285     // General
286     public static final String CHANNEL_LAST_UPDATE = "lastUpdate";
287     public static final String CHANNEL_EVENT_TRIGGER = "event";
288     public static final String CHANNEL_BUTTON_TRIGGER = "button";
289     public static final String CHANNEL_BUTTON_TRIGGER1 = CHANNEL_BUTTON_TRIGGER + "1";
290     public static final String CHANNEL_BUTTON_TRIGGER2 = CHANNEL_BUTTON_TRIGGER + "2";
291
292     public static final String SERVICE_TYPE = "_http._tcp.local.";
293     public static final String SHELLY_API_MIN_FWVERSION = "v1.8.2";
294     public static final String SHELLY_API_MIN_FWCOIOT = "v1.6";// v1.6.0+
295     public static final String SHELLY_API_FWCOIOT2 = "v1.8";// CoAP 2 with FW 1.8+
296     public static final String SHELLY_API_FW_110 = "v1.10"; // FW 1.10 or newer detected, activates some add feature
297     public static final String SHELLY2_API_MIN_FWVERSION = "v0.10.1"; // Gen 2 minimum FW
298
299     // Alarm types/messages
300     public static final String ALARM_TYPE_NONE = "NONE";
301     public static final String ALARM_TYPE_RESTARTED = "RESTARTED";
302     public static final String ALARM_TYPE_OVERTEMP = "OVERTEMP";
303     public static final String ALARM_TYPE_OVERPOWER = "OVERPOWER";
304     public static final String ALARM_TYPE_OVERLOAD = "OVERLOAD";
305     public static final String ALARM_TYPE_LOADERR = "LOAD_ERROR";
306     public static final String ALARM_TYPE_SENSOR_ERROR = "SENSOR_ERROR";
307     public static final String ALARM_TYPE_LOW_BATTERY = "LOW_BATTERY";
308     public static final String ALARM_TYPE_VALVE_ERROR = "VALVE_ERROR";
309     public static final String EVENT_TYPE_VIBRATION = "VIBRATION";
310
311     // Event types
312     public static final String EVENT_TYPE_RELAY = "relay";
313     public static final String EVENT_TYPE_ROLLER = "roller";
314     public static final String EVENT_TYPE_LIGHT = "light";
315     public static final String EVENT_TYPE_SENSORDATA = "report";
316
317     // URI for the EventServlet
318     public static final String SHELLY1_CALLBACK_URI = "/shelly/event";
319     public static final String SHELLY2_CALLBACK_URI = "/shelly/wsevent";
320
321     public static final int DIM_STEPSIZE = 5;
322
323     // Formatting: Number of scaling digits
324     public static final int DIGITS_NONE = 0;
325     public static final int DIGITS_WATT = 2;
326     public static final int DIGITS_KWH = 3;
327     public static final int DIGITS_VOLT = 1;
328     public static final int DIGITS_AMPERE = 3;
329     public static final int DIGITS_TEMP = 1;
330     public static final int DIGITS_LUX = 0;
331     public static final int DIGITS_PERCENT = 1;
332
333     public static final int SHELLY_API_TIMEOUT_MS = 10000;
334     public static final int UPDATE_STATUS_INTERVAL_SECONDS = 3; // check for updates every x sec
335     public static final int UPDATE_SKIP_COUNT = 20; // update every x triggers or when a key was pressed
336     public static final int UPDATE_MIN_DELAY = 15;// update every x triggers or when a key was pressed
337     public static final int UPDATE_SETTINGS_INTERVAL_SECONDS = 60; // check for updates every x sec
338     public static final int HEALTH_CHECK_INTERVAL_SEC = 300; // Health check interval, 5min
339     public static final int VIBRATION_FILTER_SEC = 5; // Absorb duplicate vibration events for xx sec
340
341     public static final String BUNDLE_RESOURCE_SNIPLETS = "sniplets"; // where to find code sniplets in the bundle
342     public static final String BUNDLE_RESOURCE_SCRIPTS = "scripts"; // where to find scrips in the bundle
343 }