-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
Reduce number of API calls for 2023.38.X #1132
Comments
I played with this https://github.com/superfloh247/TeslaLogger/tree/bugfix-1132 but all I get ist 408 timeout, both with an old MCU1 car and an up to date Model Y |
Thanks for giving this a shot. About the 408 - that is usually a sign that either the car is unreachable (car is asleep or no internet connection) or that another client (e.g. the official app) is currently active. Does the 408 message contain a reason (such as "VEHICLE_UNAVAILABLE")? |
Maybe it makes sense to only request specific parameters while driving (line 2955). TeslaLogger/TeslaLogger/WebHelper.cs Lines 2950 to 2955 in ce9f3f7
According to the Tesla API documentation: "This may return cached data if the vehicle is offline." I am not sure if and how the cache also works when we are passing specific URL parameters. Maybe it makes sense to only address this in driving state for now, where we know that the car is online. |
Describe the bug
While the fix to support 2023.38.X is working great, it is effectively doubling the amount of calls to the Tesla API.
TeslaLogger/TeslaLogger/WebHelper.cs
Lines 2974 to 2998 in ce9f3f7
For firmware version 2023.38.X, the Tesla API reply to the first call will never contain the latitude, always forcing Teslalogger to make a second call.
The Tesla API supports getting all relevant information in a single call. To achieve this, all necessary parameters must directly be passed as URL parameters in the first call. TeslaMate shows how this is done and this is also backwards compatible for older firmware versions:
https://github.com/teslamate-org/teslamate/pull/3373/files
Background information
The Tesla API documentation has a section for pricing. While currently the pricing is fixed at $0/week, there is no guarantee that this will continue to be the case. There is also a limit for the amount of API requests, which means that in the future it may be prudent to reduce the number of calls
While it may not seem necessary at the moment, it would be wise to optimize the amount of calls necessary, if not only in order to be a good citizen and to reduce the possibility of potential connectivity issues.
Due to time issues, I can't offer a PR at the moment, but I would like to leave this issue here, so either I can try to fix it in the future or maybe someone else can have a go in the meantime.
The text was updated successfully, but these errors were encountered: