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

Customize intervals between vehicle_data calls #3940

Merged
merged 62 commits into from
Jul 2, 2024
Merged

Customize intervals between vehicle_data calls #3940

merged 62 commits into from
Jul 2, 2024

Conversation

jlestel
Copy link
Contributor

@jlestel jlestel commented Jun 5, 2024

As discussed here, the vehicule_data endpoint is limited for Tesla Fleet API users (300 hits per vehicle per day).

With the current hard-coded polling values, this limit is quickly exceeded.

I want to let the Tesla Telemetry send the real time events via web streaming API and be able to customize polling intervals to try to not exceed this limit on vehicle_data.

@jlestel jlestel changed the title WIP: Customize polling intervals Customize polling intervals Jun 14, 2024
@jlestel
Copy link
Contributor Author

jlestel commented Jun 14, 2024

@brianmay @JakobLichterfeld let me know what you think about this PR.

The current intervals are kept by default. I added some environment variables to be able to modify the intervals.

Copy link
Collaborator

@brianmay brianmay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general looks good.

Have mixed feelings about this. We don't want people to think they have to configure these values and end up with incorrect values that are loading up Tesla's servers.

Suggestion - add somewhere a note that it is strongly recommended that you do not set that values unless you really know what you are doing.

lib/teslamate/vehicles/vehicle.ex Outdated Show resolved Hide resolved
@jlestel
Copy link
Contributor Author

jlestel commented Jun 15, 2024

Suggestion - add somewhere a note that it is strongly recommended that you do not set that values unless you really know what you are doing.

I will add a bold note about this in the env vars description.

@jlestel jlestel mentioned this pull request Jun 18, 2024
1 task
@JakobLichterfeld JakobLichterfeld changed the title Customize polling intervals Customize intervals before trying to connect again to streaming api Jun 18, 2024
@JakobLichterfeld JakobLichterfeld changed the title Customize intervals before trying to connect again to streaming api Customize intervals between vehicle_data calls Jun 18, 2024
@jensb
Copy link

jensb commented Jun 18, 2024

A question... when the vehicle is woken up, eg. for driving or charging, will Teslamate notice this in real time via streaming API, regardless of this interval? Or will we run the risk of losing the first few minutes of each drive with a sufficiently large interval? 300 polls in 24h is just once per 5 minutes ...

@jlestel
Copy link
Contributor Author

jlestel commented Jun 18, 2024

will Teslamate notice this in real time via streaming API, regardless of this interval? Or will we run the risk of losing the first few minutes of each drive

Yes, the data retrieved from the streaming API is independent of these intervals and Tesla continues to get it in real time.

Obviously with long intervals, the data is much less precise... but streaming helps limit losses.

Note that for the "future": the new Telemetry only sends this information every minute while the "owner" streaming API sends every second during drives.

@brianmay
Copy link
Collaborator

Not that the streaming parameters supported is very restricted. Anything not supported in streaming will be affected, e.g. state of doors being opened/closed. State of vehicle being plugged in, etc.

@JakobLichterfeld JakobLichterfeld merged commit c8159cf into teslamate-org:master Jul 2, 2024
12 checks passed
@jlestel
Copy link
Contributor Author

jlestel commented Jul 2, 2024

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:tesla api Related to the Tesla API area:teslamate Related to TeslaMate core enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants