[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:
parent
08375cd3a8
commit
2a02f2c7ef
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue