Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I manually refresh my Tesla account credentials? #340

Closed
MostDefiantly opened this issue Jan 3, 2020 · 6 comments
Closed

How do I manually refresh my Tesla account credentials? #340

MostDefiantly opened this issue Jan 3, 2020 · 6 comments

Comments

@MostDefiantly
Copy link

Hey all,

Yesterday there was some blip with my Tesla Account and all my devices were logged out. This leaves TeslaMate in a weird state, where it's unable to contact the car for obvious reasons.

How can I manually refresh my Tesla account login? I don't see a way to do that on the TeslaMate page.

image

@adriankumpf
Copy link
Collaborator

Huh, it should prompt you to login again in that case. Could you attach the log output of the teslamate container?

As a quick fix restarting the application may help. Otherwise delete the entry from the database table tokens.

@MostDefiantly
Copy link
Author

I did try down/up on the containers as part of my troubleshooting - forgot to mention that in my initial post, my bad.

Oddly, my car was prompted for an update which then caused TeslaMate to respond again without needing another login. The situation is surely very strange as I didn't prompt for a logout of all my endpoints.

Here's the last few scrubbed log entries after a reboot. Can I pull more historical logging?

teslamate_1  | 18:07:29.624 [info] Already up
teslamate_1  | 18:07:35.324 [info] Version: 1.14.1
teslamate_1  | 18:07:35.485 [info] Refreshed api tokens
teslamate_1  | 18:07:35.497 [info] Scheduling token refresh in 40d
teslamate_1  | 18:07:35.501 [info] Running TeslaMateWeb.Endpoint with cowboy 2.7.0 at :::4000 (http)
teslamate_1  | 18:07:35.502 [info] Access TeslaMateWeb.Endpoint at http://teslamate.contoso.com
teslamate_1  | 18:07:35.597 [warn] Using fallback vehicles:
teslamate_1  |
teslamate_1  | [
teslamate_1  |   %TeslaApi.Vehicle{
teslamate_1  |     api_version: nil,
teslamate_1  |     backseat_token: nil,
teslamate_1  |     backseat_token_updated_at: nil,
teslamate_1  |     calendar_enabled: nil,
teslamate_1  |     charge_state: nil,
teslamate_1  |     climate_state: nil,
teslamate_1  |     color: nil,
teslamate_1  |     display_name: nil,
teslamate_1  |     drive_state: nil,
teslamate_1  |     gui_settings: nil,
teslamate_1  |     id: <ID#>,
teslamate_1  |     in_service: false,
teslamate_1  |     option_codes: [],
teslamate_1  |     state: "unknown",
teslamate_1  |     tokens: [],
teslamate_1  |     vehicle_config: nil,
teslamate_1  |     vehicle_id: <VID#>,
teslamate_1  |     vehicle_state: nil,
teslamate_1  |     vin: "<VIN#>"
teslamate_1  |   }
teslamate_1  | ]
teslamate_1  | 18:07:35.606 [info] MQTT connection has been established
teslamate_1  | 18:07:35.633 [error] TeslaApi.Error / 404 – %{"error" => "not_found", "error_description" => "", "response" => nil}
teslamate_1  | 18:07:35.633 car_id=1 [error] Error / :vehicle_not_found
teslamate_1  | 18:07:36.481 [info] GET /
teslamate_1  | 18:07:36.500 [info] Sent 200 in 18ms
teslamate_1  | 18:08:05.647 [error] TeslaApi.Error / 404 – %{"error" => "not_found", "error_description" => "", "response" => nil}
teslamate_1  | 18:08:05.648 car_id=1 [error] Error / :vehicle_not_found
teslamate_1  | 18:08:35.751 [error] TeslaApi.Error / 404 – %{"error" => "not_found", "error_description" => "", "response" => nil}
teslamate_1  | 18:08:35.751 car_id=1 [error] Error / :vehicle_not_found
teslamate_1  | 18:09:00.008 [info] GET /
teslamate_1  | 18:09:00.010 [info] Sent 200 in 2ms
teslamate_1  | 18:09:05.781 [error] TeslaApi.Error / 404 – %{"error" => "not_found", "error_description" => "", "response" => nil}
teslamate_1  | 18:09:05.781 car_id=1 [error] Error / :vehicle_not_found
teslamate_1  | 18:09:35.321 [info] [alarm_handler: {:set, {TeslaMate.Vehicles.Vehicle_1_api_error, :fuse_blown}}]
teslamate_1  | 18:09:35.876 [error] TeslaApi.Error / 404 – %{"error" => "not_found", "error_description" => "", "response" => nil}
teslamate_1  | 18:09:35.876 car_id=1 [error] Error / :vehicle_not_found
teslamate_1  | 18:10:06.973 [error] TeslaApi.Error / 404 – %{"error" => "not_found", "error_description" => "", "response" => nil}
teslamate_1  | 18:10:06.973 car_id=1 [error] Error / :vehicle_not_found
teslamate_1  | 18:10:40.204 [error] TeslaApi.Error / 404 – %{"error" => "not_found", "error_description" => "", "response" => nil}
teslamate_1  | 18:10:40.204 car_id=1 [error] Error / :vehicle_not_found
teslamate_1  | 18:11:10.328 [error] TeslaApi.Error / 404 – %{"error" => "not_found", "error_description" => "", "response" => nil}
teslamate_1  | 18:11:10.328 car_id=1 [error] Error / :vehicle_not_found
teslamate_1  | 18:11:40.362 [error] TeslaApi.Error / 404 – %{"error" => "not_found", "error_description" => "", "response" => nil}
teslamate_1  | 18:11:40.362 car_id=1 [error] Error / :vehicle_not_found
teslamate_1  | 18:11:40.362 [warn] Restarting Elixir.TeslaMate.Vehicles supervisor

