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 fleet API: Result.Statuscode: 429 (TooManyRequests) cmd: vehicle_data #1304

Open
tommymann1982 opened this issue Jun 7, 2024 · 55 comments
Labels
bug Something isn't working

Comments

@tommymann1982
Copy link

Since this morning 5am teslalogger says my car is offline.
Christian, is it possibel, that the server isnt working?
@bassmaster187

The LogFile is reporting an TooManyRequests error.
Screenshot_20240607-200407

@tommymann1982 tommymann1982 added the bug Something isn't working label Jun 7, 2024
@bassmaster187 bassmaster187 pinned this issue Jun 7, 2024
@bassmaster187 bassmaster187 changed the title Teslalogger offline Result.Statuscode: 429 (TooManyRequests) cmd: vehicle_data Jun 7, 2024
@bassmaster187 bassmaster187 changed the title Result.Statuscode: 429 (TooManyRequests) cmd: vehicle_data Tesla fleet API: Result.Statuscode: 429 (TooManyRequests) cmd: vehicle_data Jun 7, 2024
@bassmaster187
Copy link
Owner

Other apps have the same problem:
teslamotors/vehicle-command#255

@tommymann1982
Copy link
Author

This isnt good

@bassmaster187
Copy link
Owner

Workaround:

It seems like the old owners API is not affected about the Rate Limit. So switching back to owners API might be a temporary solution.

  • Go to settings
  • My Tesla credentials
  • Edit
  • Use any other method than Fleet API. e.g. In local browser

@tommymann1982
Copy link
Author

Now, I have this screen
The Car seems to be online now, but last data are 10 hours old. I am missing 1 charging session and several trips. F.E. Last trip wasnt at 8.38 am, but around 16.30h.

image

@tommymann1982
Copy link
Author

Today there were no issues.
@bassmaster187 you can close the thread. Thanks for your help

@bill340
Copy link

bill340 commented Jun 9, 2024

Not really! Issues are still there!

@IMgoRt
Copy link

IMgoRt commented Jun 10, 2024

Was working Saturday, broke again sometime Sunday PM

@bassmaster187
Copy link
Owner

Not really! Issues are still there!

You don't use Fleet API anymore and still receive 429 errors?

image

@GerdMayer
Copy link

Using Fleet API, I receive 429 errors.

Using Virtual Key I receive this and then Vehicle is Offline !!!

10.06.2024 13:41:06 : #1[Thread Pool Worker:10]: Command counter: 200
10.06.2024 13:42:10 : #1[Thread Pool Worker:10]: Result.Statuscode: 408 (RequestTimeout) cmd: vehicle_data?endpoints=drive_state%3Blocation_data&let_sleep=true
10.06.2024 13:42:11 : #1[Car_1:28]: IsDriving = NULL!

10.06.2024 13:42:21 : #1[Thread Pool Worker:32]: Result.Statuscode: 408 (RequestTimeout) cmd: vehicle_data?endpoints=charge_state&let_sleep=true
10.06.2024 13:42:22 : #1[Car_1:28]: isCharging = NULL
.....
10.06.2024 13:49:56 : #1[Thread Pool Worker:56]: Result.Statuscode: 408 (RequestTimeout) cmd: vehicle_data?endpoints=vehicle_state&let_sleep=true
10.06.2024 13:49:57 : #1[Car_1:28]: change TeslaLogger state: Online -> Start

10.06.2024 13:49:57 : #1[Thread Pool Worker:53]: Result.Statuscode: 408 (RequestTimeout) cmd: vehicle_data?endpoints=drive_state%3Blocation_data&let_sleep=true
10.06.2024 13:49:58 : #1[Car_1:28]: IsDriving = NULL!

10.06.2024 13:50:07 : TeslaLogger process statistics
Thread count: 20
WorkingSet64: 113590272
PeakWorkingSet64: 123826176
PrivateMemorySize64: 157290496
VirtualMemorySize64: 1646551040
StartTime: 6/10/2024 1:32:02 PM
Database sizes: DB teslalogger
table pos has 13mb
table mothership has 6mb
10.06.2024 13:50:08 : #1[Car_1:28]: STOP communication with Tesla Server to enter sleep Mode! https://teslalogger.de/faq-1.php
10.06.2024 13:50:08 : #1[Car_1:28]: Waiting for car to go to sleep 0
10.06.2024 13:50:09 : #1[Car_1:28]: Car is offline now
10.06.2024 13:50:09 : #1[Car_1:28]: Restart communication with Tesla Server! 3
10.06.2024 13:50:09 : #1[Car_1:28]: Restart communication with Tesla Server! 2
10.06.2024 13:50:10 : #1[StreamAPIThread_1:33]: Stream Data Error: Vehicle is offline

10.06.2024 13:50:14 : #1[Car_1:28]: ScanMyTesla FastMode: False
10.06.2024 13:50:14 : #1[Car_1:28]: CloseDriveState EndDate: 2024-06-10 13:34:46
10.06.2024 13:50:14 : Reverse geocoding by GeocodeCache
10.06.2024 13:50:14 : Reverse geocoding by GeocodeCache
10.06.2024 13:50:14 : #1[Car_1:28]: state: offline

@bill340
Copy link

bill340 commented Jun 11, 2024

Not really! Issues are still there!

You don't use Fleet API anymore and still receive 429 errors?

image

It works without Fleet-API, but I cannot send any commands without Fleet-API.

@bill340
Copy link

bill340 commented Jun 11, 2024

Would it be possible to set the refresh rate to 5min when using Fleet-API, so that it does not run into a timeout and still being able to send commands?

@bassmaster187
Copy link
Owner

We use a couple of commands to run Teslalogger. I have a different idea to combine Fleet Telemetry with Commands to be able to have a refresh rate of 30 seconds. But I need to make a couple of changes

@TillMatthis
Copy link

Now, I have this screen The Car seems to be online now, but last data are 10 hours old. I am missing 1 charging session and several trips. F.E. Last trip wasnt at 8.38 am, but around 16.30h.

image

I'm having the same problem sins 1.58.1.0

@bill340
Copy link

bill340 commented Jun 12, 2024

We use a couple of commands to run Teslalogger. I have a different idea to combine Fleet Telemetry with Commands to be able to have a refresh rate of 30 seconds. But I need to make a couple of changes

That. would be great, as I am using teslalogger to send commands from evcc with the teslalogger charger template.
Before that change it worked really great!
evcc-io/evcc#13062

@Adminius
Copy link
Contributor

That. would be great, as I am using teslalogger to send commands from evcc with the teslalogger charger template. Before that change it worked really great! evcc-io/evcc#13062

FleetAPI only allows 5 charing commands per car per day => usless

If you familar with linux and raspi:
evcc-io/evcc#14252 (comment)

@dbmtrde
Copy link
Contributor

dbmtrde commented Jun 12, 2024

Not really! Issues are still there!

You don't use Fleet API anymore and still receive 429 errors?

image

Hi Christian,
the error also occurs without Fleet API (I have never used it)

13.06.2024 00:41:57 : #1[Thread Pool Worker:39857]: Result.Statuscode: 429 (TooManyRequests) cmd: vehicle_data?endpoints=climate_state&let_sleep=true Sleep: 28103ms

13.06.2024 00:41:59 : #2[Thread Pool Worker:39804]: Result.Statuscode: 429 (TooManyRequests) cmd: vehicle_data?endpoints=drive_state%3Blocation_data&let_sleep=true Sleep: 33337ms

13.06.2024 00:42:25 : #1[Car_1:17]: GetOutsideTempAsync: NULL

13.06.2024 00:42:32 : #2[Car_2:19]: IsDriving = NULL!

@chk2902
Copy link

chk2902 commented Jun 13, 2024

BTW, at the moment, Teslalogger notes too many requests and the car is "offline" (unexpected state for the failing API in my opinion). Yet in my app, which queried the data every 5 minutes (up to a few minutes ago, I now reduced it a bit), the fleet API works (same car, same credentials), also Tronity did show up-to-date data. Maybe some scopes of the API are restricted while others aren't?

I use vehicle_data?endpoints=charge_state%3Blocation_data

@IMgoRt
Copy link

IMgoRt commented Jun 13, 2024

BTW, at the moment, Teslalogger notes too many requests and the car is "offline" (unexpected state for the failing API in my opinion). Yet in my app, which queried the data every 5 minutes (up to a few minutes ago, I now reduced it a bit), the fleet API works (same car, same credentials), also Tronity did show up-to-date data. Maybe some scopes of the API are restricted while others aren't?

I use vehicle_data?endpoints=charge_state%3Blocation_data

Just to add - in the UK my electricity supplier (octopus) uses the fleet API multiple times overnight to start and stop charging at times that are most advantageous to it for wholesale energy prices
So it doesn't seem to be hit by rate limits

@Adminius
Copy link
Contributor

So it doesn't seem to be hit by rate limits

maybe because they already paying for more requests/commands? A lot of such companies got contracts with NDA so they can use it already...

Or maybe because Octopus and Tesla are "friends"? ;)

@chk2902
Copy link

chk2902 commented Jun 13, 2024

I don't know about that, or if Tronity pays, but until now I don't pay anything to Tesla for my requests.

Ah, but now, a little math helps: 5 minutes interval are 288 requests. 🤔 Sorry about my misleading comment - if Teslalogger uses more, that's different.

@Adminius
Copy link
Contributor

until now I don't pay anything to Tesla for my requests.

Not you, but logger-team. And if, you will pay to logger-team

@chk2902
Copy link

chk2902 commented Jun 13, 2024

@Adminius No, "my" requests are personal from my own app's code. Teslalogger and Tronity run in parallel using their own requests for the same car.

@STRUBartacus
Copy link

Now the normal API (600) has also been given a limit.

@albi
Copy link

albi commented Jun 14, 2024

seems so. no data even without fleet-api checked.

@Adminius
Copy link
Contributor

It looks like it now good time to test fleet API again :D

@tommymann1982
Copy link
Author

tommymann1982 commented Jun 14, 2024

Today it really stoped working again. The car is offline since 5.45am
TeslaLogger reports weird data (fE Last charging, when the car wasnt charging with time a stamp in the future, wrong SOC status, non existing teslalogger update)

Screenshot_20240614-135935

@kaygee60
Copy link

Totally not working, fleet api or not. Does not update at all, car is shown as offline - although having charged and been driving. No errors in protocol.

@bill340
Copy link

bill340 commented Jun 15, 2024

Same here... Not using sleep api, but also not working. Following error in log:

15.06.2024 18:36:21 : #1[Thread Pool Worker:7]: Result.Statuscode: 429 (TooManyRequests) cmd: vehicle_data?endpoints=vehicle_config&let_sleep=true Sleep: 26620000ms, ratelimit-limit: 600, ratelimit-remaining: 0, ratelimit-reset: 26620, sleep till: 16.06.2024 02:00:01
15.06.2024 18:36:22 : #2[:1]: LastTaskerToken not found - Stop using fast TaskerToken request! Reply: never!

@bill340
Copy link

bill340 commented Jun 15, 2024

15.06.2024 19:12:05 : #2[Thread Pool Worker:21]: Update Tesla Token From Refresh Token!
15.06.2024 19:12:06 : #2[Thread Pool Worker:21]: HttpStatus: OK
15.06.2024 19:12:06 : #2[Thread Pool Worker:21]: UpdateRefreshToken
15.06.2024 19:12:06 : #2[Thread Pool Worker:21]: UpdateRefreshToken OK: 1 - encrypted:r2TIfMgoc/xxxxxxxx
15.06.2024 19:12:06 : #2[Thread Pool Worker:21]: UpdateTeslaToken
15.06.2024 19:12:06 : #2[Thread Pool Worker:21]: update tesla_token OK: 1 - eyJhbGciOiJSUzI1NiIsxxxxxx
15.06.2024 19:12:06 : #2[Thread Pool Worker:8]: Result.Statuscode: 429 (TooManyRequests) cmd: vehicle_data?endpoints=vehicle_config&let_sleep=true Sleep: 24474000ms, ratelimit-limit: 600, ratelimit-remaining: 0, ratelimit-reset: 24474, sleep till: 16.06.2024 02:00:00

@Adminius
Copy link
Contributor

Try this branch. You need FleetAPI+Virtual Key for it

https://github.com/bassmaster187/TeslaLogger/tree/Free-FleetAPI

@tommymann1982
Copy link
Author

@Adminius did you paste wrong link ? That link is for teslalogger instalation proces.

@bill340
Copy link

bill340 commented Jun 15, 2024

It seems to work initially, but the log fills up and the machine gets into an overload:

15.06.2024 21:34:41 : #2[Thread Pool Worker:52]: StartChargingState Task GetCurrentState(): Online
15.06.2024 21:34:41 : #2[Thread Pool Worker:103]: StartChargingState Task start
15.06.2024 21:34:41 : #2[Thread Pool Worker:103]: StartChargingState Task latestPos: 104589
15.06.2024 21:34:41 : #2[Thread Pool Worker:103]: StartChargingState Task GetCurrentState(): Online
15.06.2024 21:34:41 : #2[Thread Pool Worker:62]: StartChargingState Task start
15.06.2024 21:34:41 : #2[Thread Pool Worker:62]: StartChargingState Task latestPos: 104589
15.06.2024 21:34:41 : #2[Thread Pool Worker:62]: StartChargingState Task GetCurrentState(): Online
15.06.2024 21:34:41 : #2[Thread Pool Worker:57]: StartChargingState Task start
15.06.2024 21:34:41 : #2[Thread Pool Worker:57]: StartChargingState Task latestPos: 104589
15.06.2024 21:34:41 : #2[Thread Pool Worker:57]: StartChargingState Task GetCurrentState(): Online
15.06.2024 21:34:42 : #2[Thread Pool Worker:48]: StartChargingState Task start
15.06.2024 21:34:42 : #2[Thread Pool Worker:48]: StartChargingState Task latestPos: 104589
15.06.2024 21:34:42 : #2[Thread Pool Worker:48]: StartChargingState Task GetCurrentState(): Online
15.06.2024 21:34:42 : #2[Thread Pool Worker:47]: StartChargingState Task start
15.06.2024 21:34:42 : #2[Thread Pool Worker:47]: StartChargingState Task latestPos: 104589
15.06.2024 21:34:42 : #2[Thread Pool Worker:47]: StartChargingState Task GetCurrentState(): Online
15.06.2024 21:34:42 : #2[Thread Pool Worker:46]: StartChargingState Task start
15.06.2024 21:34:42 : #2[Thread Pool Worker:46]: StartChargingState Task latestPos: 104589
15.06.2024 21:34:42 : #2[Thread Pool Worker:46]: StartChargingState Task GetCurrentState(): Online
15.06.2024 21:34:42 : #2[Thread Pool Worker:45]: StartChargingState Task start

@bill340
Copy link

bill340 commented Jun 15, 2024

In evcc what is trying to get the charging state I get the following error in the log:

[lp-2 ] ERROR 2024/06/15 19:38:14 charger status: Get "http://192.168.2.5:5010/currentjson/2": net/http: request canceled (Client.Timeout exceeded while awaiting headers)

@Adminius
Copy link
Contributor

@Adminius did you paste wrong link ? That link is for teslalogger instalation proces.

This link is for special brunch that should work with limited amount of requests. It's beta, so not in main branch and not yer available via normal update

@bill340
Copy link

bill340 commented Jun 15, 2024

Ok, I reinstalled this branch not to 1.58.1.3
For now it works, also with the queries from evcc.
Lets wait a day and see it it runs into Tesla-api timeouts again...

@tommymann1982
Copy link
Author

Is it necessary to make a clean install or can we just reinstall the old Version?

@Adminius
Copy link
Contributor

It enough to change .exe file

@bill340
Copy link

bill340 commented Jun 15, 2024

So far it is really working nice... Tested with several charge-commands, etc. coming from evcc via TeslaLogger.
No problems so far. Hopefully the api-limit does not kick in again...

@Adminius
Copy link
Contributor

Official Tesla FleetAPI Limit for charging commands is 5 per day. Not suitable for EVCC. If works today, it's luck only.
Thee only stable solution for future ist BLE :/
...or pay for more command, but there is no official prices yet...

@MNAktie
Copy link

MNAktie commented Jun 16, 2024

I hope that it works for you guys now. I have no idea how to update before it goes out like a normal update. Really looking forward to that 👍

@bill340
Copy link

bill340 commented Jun 16, 2024

Unfortunatly the errors are back:

16.06.2024 11:36:27 : #2[Thread Pool Worker:5]: Command: vehicle_data?endpoints=drive_state&let_sleep=true [0]
16.06.2024 11:36:27 : #2[Thread Pool Worker:5]: Result.Statuscode: 429 (TooManyRequests) cmd: vehicle_data?endpoints=drive_state&let_sleep=true Sleep: 51813000ms, ratelimit-limit: 300, ratelimit-remaining: 0, ratelimit-reset: 51813, sleep till: 17.06.2024 02:00:00, FleetAPI

@tommymann1982
Copy link
Author

@bill340 with the new beta version or the "old" version

@bill340
Copy link

bill340 commented Jun 16, 2024

with the new beta... 1.58.1.4

@bill340
Copy link

bill340 commented Jun 16, 2024

I guess the updates while driving are causing this... I have another Tesla that was not moved since yesterday, but did several charging commands, etc... (more than 5) and on this one it is still working...
The other Tesla did a short drive today (2x 20min) and now it is in rate limit already...

@Adminius
Copy link
Contributor

Do you have any other software, like EVCC oder Homeassistant that uses Tesla integration direct via Tesla Server?

@bill340
Copy link

bill340 commented Jun 16, 2024

I do have EVCC running... Custom chargers are configured to run via TeslaLogger...
But Teslas are with evcc template... Could that cause the problem?

vehicles:

  • name: cherry
    type: template
    template: tesla
    title: Cherry # Wird in der Benutzeroberfl채che angezeigt (optional)
    accessToken: ...
    refreshToken: ...
    vin: XP7YGCEK8RB... # Erforderlich, wenn mehrere Fahrzeuge des Herstellers vorhanden sind (optional)
    capacity: 79 # Akkukapazit채t in kWh (optional)

chargers:

uri: http://192.168.2.5:5010/command/2/charge_start_stop?${enable}

  uri: "http://192.168.2.110:8080/api/1/vehicles/LRWYGCEKXNC351138/command/{{if .chargeenable}}charge_start{{else}}charge_stop{{end}}"
  method: POST
  body: ""   
maxcurrent:
  source: http

uri: http://192.168.2.5:5010/command/2/set_charging_amps?${maxcurrent}

  uri: http://192.168.2.110:8080/api/1/vehicles/LRWYGCEKXNC351138/command/set_charging_amps
  method: POST
  body: '{"charging_amps": "{{.maxcurrent}}"}' 
wakeup:
  source: http

uri: http://192.168.2.5:5010/command/2/wake_up

  uri: http://192.168.2.110:8080/api/1/vehicles/LRWYGCEKXNC351138/command/wake_up
  method: POST
  body: ""

@Adminius
Copy link
Contributor

  • template: tesla

This uses your reqests...

Use,TeslaLogger Vehicle integration

@bill340
Copy link

bill340 commented Jun 16, 2024

Ok, did change it...
However can only check again tomorrow on this car that is in ratelimit already today... :(
TeslaLogger template does not deliver the parameter for the charge limit, that is set in the car, as the evcc template does, right?

@Adminius
Copy link
Contributor

No, it's not. I don't if it's possible on custom vehicle, if yes, we can integrate it

@MNAktie
Copy link

MNAktie commented Jun 16, 2024

When do you think this one will come as a normal update?

@bassmaster187
Copy link
Owner

I want to make some additional tests and fix 2 known bugs. So maybe the next 3 days.

@MNAktie
Copy link

MNAktie commented Jun 16, 2024

Thanks, looking forward to it.

@bill340
Copy link

bill340 commented Jun 24, 2024

Today I have again an error on the mail Page in the upper left corner (Vehicle Info):

Fatal Error: | TooManyRequests

But nothing at all in the log... Still an issue with request timing?

24.06.2024 12:52:25 : #2[Thread Pool Worker:5975]: *** FT: Telemetry Server Data
24.06.2024 12:53:25 : #2[Thread Pool Worker:5975]: *** FT: Telemetry Server Data
24.06.2024 12:53:25 : #2[Thread Pool Worker:5975]: *** FT: Telemetry Server Data
24.06.2024 12:54:25 : #2[Thread Pool Worker:5986]: *** FT: Telemetry Server Data
24.06.2024 12:54:25 : #2[Thread Pool Worker:5986]: *** FT: Speed: 0.000
24.06.2024 12:54:25 : #2[Thread Pool Worker:5986]: *** FT: Telemetry Server Data
24.06.2024 12:54:34 : #2[Thread Pool Worker:5975]: *** FT: Telemetry Server Alerts
24.06.2024 12:54:52 : #2[Thread Pool Worker:5984]: Command: nearby_charging_sites?detail=true [792]
24.06.2024 12:54:55 : #2[Thread Pool Worker:5986]: *** FT: Telemetry Server Data
24.06.2024 12:54:55 : #2[Thread Pool Worker:5986]: *** FT: Driving by speed ***
24.06.2024 12:54:55 : #2[Thread Pool Worker:5986]: *** FT: Speed: 25.476
24.06.2024 12:55:25 : #2[Thread Pool Worker:5975]: *** FT: Telemetry Server Data
24.06.2024 12:55:25 : #2[Thread Pool Worker:5975]: *** FT: Telemetry Server: Cruise State
24.06.2024 12:55:25 : #2[Thread Pool Worker:5975]: *** FT: Speed: 41.632
24.06.2024 12:55:25 : #2[Thread Pool Worker:5975]: *** FT: Telemetry Server Data
24.06.2024 12:55:55 : #2[Thread Pool Worker:5975]: *** FT: Telemetry Server Data
24.06.2024 12:55:55 : #2[Thread Pool Worker:5975]: *** FT: Telemetry Server: Cruise State
24.06.2024 12:55:55 : #2[Thread Pool Worker:5975]: *** FT: Speed: 25.476
24.06.2024 12:56:28 : #2[Thread Pool Worker:5986]: *** FT: Telemetry Server Data
24.06.2024 12:56:28 : #2[Thread Pool Worker:5986]: *** FT: Speed: 17.398
24.06.2024 12:56:28 : #2[Thread Pool Worker:5986]: *** FT: Telemetry Server Data
24.06.2024 12:56:28 : #2[Thread Pool Worker:5984]: *** FT: Telemetry Server Data
24.06.2024 12:56:28 : #2[Thread Pool Worker:5986]: *** FT: Telemetry Server Data

@Shrekmachine
Copy link

Does not work since 4 days with Virtual Key
Fatal Error: Car not found

@bill340
Copy link

bill340 commented Jun 24, 2024

Also in the log now...
Can you reduce the request rate? I think very 5min should be good, so we do not excess 300 requests in 24hrs...

24.06.2024 13:13:37 : #2[Thread Pool Worker:7]: Command: vehicle_data?endpoints=drive_state&let_sleep=true [0]
24.06.2024 13:13:37 : #2[Thread Pool Worker:7]: Result.Statuscode: 429 (TooManyRequests) cmd: vehicle_data?endpoints=drive_state&let_sleep=true Sleep: 45983000ms, ratelimit-limit: 300, ratelimit-remaining: 0, ratelimit-reset: 45983, sleep till: 25.06.2024 02:00:00, FleetAPI
24.06.2024 13:13:37 : #2[Thread Pool Worker:21]: *** FT: Telemetry Server Data
24.06.2024 13:13:41 : #2[Thread Pool Worker:27]: *** FT: Telemetry Server Alerts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests