2 * Copyright (c) 2010-2024 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.ecovacs.internal.api;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.ecovacs.internal.api.util.MD5Util;
19 * @author Johannes Ptaszyk - Initial contribution
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;
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;
48 public String getDeviceId() {
52 public String getUsername() {
56 public String getPassword() {
60 public String getContinent() {
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
70 return country.toLowerCase();
73 public String getLanguage() {
77 public String getResource() {
78 return deviceId.substring(0, 8);
81 public String getAuthOpenId() {
85 public String getTimeZone() {
89 public String getRealm() {
93 public String getPortalAUthRequestWith() {
97 public String getOrg() {
101 public String getEdition() {
105 public String getBizType() {
106 return "ECOVACS_IOT";
109 public String getChannel() {
110 return "google_play";
113 public String getAppCode() {
117 public String getAppVersion() {
121 public String getDeviceType() {
125 public String getClientKey() {
129 public String getClientSecret() {
133 public String getAuthClientKey() {
134 return authClientKey;
137 public String getAuthClientSecret() {
138 return authClientSecret;