]> git.basschouten.com Git - openhab-addons.git/blob
8208b3a5f11912fcc1181ae0f6d0dd385fa66408
[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.ecovacs.internal.api;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.ecovacs.internal.api.util.MD5Util;
17
18 /**
19  * @author Johannes Ptaszyk - Initial contribution
20  */
21 @NonNullByDefault
22 public final class EcovacsApiConfiguration {
23     private final String deviceId;
24     private final String username;
25     private final String password;
26     private final String continent;
27     private final String country;
28     private final String language;
29     private final String clientKey;
30     private final String clientSecret;
31     private final String authClientKey;
32     private final String authClientSecret;
33
34     public EcovacsApiConfiguration(String deviceId, String username, String password, String continent, String country,
35             String language, String clientKey, String clientSecret, String authClientKey, String authClientSecret) {
36         this.deviceId = MD5Util.getMD5Hash(deviceId);
37         this.username = username;
38         this.password = password;
39         this.continent = continent;
40         this.country = country;
41         this.language = language;
42         this.clientKey = clientKey;
43         this.clientSecret = clientSecret;
44         this.authClientKey = authClientKey;
45         this.authClientSecret = authClientSecret;
46     }
47
48     public String getDeviceId() {
49         return deviceId;
50     }
51
52     public String getUsername() {
53         return username;
54     }
55
56     public String getPassword() {
57         return password;
58     }
59
60     public String getContinent() {
61         return continent;
62     }
63
64     public String getCountry() {
65         if ("gb".equalsIgnoreCase(country)) {
66             // United Kingdom's ISO 3166 abbreviation is 'gb', but Ecovacs wants the TLD instead, which is 'uk' for
67             // historical reasons
68             return "uk";
69         }
70         return country.toLowerCase();
71     }
72
73     public String getLanguage() {
74         return language;
75     }
76
77     public String getResource() {
78         return deviceId.substring(0, 8);
79     }
80
81     public String getAuthOpenId() {
82         return "global";
83     }
84
85     public String getTimeZone() {
86         return "GMT-8";
87     }
88
89     public String getRealm() {
90         return "ecouser.net";
91     }
92
93     public String getPortalAUthRequestWith() {
94         return "users";
95     }
96
97     public String getOrg() {
98         return "ECOWW";
99     }
100
101     public String getEdition() {
102         return "ECOGLOBLE";
103     }
104
105     public String getBizType() {
106         return "ECOVACS_IOT";
107     }
108
109     public String getChannel() {
110         return "google_play";
111     }
112
113     public String getAppCode() {
114         return "global_e";
115     }
116
117     public String getAppVersion() {
118         return "1.6.3";
119     }
120
121     public String getDeviceType() {
122         return "1";
123     }
124
125     public String getClientKey() {
126         return clientKey;
127     }
128
129     public String getClientSecret() {
130         return clientSecret;
131     }
132
133     public String getAuthClientKey() {
134         return authClientKey;
135     }
136
137     public String getAuthClientSecret() {
138         return authClientSecret;
139     }
140 }