2 * Copyright (c) 2010-2021 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.netatmo.internal;
16 import java.util.stream.Collectors;
17 import java.util.stream.Stream;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.netatmo.internal.webhook.NAWebhookCameraEvent.EventTypeEnum;
21 import org.openhab.core.thing.ThingTypeUID;
24 * The {@link NetatmoBinding} class defines common constants, which are used
25 * across the whole binding.
27 * @author Gaƫl L'hopital - Initial contribution
28 * @author Rob Nielsen - Added day, week, and month measurements to the weather station and modules
32 public class NetatmoBindingConstants {
34 private static final String BINDING_ID = "netatmo";
36 public static final String VENDOR = "Netatmo";
39 public static final String EQUIPMENT_ID = "id";
40 public static final String PARENT_ID = "parentId";
41 public static final String REFRESH_INTERVAL = "refreshInterval";
42 public static final String SETPOINT_DEFAULT_DURATION = "setpointDefaultDuration";
44 public static final String WEBHOOK_APP = "app_security";
46 // Scale for Weather Station /getmeasure
47 public static final String THIRTY_MINUTES = "30min";
48 public static final String ONE_HOUR = "1hour";
49 public static final String THREE_HOURS = "3hours";
50 public static final String ONE_DAY = "1day";
51 public static final String ONE_WEEK = "1week";
52 public static final String ONE_MONTH = "1month";
54 // Type for Weather Station /getmeasure
55 public static final String DATE_MIN_CO2 = "date_min_co2";
56 public static final String DATE_MAX_CO2 = "date_max_co2";
57 public static final String DATE_MIN_HUM = "date_min_hum";
58 public static final String DATE_MAX_HUM = "date_max_hum";
59 public static final String DATE_MIN_NOISE = "date_min_noise";
60 public static final String DATE_MAX_NOISE = "date_max_noise";
61 public static final String DATE_MIN_PRESSURE = "date_min_pressure";
62 public static final String DATE_MAX_PRESSURE = "date_max_pressure";
63 public static final String DATE_MIN_TEMP = "date_min_temp";
64 public static final String DATE_MAX_TEMP = "date_max_temp";
65 public static final String MIN_CO2 = "min_co2";
66 public static final String MAX_CO2 = "max_co2";
67 public static final String MIN_HUM = "min_hum";
68 public static final String MAX_HUM = "max_hum";
69 public static final String MIN_NOISE = "min_noise";
70 public static final String MAX_NOISE = "max_noise";
71 public static final String MIN_PRESSURE = "min_pressure";
72 public static final String MAX_PRESSURE = "max_pressure";
73 public static final String MIN_TEMP = "min_temp";
74 public static final String MAX_TEMP = "max_temp";
75 public static final String SUM_RAIN = "sum_rain";
77 // List of Bridge Type UIDs
78 public static final ThingTypeUID APIBRIDGE_THING_TYPE = new ThingTypeUID(BINDING_ID, "netatmoapi");
80 // List of Weather Station Things Type UIDs
81 public static final ThingTypeUID MAIN_THING_TYPE = new ThingTypeUID(BINDING_ID, "NAMain");
82 public static final ThingTypeUID MODULE1_THING_TYPE = new ThingTypeUID(BINDING_ID, "NAModule1");
83 public static final ThingTypeUID MODULE2_THING_TYPE = new ThingTypeUID(BINDING_ID, "NAModule2");
84 public static final ThingTypeUID MODULE3_THING_TYPE = new ThingTypeUID(BINDING_ID, "NAModule3");
85 public static final ThingTypeUID MODULE4_THING_TYPE = new ThingTypeUID(BINDING_ID, "NAModule4");
87 // Netatmo Health Coach
88 public static final ThingTypeUID HOMECOACH_THING_TYPE = new ThingTypeUID(BINDING_ID, "NHC");
90 // List of Thermostat Things Type UIDs
91 public static final ThingTypeUID PLUG_THING_TYPE = new ThingTypeUID(BINDING_ID, "NAPlug");
92 public static final ThingTypeUID THERM1_THING_TYPE = new ThingTypeUID(BINDING_ID, "NATherm1");
94 // List of Welcome Home Things Type UIDs
95 public static final ThingTypeUID WELCOME_HOME_THING_TYPE = new ThingTypeUID(BINDING_ID, "NAWelcomeHome");
96 public static final ThingTypeUID WELCOME_CAMERA_THING_TYPE = new ThingTypeUID(BINDING_ID, "NACamera");
97 public static final ThingTypeUID WELCOME_PERSON_THING_TYPE = new ThingTypeUID(BINDING_ID, "NAWelcomePerson");
99 public static final ThingTypeUID PRESENCE_CAMERA_THING_TYPE = new ThingTypeUID(BINDING_ID, "NOC");
101 // Weather Station Channel ids
102 public static final String CHANNEL_TEMPERATURE = "Temperature";
103 public static final String CHANNEL_TEMP_TREND = "TempTrend";
104 public static final String CHANNEL_HUMIDITY = "Humidity";
105 public static final String CHANNEL_MAX_HUMIDITY = "MaxHumidity";
106 public static final String CHANNEL_MAX_HUMIDITY_THIS_WEEK = "MaxHumidityThisWeek";
107 public static final String CHANNEL_MAX_HUMIDITY_THIS_MONTH = "MaxHumidityThisMonth";
108 public static final String CHANNEL_MIN_HUMIDITY = "MinHumidity";
109 public static final String CHANNEL_MIN_HUMIDITY_THIS_WEEK = "MinHumidityThisWeek";
110 public static final String CHANNEL_MIN_HUMIDITY_THIS_MONTH = "MinHumidityThisMonth";
111 public static final String CHANNEL_HUMIDEX = "Humidex";
112 public static final String CHANNEL_TIMEUTC = "TimeStamp";
113 public static final String CHANNEL_DEWPOINT = "Dewpoint";
114 public static final String CHANNEL_DEWPOINTDEP = "DewpointDepression";
115 public static final String CHANNEL_HEATINDEX = "HeatIndex";
116 public static final String CHANNEL_LAST_STATUS_STORE = "LastStatusStore";
117 public static final String CHANNEL_LAST_MESSAGE = "LastMessage";
118 public static final String CHANNEL_LOCATION = "Location";
119 public static final String CHANNEL_DATE_MAX_CO2 = "DateMaxCo2";
120 public static final String CHANNEL_DATE_MAX_CO2_THIS_WEEK = "DateMaxCo2ThisWeek";
121 public static final String CHANNEL_DATE_MAX_CO2_THIS_MONTH = "DateMaxCo2ThisMonth";
122 public static final String CHANNEL_DATE_MIN_CO2 = "DateMinCo2";
123 public static final String CHANNEL_DATE_MIN_CO2_THIS_WEEK = "DateMinCo2ThisWeek";
124 public static final String CHANNEL_DATE_MIN_CO2_THIS_MONTH = "DateMinCo2ThisMonth";
125 public static final String CHANNEL_DATE_MAX_HUMIDITY = "DateMaxHumidity";
126 public static final String CHANNEL_DATE_MAX_HUMIDITY_THIS_WEEK = "DateMaxHumidityThisWeek";
127 public static final String CHANNEL_DATE_MAX_HUMIDITY_THIS_MONTH = "DateMaxHumidityThisMonth";
128 public static final String CHANNEL_DATE_MIN_HUMIDITY = "DateMinHumidity";
129 public static final String CHANNEL_DATE_MIN_HUMIDITY_THIS_WEEK = "DateMinHumidityThisWeek";
130 public static final String CHANNEL_DATE_MIN_HUMIDITY_THIS_MONTH = "DateMinHumidityThisMonth";
131 public static final String CHANNEL_DATE_MAX_NOISE = "DateMaxNoise";
132 public static final String CHANNEL_DATE_MAX_NOISE_THIS_WEEK = "DateMaxNoiseThisWeek";
133 public static final String CHANNEL_DATE_MAX_NOISE_THIS_MONTH = "DateMaxNoiseThisMonth";
134 public static final String CHANNEL_DATE_MIN_NOISE = "DateMinNoise";
135 public static final String CHANNEL_DATE_MIN_NOISE_THIS_WEEK = "DateMinNoiseThisWeek";
136 public static final String CHANNEL_DATE_MIN_NOISE_THIS_MONTH = "DateMinNoiseThisMonth";
137 public static final String CHANNEL_DATE_MAX_PRESSURE = "DateMaxPressure";
138 public static final String CHANNEL_DATE_MAX_PRESSURE_THIS_WEEK = "DateMaxPressureThisWeek";
139 public static final String CHANNEL_DATE_MAX_PRESSURE_THIS_MONTH = "DateMaxPressureThisMonth";
140 public static final String CHANNEL_DATE_MIN_PRESSURE = "DateMinPressure";
141 public static final String CHANNEL_DATE_MIN_PRESSURE_THIS_WEEK = "DateMinPressureThisWeek";
142 public static final String CHANNEL_DATE_MIN_PRESSURE_THIS_MONTH = "DateMinPressureThisMonth";
143 public static final String CHANNEL_DATE_MAX_TEMP = "DateMaxTemp";
144 public static final String CHANNEL_DATE_MAX_TEMP_THIS_WEEK = "DateMaxTempThisWeek";
145 public static final String CHANNEL_DATE_MAX_TEMP_THIS_MONTH = "DateMaxTempThisMonth";
146 public static final String CHANNEL_DATE_MIN_TEMP = "DateMinTemp";
147 public static final String CHANNEL_DATE_MIN_TEMP_THIS_WEEK = "DateMinTempThisWeek";
148 public static final String CHANNEL_DATE_MIN_TEMP_THIS_MONTH = "DateMinTempThisMonth";
149 public static final String CHANNEL_MAX_TEMP = "MaxTemp";
150 public static final String CHANNEL_MAX_TEMP_THIS_WEEK = "MaxTempThisWeek";
151 public static final String CHANNEL_MAX_TEMP_THIS_MONTH = "MaxTempThisMonth";
152 public static final String CHANNEL_MIN_TEMP = "MinTemp";
153 public static final String CHANNEL_MIN_TEMP_THIS_WEEK = "MinTempThisWeek";
154 public static final String CHANNEL_MIN_TEMP_THIS_MONTH = "MinTempThisMonth";
155 public static final String CHANNEL_ABSOLUTE_PRESSURE = "AbsolutePressure";
156 public static final String CHANNEL_CO2 = "Co2";
157 public static final String CHANNEL_MAX_CO2 = "MaxCo2";
158 public static final String CHANNEL_MAX_CO2_THIS_WEEK = "MaxCo2ThisWeek";
159 public static final String CHANNEL_MAX_CO2_THIS_MONTH = "MaxCo2ThisMonth";
160 public static final String CHANNEL_MIN_CO2 = "MinCo2";
161 public static final String CHANNEL_MIN_CO2_THIS_WEEK = "MinCo2ThisWeek";
162 public static final String CHANNEL_MIN_CO2_THIS_MONTH = "MinCo2ThisMonth";
163 public static final String CHANNEL_NOISE = "Noise";
164 public static final String CHANNEL_MAX_NOISE = "MaxNoise";
165 public static final String CHANNEL_MAX_NOISE_THIS_WEEK = "MaxNoiseThisWeek";
166 public static final String CHANNEL_MAX_NOISE_THIS_MONTH = "MaxNoiseThisMonth";
167 public static final String CHANNEL_MIN_NOISE = "MinNoise";
168 public static final String CHANNEL_MIN_NOISE_THIS_WEEK = "MinNoiseThisWeek";
169 public static final String CHANNEL_MIN_NOISE_THIS_MONTH = "MinNoiseThisMonth";
170 public static final String CHANNEL_PRESSURE = "Pressure";
171 public static final String CHANNEL_MAX_PRESSURE = "MaxPressure";
172 public static final String CHANNEL_MAX_PRESSURE_THIS_WEEK = "MaxPressureThisWeek";
173 public static final String CHANNEL_MAX_PRESSURE_THIS_MONTH = "MaxPressureThisMonth";
174 public static final String CHANNEL_MIN_PRESSURE = "MinPressure";
175 public static final String CHANNEL_MIN_PRESSURE_THIS_WEEK = "MinPressureThisWeek";
176 public static final String CHANNEL_MIN_PRESSURE_THIS_MONTH = "MinPressureThisMonth";
177 public static final String CHANNEL_PRESS_TREND = "PressTrend";
178 public static final String CHANNEL_RAIN = "Rain";
179 public static final String CHANNEL_SUM_RAIN1 = "SumRain1";
180 public static final String CHANNEL_SUM_RAIN24 = "SumRain24";
181 public static final String CHANNEL_SUM_RAIN_THIS_WEEK = "SumRainThisWeek";
182 public static final String CHANNEL_SUM_RAIN_THIS_MONTH = "SumRainThisMonth";
183 public static final String CHANNEL_WIND_ANGLE = "WindAngle";
184 public static final String CHANNEL_WIND_STRENGTH = "WindStrength";
185 public static final String CHANNEL_MAX_WIND_STRENGTH = "MaxWindStrength";
186 public static final String CHANNEL_DATE_MAX_WIND_STRENGTH = "DateMaxWindStrength";
187 public static final String CHANNEL_GUST_ANGLE = "GustAngle";
188 public static final String CHANNEL_GUST_STRENGTH = "GustStrength";
189 public static final String CHANNEL_LOW_BATTERY = "LowBattery";
190 public static final String CHANNEL_BATTERY_LEVEL = "BatteryVP";
191 public static final String CHANNEL_WIFI_STATUS = "WifiStatus";
192 public static final String CHANNEL_RF_STATUS = "RfStatus";
194 // Healthy Home Coach specific channel
195 public static final String CHANNEL_HEALTH_INDEX = "HealthIndex";
197 // Thermostat specific channels
198 public static final String CHANNEL_SETPOINT_MODE = "SetpointMode";
199 public static final String CHANNEL_SETPOINT_END_TIME = "SetpointEndTime";
200 public static final String CHANNEL_SETPOINT_TEMP = "Sp_Temperature";
201 public static final String CHANNEL_THERM_RELAY = "ThermRelayCmd";
202 public static final String CHANNEL_THERM_ORIENTATION = "ThermOrientation";
203 public static final String CHANNEL_CONNECTED_BOILER = "ConnectedBoiler";
204 public static final String CHANNEL_LAST_PLUG_SEEN = "LastPlugSeen";
205 public static final String CHANNEL_LAST_BILAN = "LastBilan";
207 public static final String CHANNEL_PLANNING = "Planning";
209 public static final String CHANNEL_SETPOINT_MODE_MANUAL = "manual";
210 public static final String CHANNEL_SETPOINT_MODE_AWAY = "away";
211 public static final String CHANNEL_SETPOINT_MODE_HG = "hg";
212 public static final String CHANNEL_SETPOINT_MODE_OFF = "off";
213 public static final String CHANNEL_SETPOINT_MODE_MAX = "max";
214 public static final String CHANNEL_SETPOINT_MODE_PROGRAM = "program";
217 public static final String PROPERTY_SIGNAL_LEVELS = "signalLevels";
218 public static final String PROPERTY_BATTERY_LEVELS = "batteryLevels";
219 public static final String PROPERTY_REFRESH_PERIOD = "refreshPeriod";
221 // Welcome Home specific channels
222 public static final String CHANNEL_WELCOME_HOME_CITY = "welcomeHomeCity";
223 public static final String CHANNEL_WELCOME_HOME_COUNTRY = "welcomeHomeCountry";
224 public static final String CHANNEL_WELCOME_HOME_TIMEZONE = "welcomeHomeTimezone";
225 public static final String CHANNEL_WELCOME_HOME_PERSONCOUNT = "welcomeHomePersonCount";
226 public static final String CHANNEL_WELCOME_HOME_UNKNOWNCOUNT = "welcomeHomeUnknownCount";
228 public static final String CHANNEL_WELCOME_HOME_EVENT = "welcomeHomeEvent";
230 public static final String CHANNEL_CAMERA_EVENT = "cameraEvent";
232 public static final String CHANNEL_WELCOME_PERSON_LASTSEEN = "welcomePersonLastSeen";
233 public static final String CHANNEL_WELCOME_PERSON_ATHOME = "welcomePersonAtHome";
234 public static final String CHANNEL_WELCOME_PERSON_AVATAR_URL = "welcomePersonAvatarUrl";
235 public static final String CHANNEL_WELCOME_PERSON_AVATAR = "welcomePersonAvatar";
236 public static final String CHANNEL_WELCOME_PERSON_LASTMESSAGE = "welcomePersonLastEventMessage";
237 public static final String CHANNEL_WELCOME_PERSON_LASTTIME = "welcomePersonLastEventTime";
238 public static final String CHANNEL_WELCOME_PERSON_LASTEVENT = "welcomePersonLastEvent";
239 public static final String CHANNEL_WELCOME_PERSON_LASTEVENT_URL = "welcomePersonLastEventUrl";
241 public static final String CHANNEL_WELCOME_CAMERA_STATUS = "welcomeCameraStatus";
242 public static final String CHANNEL_WELCOME_CAMERA_SDSTATUS = "welcomeCameraSdStatus";
243 public static final String CHANNEL_WELCOME_CAMERA_ALIMSTATUS = "welcomeCameraAlimStatus";
244 public static final String CHANNEL_WELCOME_CAMERA_ISLOCAL = "welcomeCameraIsLocal";
245 public static final String CHANNEL_WELCOME_CAMERA_LIVEPICTURE = "welcomeCameraLivePicture";
246 public static final String CHANNEL_WELCOME_CAMERA_LIVEPICTURE_URL = "welcomeCameraLivePictureUrl";
247 public static final String CHANNEL_WELCOME_CAMERA_LIVESTREAM_URL = "welcomeCameraLiveStreamUrl";
249 public static final String CHANNEL_WELCOME_EVENT_TYPE = "welcomeEventType";
250 public static final String CHANNEL_WELCOME_EVENT_TIME = "welcomeEventTime";
251 public static final String CHANNEL_WELCOME_EVENT_CAMERAID = "welcomeEventCameraId";
252 public static final String CHANNEL_WELCOME_EVENT_PERSONID = "welcomeEventPersonId";
253 public static final String CHANNEL_WELCOME_EVENT_SNAPSHOT = "welcomeEventSnapshot";
254 public static final String CHANNEL_WELCOME_EVENT_SNAPSHOT_URL = "welcomeEventSnapshotURL";
255 public static final String CHANNEL_WELCOME_EVENT_VIDEO_URL = "welcomeEventVideoURL";
256 public static final String CHANNEL_WELCOME_EVENT_VIDEOSTATUS = "welcomeEventVideoStatus";
257 public static final String CHANNEL_WELCOME_EVENT_ISARRIVAL = "welcomeEventIsArrival";
258 public static final String CHANNEL_WELCOME_EVENT_MESSAGE = "welcomeEventMessage";
259 public static final String CHANNEL_WELCOME_EVENT_SUBTYPE = "welcomeEventSubType";
261 // Camera specific channels
262 public static final String CHANNEL_CAMERA_STATUS = "cameraStatus";
263 public static final String CHANNEL_CAMERA_SDSTATUS = "cameraSdStatus";
264 public static final String CHANNEL_CAMERA_ALIMSTATUS = "cameraAlimStatus";
265 public static final String CHANNEL_CAMERA_ISLOCAL = "cameraIsLocal";
266 public static final String CHANNEL_CAMERA_LIVEPICTURE = "cameraLivePicture";
267 public static final String CHANNEL_CAMERA_LIVEPICTURE_URL = "cameraLivePictureUrl";
268 public static final String CHANNEL_CAMERA_LIVESTREAM_URL = "cameraLiveStreamUrl";
270 public static final String WELCOME_PICTURE_URL = "https://api.netatmo.com/api/getcamerapicture";
271 public static final String WELCOME_PICTURE_IMAGEID = "image_id";
272 public static final String WELCOME_PICTURE_KEY = "key";
274 // Presence outdoor camera specific channels
275 public static final String CHANNEL_CAMERA_FLOODLIGHT_AUTO_MODE = "cameraFloodlightAutoMode";
276 public static final String CHANNEL_CAMERA_FLOODLIGHT = "cameraFloodlight";
278 // List of all supported physical devices and modules
279 public static final Set<ThingTypeUID> SUPPORTED_DEVICE_THING_TYPES_UIDS = Stream
280 .of(MAIN_THING_TYPE, MODULE1_THING_TYPE, MODULE2_THING_TYPE, MODULE3_THING_TYPE, MODULE4_THING_TYPE,
281 HOMECOACH_THING_TYPE, PLUG_THING_TYPE, THERM1_THING_TYPE, WELCOME_HOME_THING_TYPE,
282 WELCOME_CAMERA_THING_TYPE, WELCOME_PERSON_THING_TYPE, PRESENCE_CAMERA_THING_TYPE)
283 .collect(Collectors.toSet());
285 // List of all adressable things in OH = SUPPORTED_DEVICE_THING_TYPES_UIDS + the virtual bridge
286 public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Stream
287 .concat(SUPPORTED_DEVICE_THING_TYPES_UIDS.stream(), Stream.of(APIBRIDGE_THING_TYPE))
288 .collect(Collectors.toSet());
290 public static final Set<EventTypeEnum> HOME_EVENTS = Stream.of(EventTypeEnum.PERSON_AWAY)
291 .collect(Collectors.toSet());
292 public static final Set<EventTypeEnum> WELCOME_EVENTS = Stream
293 .of(EventTypeEnum.PERSON, EventTypeEnum.MOVEMENT, EventTypeEnum.CONNECTION, EventTypeEnum.DISCONNECTION,
294 EventTypeEnum.ON, EventTypeEnum.OFF, EventTypeEnum.BOOT, EventTypeEnum.SD, EventTypeEnum.ALIM,
295 EventTypeEnum.NEW_MODULE, EventTypeEnum.MODULE_CONNECT, EventTypeEnum.MODULE_DISCONNECT,
296 EventTypeEnum.MODULE_LOW_BATTERY, EventTypeEnum.MODULE_END_UPDATE, EventTypeEnum.TAG_BIG_MOVE,
297 EventTypeEnum.TAG_SMALL_MOVE, EventTypeEnum.TAG_UNINSTALLED, EventTypeEnum.TAG_OPEN)
298 .collect(Collectors.toSet());
299 public static final Set<EventTypeEnum> PERSON_EVENTS = Stream.of(EventTypeEnum.PERSON, EventTypeEnum.PERSON_AWAY)
300 .collect(Collectors.toSet());
301 public static final Set<EventTypeEnum> PRESENCE_EVENTS = Stream
302 .of(EventTypeEnum.OUTDOOR, EventTypeEnum.ALIM, EventTypeEnum.DAILY_SUMMARY).collect(Collectors.toSet());