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

Tesla implemented API rate limiting, now adapter gets blocked with HTTP/429 "Retry in 51661 seconds" #177

Open
jensb opened this issue Jun 15, 2024 · 1 comment

Comments

@jensb
Copy link

jensb commented Jun 15, 2024

Describe the bug
See $SUBJECT. See also just every other Tesla API integration, e.g. TeslaMate: teslamate-org/teslamate#3957

To Reproduce
Steps to reproduce the behavior:

  1. Start the adapter
  2. Look at logs, and wait

Expected behavior
Adapter should be able to poll the API the whole day. Instead, requests are rate limited according to https://developer.tesla.com/docs/fleet-api#membership-levels:

Screenshots & Logfiles

tesla-motors.0	2024-06-15 11:41:41.854	error	"Retry in 51499 seconds\n"
tesla-motors.0	2024-06-15 11:41:41.854	error	AxiosError: Request failed with status code 429
tesla-motors.0	2024-06-15 11:41:41.853	error	https://owner-api.teslamotors.com/api/1/vehicles/CENSORED/vehicle_data
tesla-motors.0	2024-06-15 11:41:41.853	error	General error
tesla-motors.0	2024-06-15 11:41:11.828	error	"Retry in 51529 seconds\n"
tesla-motors.0	2024-06-15 11:41:11.827	error	AxiosError: Request failed with status code 429
tesla-motors.0	2024-06-15 11:41:11.827	error	https://owner-api.teslamotors.com/api/1/vehicles/CENSORED/vehicle_data
tesla-motors.0	2024-06-15 11:41:11.827	error	General error

Versions:

  • Adapter version: 1.3.2
  • JS-Controller version: 5.0.19
  • Node version: v18.19.0
  • Operating system: Raspberry OS 64bit 11.9

Additional context
This may require a significant rewrite to be more conservative with requesting vehicle data. However, I am using tesla-motors information to control solar overflow charging of my vehicle, and this requires the charge state, current, battery etc. to be available in at least 30s to 1min intervals during charging. I also run TeslaMate to collect the rest of my vehicle stats.

Addressing this should be a collaborative effort and I'd be willing to help!

@jheredianet
Copy link

I began to experiment it since yestedar after a long drive. This morning it was working until I started to charge up the car at home, after 3 hours, now Teslamate shows teh error 429.

2024-06-15 13:55:23.957 [info] Starting logger for 'xxxxxx'
2024-06-15 13:55:23.992 [info] MQTT connection has been established
2024-06-15 13:55:24.119 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/1492931814800821/vehicle_data -> 429 (57.265 ms)
2024-06-15 13:55:24.119 [warning] TeslaApi.Error / "Retry in 43476 seconds\n"
2024-06-15 13:55:24.119 car_id=1 [error] Error / :unknown
2024-06-15 13:55:54.249 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/1492931814800821/vehicle_data -> 429 (51.010 ms)
2024-06-15 13:55:54.250 [warning] TeslaApi.Error / "Retry in 43446 seconds\n"
2024-06-15 13:55:54.250 car_id=1 [error] Error / :unknown
2024-06-15 13:56:24.373 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/1492931814800821/vehicle_data -> 429 (48.689 ms)
2024-06-15 13:56:24.374 [warning] TeslaApi.Error / "Retry in 43416 seconds\n"
2024-06-15 13:56:24.374 car_id=1 [error] Error / :unknown
2024-06-15 13:56:54.501 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/1492931814800821/vehicle_data -> 429 (49.341 ms)
2024-06-15 13:56:54.501 [warning] TeslaApi.Error / "Retry in 43386 seconds\n"
2024-06-15 13:56:54.502 car_id=1 [error] Error / :unknown
2024-06-15 13:57:22.684 [notice]     :alarm_handler: {:set, {TeslaMate.Vehicles.Vehicle_1_api_error, :fuse_blown}}
2024-06-15 13:57:24.628 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/1492931814800821/vehicle_data -> 429 (47.889 ms)
2024-06-15 13:57:24.629 [warning] TeslaApi.Error / "Retry in 43356 seconds\n"
2024-06-15 13:57:24.629 car_id=1 [error] Error / :unknown
2024-06-15 13:57:54.756 [info] GET https://owner-api.teslamotors.com/api/1/vehicles/1492931814800821/vehicle_data -> 429 (49.707 ms)

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