Skip to main content

Tesla Fleet Setup

Instructions for setting up the Tesla Fleet integration in Home Assistant. This is an advanced setup process (for now).

  1. 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:
    1. https://developer.tesla.com/dashboard
  2. In the Tesla app setting, set the Redirect URL to: https://my.home-assistant.io/redirect/oauth
  3. For the Allowed Origin(s) setting, enter your Home Assistant public domain if you have one.
    1. TODO: Further checks needed to see how to simplify this step
  4. When asked, select all available scopes.
  5. Generate a Public/Private Key Pair. Linux Instructions, run these commands:
    1. openssl ecparam -name prime256v1 -genkey -noout -out private-key.pem
    2. openssl ec -in private-key.pem -pubout -out public-key.pem
  6. You now have two files: private-key.pem and public-key.pem which you'll need later
    1. You must place the public key on the Allowed Origins domain you specified at the following location:
      1. https://your-domain.com/.well-known/appspecific/com.tesla.3p.public-key.pem
  7. Use Postman or a similar app, we need to make some API calls to Tesla now.
    1. Here is a Postman collection you can import: Tesla Fleet.postman_collection.json
  8. For the Tesla Auth Token call, fill in your client_id and client_secret from your Tesla Developer account, then click Send in postman.
    1. 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
  9. You'll get back a response with an access_token in quotes. Copy the value in the quotes.
  10. Now open the Tesla Partner Account in postman. Go to the Authorization tab and enter it into the Token field.
  11. 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.
    1. Remember, you must place the public key you created on the Allowed Origins domain you specified at the following location:
      1. https://your-domain.com/.well-known/appspecific/com.tesla.3p.public-key.pem
  12. 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.
  13. Create new Application Credentials in your HA: https://my.home-assistant.io/redirect/application_credentials/
    1. Select Tesla Fleet as the Integration and Enter your app name, client_id, client_secret, then click Add
  14. Reconnect the device in HA Settings > Devices & services > Tesla Fleet

 

Notes: