Skip to content

Commit

Permalink
[tapocontrol] Fix authentication issue making plugin unusable (openha…
Browse files Browse the repository at this point in the history
…b#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>
  • Loading branch information
poggs authored and nemerdaud committed Feb 28, 2023
1 parent a9001f9 commit cc15a94
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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;
Expand Down Expand Up @@ -83,7 +84,7 @@ protected void handleError(TapoErrorHandler tapoError) {
* @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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cc15a94

Please sign in to comment.