Tesla Fleet Setup
Instructions for setting up the Tesla Fleet integration in Home Assistant. This is an advanced setup process (for now).
- Sign in with your Tesla Account credentials and create a new app. Give it a unique name to ensure no one else has used the same name:
- In the Tesla app setting, set the Redirect URL to:
https://my.home-assistant.io/redirect/oauth
- For the Allowed Origin(s) setting you need a public domain where you can host a file. Hopefully soon we can simplify this step.
- When asked, select all available scopes.
- Generate a Public/Private Key Pair. See below:
- Linux Instructions, run these commands:
openssl ecparam -name prime256v1 -genkey -noout -out private-key.pem
openssl ec -in private-key.pem -pubout -out public-key.pem
- You now have two files: private-key.pem and public-key.pem which you'll need later
- You must place the public key on the Allowed Origins domain you specified at the following location:
- https://your-domain.com/.well-known/appspecific/com.tesla.3p.public-key.pem
- Linux Instructions, run these commands:
- Use Postman or a similar app, we need to make some API calls to Tesla now.
- Here is a Postman collection you can import: Tesla Fleet.postman_collection.json
- For the Tesla Auth Token call, fill in your client_id and client_secret from your Tesla Developer account, then click Send in postman.
- This assumes Tesla North America or Asia-Pacific. If you're in a different region like Europe, find your URL here and update the audience field: https://developer.tesla.com/docs/fleet-api/getting-started/base-urls
- You'll get back a response with an access_token in quotes. Copy the value in the quotes.
- Now open the Tesla Partner Account in postman. Go to the Authorization tab and enter it into the Token field.
- Click the Body tab and in the quotes next to domain enter the same domain you entered in Allowed Origin(s) when you setup your app with Tesla (excluding the https:// portion).
- Remember, you must place the public key you created on the Allowed Origins domain you specified at the following location:
- https://your-domain.com/.well-known/appspecific/com.tesla.3p.public-key.pem
- Remember, you must place the public key you created on the Allowed Origins domain you specified at the following location:
- Send the request in postman. If your file was in the correct place, you should get back a response. Otherwise you'll receive an error message with what went wrong.
- Create new Application Credentials in your HA: https://my.home-assistant.io/redirect/application_credentials/
- Select Tesla Fleet as the Integration and Enter your app name, client_id, client_secret, then click Add
- Reconnect the device in HA Settings > Devices & services > Tesla Fleet
Notes:
-
- Questions/Comments? Reach out on Mastodon: @JaggedJax@hostux.social
- This guide does not yet cover Command Signing which may be required by newer vehicles to perform actions. It is not required just to read stats: https://www.home-assistant.io/integrations/tesla_fleet#command-signing
- It doesn't appear that the public key or Allowed Origin URL is actually validated, beyond one just existing.