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

Calling Tesla API every second while driving seems excessive? #64

Open
galmok opened this issue Jul 25, 2019 · 1 comment
Open

Calling Tesla API every second while driving seems excessive? #64

galmok opened this issue Jul 25, 2019 · 1 comment

Comments

@galmok
Copy link

galmok commented Jul 25, 2019

I just did a test drive monitored by this piece of software, and it does work. Great!

But I can't help thinking this software putting some load on the servers and transmission to the car that isn't quite necessary. I mean, while driving, the car is polled every second. I believe data quality wont suffer much if slower polling is used.

Also, I notice that the polling wanders from 1 to 2048 (1,2,4,8, ..., 1024, 2048) seconds after the car is stopped, and from 2048 to 1 (also, 2048, 1024, 512, ..., 4, 2, 1) when the trip starts. Couldn't this be optimized a bit when the Android app is being used? The app should stop and start the scraping, but according to my little test, it does seemingly nothing.

Is there any way to see if the android app actually works? To see if it detects the cars bluetooth...

Anyway, the major part of the software works just great, I just feel it is so close to perfect that it should have this last push. :)

@eliluong
Copy link

eliluong commented Jul 27, 2019

To see if API is working, you have to use something that can send a HTTP POST request with the correct headers and then the scrape command in the request body. You will see the result in the console window. And if it works, then the poll interval should be reset to 0, and subsequently double starting from 1, and once it detects drive/reverse state, it will start polling every 1 second, which I think can be changed in the code where it says if shift == "R" or shift == "D":

I think I had to add disableScrape = False and car_active_state = "scrape request" to the section of code that says logger.info("Resume Scrape requested") in order to make it work. I'm not sure if any other adjustments need to be made.

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