[tapocontrol] Fix authentication issue making plugin unusable (#13468)

The tapocontrol plugin uses a static UUID which is now causing a an API rate limit exceeded error from the TP-Link API.  This commit generates a separate UUID for every login attempt.

Signed-off-by: Peter Hicks <peter.hicks@opentraintimes.com>
This commit is contained in:
Peter Hicks 2022-09-30 20:41:53 +01:00 committed by GitHub
parent 08375cd3a8
commit 2a02f2c7ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -15,6 +15,7 @@ package org.openhab.binding.tapocontrol.internal.api;
import static org.openhab.binding.tapocontrol.internal.constants.TapoBindingSettings.*;
import static org.openhab.binding.tapocontrol.internal.constants.TapoErrorConstants.*;
import java.util.UUID;
import java.util.concurrent.TimeoutException;
import org.eclipse.jdt.annotation.NonNullByDefault;
@ -83,7 +84,7 @@ public class TapoCloudConnector {
* @return true if login was successfull
*/
public Boolean login(String username, String password) {
this.token = getToken(username, password, TAPO_TERMINAL_UUID);
this.token = getToken(username, password, UUID.randomUUID().toString());
this.url = TAPO_CLOUD_URL + "?token=" + token;
return !this.token.isBlank();
}

View File

@ -32,7 +32,6 @@ public class TapoBindingSettings {
public static final String CONTENT_TYPE_JSON = "application/json";
public static final String TAPO_CLOUD_URL = "https://eu-wap.tplinkcloud.com";
public static final String TAPO_APP_TYPE = "Tapo_Ios";
public static final String TAPO_TERMINAL_UUID = "0A950402-7224-46EB-A450-7362CDB902A2";
public static final String TAPO_DEVICE_URL = "http://%s/app";
public static final Integer HTTP_MAX_CONNECTIONS = 10; // setMaxConnectionsPerDestination for HTTP-Client
public static final Integer HTTP_MAX_QUEUED_REQUESTS = 10; // setMaxRequestsQueuedPerDestination for HTTP-Client