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

Support the new Tesla command protocol #160

Open
gshaviv opened this issue Dec 5, 2023 · 26 comments
Open

Support the new Tesla command protocol #160

gshaviv opened this issue Dec 5, 2023 · 26 comments

Comments

@gshaviv
Copy link
Contributor

gshaviv commented Dec 5, 2023

As the old command REST API is being deprecated, the new way of sending commands is via the new Tesla Command Protocol using the signed_command endpoint.

@jonasman
Copy link
Owner

jonasman commented Dec 5, 2023

The library has been changed to use the new API already. Or do you mean we need to make even more changes?

@gshaviv
Copy link
Contributor Author

gshaviv commented Dec 5, 2023

Indeed. According to the fleet API docs, the old REST api for sending commands will be deprecated end of the month and cease to work and starting Jan 24 sending commands will be done using the new command protocol and the new signed_command endpoint

@gshaviv
Copy link
Contributor Author

gshaviv commented Dec 5, 2023

Here is the link to the notification the old command API is phased out. https://developer.tesla.com/docs/fleet-api#announcements-amp-api-changelog

@jonasman
Copy link
Owner

jonasman commented Dec 6, 2023

the current library version already uses the new API.

@jonasman
Copy link
Owner

jonasman commented Dec 6, 2023

unless the current command API is going away too, but i dont see any alternative in the docs?

@jonasman
Copy link
Owner

jonasman commented Dec 6, 2023

ok i think i found the new endpoint: signed_command

@gshaviv
Copy link
Contributor Author

gshaviv commented Dec 6, 2023

Yep, the new endpoint is signed_command but I don't see any docs how to create the routable_message it needs. Only way I see is to try reverse engineer their go implementation available on GitHub. https://github.com/teslamotors/vehicle-command

@NicolasJott
Copy link

is this related to the response i've been getting when trying to send vehicle commands?

RESPONSE BODY: {"response":{"result":false,"reason":"unsigned_cmds_hardlocked"}}

@gshaviv
Copy link
Contributor Author

gshaviv commented Dec 18, 2023

Yep. The new way to send commands is to sign them with your private key so the car can verify them with your public key.

All vehicles will require this starting Jan and vehicles that didn't use the owner api commands last 30 days already require this. Also vehicles manufactured after October require this.

@jonasman
Copy link
Owner

I wonder if we shall use the proxy?
this new API is a bit confusing to understand what is needed. I will try to see if we can use signed_command

@jonasman
Copy link
Owner

tried to have a look at signed_command, but im not sure how to build the message to send the command, probably need to base64 encode the protbuf msg somehow.

@gshaviv
Copy link
Contributor Author

gshaviv commented Dec 30, 2023

I saw in the proxy repository someone from Tesla wrote they are working on publishing docs for this. Hopefully will be available soon

@gshaviv
Copy link
Contributor Author

gshaviv commented Jan 29, 2024

Tesla added a doc explaining how messages are encoded to the proxy repo, maybe now we can implement this in the package:

teslamotors/vehicle-command@d7a3e30

@craigrigdon
Copy link

craigrigdon commented Feb 4, 2024

any insight on encoding the protbuf msg to be sent via signed_command yet?

@Urkman
Copy link

Urkman commented Feb 19, 2024

@gshaviv did you make any progress with signing the command?

@gshaviv
Copy link
Contributor Author

gshaviv commented Feb 19, 2024

@Urkman Sorry, haven't had time to try it. Kinda busy and overwhelmed with other stuff at the moment.

@jonasman
Copy link
Owner

jonasman commented Feb 25, 2024

we need the pairing to work as well, not just sending messages. I recently installed Charge HQ and they have the new pairing working.

  1. First the user logs in with Tesla credentials
  2. Then the user needs to open a link that will in turn open the Tesla app
  3. The Tesla app asks to install some virtual key (for me it said it was not needed because my model S is old)
  4. After this virtual key is installed, i think the permissions are done

i think in the vehicle config this is what says if we need pairing or not: supports_qr_pairing or ble_autopair_enrolled

@jonasman
Copy link
Owner

jonasman commented Mar 7, 2024

i found how to do #2 will be pushing the code soon
Tesla has updated the docs with more info

@jonasman
Copy link
Owner

jonasman commented Mar 7, 2024

tag 9.2.0 includes a helper to send the public key to the vehicle

@jonasman
Copy link
Owner

jonasman commented Mar 7, 2024

@gshaviv is the API now working fine for you? should we close this issue?

@gshaviv
Copy link
Contributor Author

gshaviv commented Mar 8, 2024

Vehicle commands are still not supported. Has any change been attempted to support the signed command?

@jonasman
Copy link
Owner

jonasman commented Mar 9, 2024

@gshaviv unfortunately i dont have a model 3/y/2021 S/X, so im not able to test.
Do you mean that after we send the pub key we need to send all commands via the new signed_command API?

@gshaviv
Copy link
Contributor Author

gshaviv commented Mar 9, 2024

@jonasman exactly. The old way of sending commands no longer works. Only signed commands work.

@jonasman
Copy link
Owner

jonasman commented Apr 5, 2024

@gshaviv any idea on the api of that request?

@Urkman
Copy link

Urkman commented Jul 16, 2024

Anyone managed to sign a command using swift and send it to the API?
https://developer.tesla.com/docs/fleet-api#signed_command

@jonasman
Copy link
Owner

jonasman commented Aug 7, 2024

@Urkman as far as i know, nobody is able to do it without using HTTP proxys yet.

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

5 participants