@MostDefiantly
Copy link
Author

And logs when it detected after I triggered the firmware update:

teslamate_1  | 19:04:15.713 [info] Starting logger for '<CAR NAME>'
teslamate_1  | 19:04:16.008 car_id=1 [info] Start / :online
teslamate_1  | 19:04:16.110 [info] Querying location for elevation takes longer than 100ms ...
teslamate_1  | 19:04:17.004 car_id=1 [info] Charging / SOC: 90% / Home
teslamate_1  | 19:06:35.378 [info] [alarm_handler: {:clear, TeslaMate.Vehicles.Vehicle_1_api_error}]
teslamate_1  | 19:07:49.611 car_id=1 [info] Derived efficiency factor: 131.0 Wh/km (5x confirmed)
teslamate_1  | 19:07:49.611 car_id=1 [info] Charging / Complete / 0.0 kWh – 4 min
teslamate_1  | 19:07:49.611 car_id=1 [info] Start / :online
teslamate_1  | 19:10:36.764 [info] GET /
teslamate_1  | 19:10:36.766 [info] Sent 200 in 1ms
teslamate_1  | 19:13:35.146 [info] GET /
teslamate_1  | 19:13:35.148 [info] Sent 200 in 1ms
teslamate_1  | 19:13:38.590 [info] GET /
teslamate_1  | 19:13:38.591 [info] Sent 200 in 1ms
teslamate_1  | 19:14:26.067 [info] GET /
teslamate_1  | 19:14:26.071 [info] Sent 200 in 4ms
teslamate_1  | 19:16:42.323 car_id=1 [info] Update / Start
teslamate_1  | 19:17:09.107 [info] GET /
teslamate_1  | 19:17:09.108 [info] Sent 200 in 1ms
teslamate_1  | 19:31:27.053 [error] TeslaApi.Error / 504 – %{"error" => "upstream_timeout", "error_description" => "", "response" => nil}
teslamate_1  | 19:31:27.053 car_id=1 [warn] Error / upstream timeout
teslamate_1  | 19:31:42.098 [error] TeslaApi.Error / 504 – %{"error" => "upstream_timeout", "error_description" => "", "response" => nil}
teslamate_1  | 19:31:42.098 car_id=1 [warn] Error / upstream timeout
teslamate_1  | 19:31:57.224 [error] TeslaApi.Error / 504 – %{"error" => "upstream_timeout", "error_description" => "", "response" => nil}
teslamate_1  | 19:31:57.224 car_id=1 [warn] Error / upstream timeout
teslamate_1  | 19:32:12.283 [error] TeslaApi.Error / 504 – %{"error" => "upstream_timeout", "error_description" => "", "response" => nil}
teslamate_1  | 19:32:12.283 car_id=1 [warn] Error / upstream timeout
teslamate_1  | 19:32:28.413 [error] TeslaApi.Error / 504 – %{"error" => "upstream_timeout", "error_description" => "", "response" => nil}
teslamate_1  | 19:32:28.413 car_id=1 [warn] Error / upstream timeout
teslamate_1  | 19:32:33.558 [error] TeslaApi.Error / 408 – %{
teslamate_1  |   "error" => "vehicle unavailable: {:error=>\"vehicle unavailable:\"}",
teslamate_1  |   "error_description" => "",
teslamate_1  |   "response" => nil
teslamate_1  | }
teslamate_1  | 19:32:33.615 car_id=1 [warn] Vehicle went offline while updating

@adriankumpf
Copy link
Collaborator

Glancing at your logs it looks like your vehicle temporarily wasn't linked to your Tesla account which caused the health check to fail. The Tesla API sometimes is a bit flaky. Ideally, it should resolve itself.

Did I hear you correctly that everything is working again now?

@MostDefiantly
Copy link
Author

Yeah, the firmware update seemed to trigger a renegotiation of teslamate and my account and it's now collecting data again after being "offline"

Interesting note about the vehicle linking, I suppose that would also trigger the apps to all freak out like they did in my case.

And thanks for the help and clarification on how teslamate should reprompt in a scenario where it needs a refresh. Perhaps having an in gui way to force a refresh of token or creds would have some value.

Thanks again.

@adriankumpf
Copy link
Collaborator

And thanks for the help and clarification on how teslamate should reprompt in a scenario where it needs a refresh. Perhaps having an in gui way to force a refresh of token or creds would have some value.

Yeah, that makes sense. I'll definitely consider it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants