diff --git a/bundles/org.openhab.binding.tesla/README.md b/bundles/org.openhab.binding.tesla/README.md index aebe74103..8145e9696 100644 --- a/bundles/org.openhab.binding.tesla/README.md +++ b/bundles/org.openhab.binding.tesla/README.md @@ -27,7 +27,10 @@ Furthermore, once an account is configured, it is automatically queried for asso The `account` bridge requires an OAuth2 refresh token as the only parameter `refreshToken`. -There are two different ways of obtaining the token: +There are three different ways of obtaining the token. + +NOTE: Tesla has introduced some captcha mechanism, which might prevent options 1 and 2 from working as expected. +In case you are only receiving error messages, please make use of option 3! 1. Use the openHAB console @@ -50,6 +53,18 @@ If you do not want to use the openHAB console, you can also manually create a "T openHAB will use the provided credentials to retrieve and set the refresh token and automatically delete your password from the configuration afterwards for safety reasons. +3. Use external tools + +There are a few 3rd party tools available that have specialized on getting hold of refresh tokens for the Tesla API. +Please note that we in general consider it dangerous to enter your credentials into some 3rd party app - you will have to trust the author not to send or store those credentials anywhere. + +- [Tesla Access Token Generator (Chromium Extension](https://github.com/DoctorMcKay/chromium-tesla-token-generator) +- [Auth App for Tesla (iOS)](https://apps.apple.com/us/app/auth-app-for-tesla/id1552058613) +- [Tesla Tokens (Android)](https://play.google.com/store/apps/details?id=net.leveugle.teslatokens) + +When using one of such apps, simply copy and paste the received refresh token into the account configuration. + + ## Thing Configuration The vehicle Thing requires the vehicle's VIN as a configuration parameter `vin`. diff --git a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaAccountHandler.java b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaAccountHandler.java index d41e4cbcb..6dc54226d 100644 --- a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaAccountHandler.java +++ b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaAccountHandler.java @@ -207,7 +207,8 @@ public class TeslaAccountHandler extends BaseBridgeHandler { Response response = vehiclesTarget.request(MediaType.APPLICATION_JSON_TYPE) .header("Authorization", authHeader).get(); - logger.debug("Querying the vehicle: Response: {}:{}", response.getStatus(), response.getStatusInfo()); + logger.debug("Querying the vehicle: Response: {}: {}", response.getStatus(), + response.getStatusInfo().getReasonPhrase()); if (!checkResponse(response, true)) { logger.error("An error occurred while querying the vehicle"); @@ -335,9 +336,9 @@ public class TeslaAccountHandler extends BaseBridgeHandler { } if (!checkResponse(response, false)) { - logger.debug("An error occurred while communicating with the vehicle during request {}: {}:{}", command, - (response != null) ? response.getStatus() : "", - (response != null) ? response.getStatusInfo() : "No Response"); + logger.debug("An error occurred while communicating with the vehicle during request {}: {}: {}", + command, (response != null) ? response.getStatus() : "", + (response != null) ? response.getStatusInfo().getReasonPhrase() : "No Response"); return null; } diff --git a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaSSOHandler.java b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaSSOHandler.java index 749733ec9..ff292d709 100644 --- a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaSSOHandler.java +++ b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaSSOHandler.java @@ -166,6 +166,7 @@ public class TeslaSSOHandler { try { Document doc = Jsoup.parse(loginPageResponse.getContentAsString()); + logger.trace("{}", doc.toString()); Element loginForm = doc.getElementsByTag("form").first(); Iterator elIt = loginForm.getElementsByTag("input").iterator();