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 https://freakycowbot.com
    1. You can enter your public domain if you have one and want to use your own pub key.
  4. When asked, select all available scopes.
  5. SKIP THIS unless you are using your own domain
    1. 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
    2. You now have two files: private-key.pem and public-key.pemĀ which you'll need later
    3. 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
  6. 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
  7. 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
  8. You'll get back a response with an access_token in quotes. Copy the value in the quotes.
  9. Now open the Tesla Partner Account in postman. Go to the Authorization tab and enter it into theĀ Token field.
  10. 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. For example: freakycowbot.com
    1. Remember, unless you're using the domain listed here, 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
  11. 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.
  12. 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
  13. Reconnect the device in HA Settings > Devices & services > Tesla Fleet

Notes: