bassmaster187 / TeslaLogger

TeslaLogger is a self hosted data logger for your Tesla Model S/3/X/Y. Actually it supports RaspberryPi 3B, 3B+, 4B, Docker and Synology NAS.
https://www.teslalogger.de
GNU General Public License v3.0
494 stars 165 forks source link

Tesla fleet API: Result.Statuscode: 429 (TooManyRequests) cmd: vehicle_data #1304

Open tommymann1982 opened 3 weeks ago

tommymann1982 commented 3 weeks ago

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

bassmaster187 commented 3 weeks ago

Other apps have the same problem: https://github.com/teslamotors/vehicle-command/issues/255

tommymann1982 commented 3 weeks ago

This isnt good

bassmaster187 commented 3 weeks ago

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.

tommymann1982 commented 3 weeks ago

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 commented 3 weeks ago

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

bill340 commented 3 weeks ago

Not really! Issues are still there!

IMgoRt commented 3 weeks ago

Was working Saturday, broke again sometime Sunday PM

bassmaster187 commented 3 weeks ago

Not really! Issues are still there!

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

image

GerdMayer commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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! https://github.com/evcc-io/evcc/pull/13062

Adminius commented 3 weeks ago

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: https://github.com/evcc-io/evcc/discussions/14252#discussioncomment-9748552

dbmtrde commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

@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 commented 2 weeks ago

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

albi commented 2 weeks ago

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

Adminius commented 2 weeks ago

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

tommymann1982 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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

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

tommymann1982 commented 2 weeks ago

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

bill340 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

@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 commented 2 weeks ago

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 commented 2 weeks ago

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

Adminius commented 2 weeks ago

It enough to change .exe file

bill340 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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

bill340 commented 2 weeks ago

with the new beta... 1.58.1.4

bill340 commented 2 weeks ago

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 commented 2 weeks ago

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

bill340 commented 2 weeks ago

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:

chargers:

Adminius commented 2 weeks ago
  • template: tesla

This uses your reqests...

Use,TeslaLogger Vehicle integration

bill340 commented 2 weeks ago

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 commented 2 weeks ago

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

MNAktie commented 2 weeks ago

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