]> git.basschouten.com Git - openhab-addons.git/blob
15d1b8a63b3a62fed9eb059fe5c83b8918c0793b
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.bticinosmarther.internal;
14
15 import java.util.Collections;
16 import java.util.Set;
17 import java.util.stream.Collectors;
18 import java.util.stream.Stream;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.openhab.core.thing.ThingTypeUID;
22
23 /**
24  * The {@code SmartherBindingConstants} class defines the common constants used across the whole binding.
25  *
26  * @author Fabio Possieri - Initial contribution
27  */
28 @NonNullByDefault
29 public class SmartherBindingConstants {
30
31     private static final String BINDING_ID = "bticinosmarther";
32
33     // Date and time formats used by the binding
34     public static final String DTF_DATE = "dd/MM/yyyy";
35     public static final String DTF_DATETIME = "yyyy-MM-dd'T'HH:mm:ss";
36     public static final String DTF_DATETIME_EXT = "yyyy-MM-dd'T'HH:mm:ssXXX";
37     public static final String DTF_TODAY = "'Today at' HH:mm";
38     public static final String DTF_TOMORROW = "'Tomorrow at' HH:mm";
39     public static final String DTF_DAY_HHMM = "dd/MM/yyyy 'at' HH:mm";
40
41     // Generic constants
42     public static final String HTTPS_SCHEMA = "https";
43     public static final String NAME_SEPARATOR = ", ";
44     public static final String UNAVAILABLE = "N/A";
45     public static final String DEFAULT_PROGRAM = "Default";
46
47     // List of BTicino/Legrand API gateway related urls, information
48     public static final String SMARTHER_ACCOUNT_URL = "https://partners-login.eliotbylegrand.com";
49     public static final String SMARTHER_AUTHORIZE_URL = SMARTHER_ACCOUNT_URL + "/authorize";
50     public static final String SMARTHER_API_TOKEN_URL = SMARTHER_ACCOUNT_URL + "/token";
51     public static final String SMARTHER_API_SCOPES = Stream.of("comfort.read", "comfort.write")
52             .collect(Collectors.joining(" "));
53     public static final String SMARTHER_API_URL = "https://api.developer.legrand.com/smarther/v2.0";
54
55     // Servlets and resources aliases
56     public static final String AUTH_SERVLET_ALIAS = "/" + BINDING_ID + "/connectsmarther";
57     public static final String NOTIFY_SERVLET_ALIAS = "/" + BINDING_ID + "/notifysmarther";
58     public static final String IMG_SERVLET_ALIAS = "/img";
59
60     // List of all Thing Type UIDs
61     public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge");
62     public static final ThingTypeUID THING_TYPE_MODULE = new ThingTypeUID(BINDING_ID, "module");
63
64     // List of all common properties
65     public static final String PROPERTY_STATUS_REFRESH_PERIOD = "statusRefreshPeriod";
66
67     // List of all bridge properties
68     public static final String PROPERTY_SUBSCRIPTION_KEY = "subscriptionKey";
69     public static final String PROPERTY_CLIENT_ID = "clientId";
70     public static final String PROPERTY_CLIENT_SECRET = "clientSecret";
71     public static final String PROPERTY_NOTIFICATION_URL = "notificationUrl";
72     public static final String PROPERTY_NOTIFICATIONS = "notifications";
73
74     // List of all module properties
75     public static final String PROPERTY_PLANT_ID = "plantId";
76     public static final String PROPERTY_MODULE_ID = "moduleId";
77     public static final String PROPERTY_MODULE_NAME = "moduleName";
78     public static final String PROPERTY_DEVICE_TYPE = "deviceType";
79
80     // List of all bridge Status Channel ids
81     public static final String CHANNEL_STATUS_API_CALLS_HANDLED = "status#apiCallsHandled";
82     public static final String CHANNEL_STATUS_NOTIFS_RECEIVED = "status#notifsReceived";
83     public static final String CHANNEL_STATUS_NOTIFS_REJECTED = "status#notifsRejected";
84     // List of all bridge Config Channel ids
85     public static final String CHANNEL_CONFIG_FETCH_LOCATIONS = "config#fetchLocations";
86
87     // List of all module Measures Channel ids
88     public static final String CHANNEL_MEASURES_TEMPERATURE = "measures#temperature";
89     public static final String CHANNEL_MEASURES_HUMIDITY = "measures#humidity";
90     // List of all module Status Channel ids
91     public static final String CHANNEL_STATUS_STATE = "status#state";
92     public static final String CHANNEL_STATUS_FUNCTION = "status#function";
93     public static final String CHANNEL_STATUS_MODE = "status#mode";
94     public static final String CHANNEL_STATUS_TEMPERATURE = "status#temperature";
95     public static final String CHANNEL_STATUS_PROGRAM = "status#program";
96     public static final String CHANNEL_STATUS_ENDTIME = "status#endTime";
97     public static final String CHANNEL_STATUS_TEMP_FORMAT = "status#temperatureFormat";
98     // List of all module Settings Channel ids
99     public static final String CHANNEL_SETTINGS_MODE = "settings#mode";
100     public static final String CHANNEL_SETTINGS_TEMPERATURE = "settings#temperature";
101     public static final String CHANNEL_SETTINGS_PROGRAM = "settings#program";
102     public static final String CHANNEL_SETTINGS_BOOSTTIME = "settings#boostTime";
103     public static final String CHANNEL_SETTINGS_ENDDATE = "settings#endDate";
104     public static final String CHANNEL_SETTINGS_ENDHOUR = "settings#endHour";
105     public static final String CHANNEL_SETTINGS_ENDMINUTE = "settings#endMinute";
106     public static final String CHANNEL_SETTINGS_POWER = "settings#power";
107     // List of all module Config Channel ids
108     public static final String CHANNEL_CONFIG_FETCH_PROGRAMS = "config#fetchPrograms";
109
110     // List of all adressable things
111     public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections
112             .unmodifiableSet(Stream.of(THING_TYPE_BRIDGE, THING_TYPE_MODULE).collect(Collectors.toSet()));
113 }