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

Refactor API to support Owner API, Fleet API and Vehicle Command #7

Open
gak opened this issue Oct 19, 2023 · 1 comment
Open

Refactor API to support Owner API, Fleet API and Vehicle Command #7

gak opened this issue Oct 19, 2023 · 1 comment
Assignees

Comments

@gak
Copy link
Owner

gak commented Oct 19, 2023

Just found this repository: https://github.com/teslamotors/vehicle-command

Pre-2021 Model S and X vehicles will continue to support the full REST API, and do not support the new protocol.

Also from https://developer.tesla.com/docs/fleet-api#faq

Following the release of Tesla Vehicle Command SDK support for REST API vehicle command endpoints is now reaching end of life. Starting 2024 most vehicles will require sending commands via Tesla Vehicle Command SDK.

It appears the Owners API will stop for M3 and MY, and for newer MS and MX models.

We will keep the existing API because:

  • Other products (will?) use it, e.g. solar, powerwall.
  • We want to accomodate all Tesla products.
  • The new Fleet API supports it.

A downside is that I have to rely on others to report any problems as I can't test everything myself.

A list of commands: https://github.com/teslamotors/vehicle-command/blob/9dafa18576834a77cbef277b882dd45997e4ac10/cmd/tesla-control/commands.go#L388

Currently Api::new(access_token, refresh_token) won't be able to handle Owners API, Fleet API, and Vehicle Command at the same time, so some thought into the new API should be made.

Plan

Trait based trait Api { fn honk_horn(&self, vehicle_id: VehicleId); }

impl Api for OwnerApi {}. Each struct can handle authentication separately, as it seems all three are different. Owner API and Fleet API are almost identical (from a quick look) but has a few notable differences such as regions, host names, authorization scopes, and (maybe) public key authentication.

Current Blockers

  • The proto sources aren't available yet on the vehicle command sdk.
  • My request for the Fleet API was rejected immediately, so I can't test it. Will try again another time.
@gak gak self-assigned this Oct 19, 2023
@gak gak mentioned this issue Oct 19, 2023
10 tasks
@gak gak changed the title Owner API will stop working as vehicles begin requiring end-to-end command authentication Refactor API to support Owner API, Fleet API and Vehicle Command Oct 20, 2023
gak added a commit that referenced this issue Oct 21, 2023
…eApi trait.

Significant refactor to progress towards different API access that Tesla
has introduced. See issues #6 and #7.

Removed `ResponseData` because it wasn't very ergonomic, forcing the user
to deref or call data(). Also it had specific fields for JSON output
which was only used for the CLI, so I introduced a field
`print_responses` in OwnerApi that the CLI can use.
@gak
Copy link
Owner Author

gak commented Oct 22, 2023

Can't get access to the Fleet API yet. Updated blockers list.

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

1 participant