Tesla Fleet

The Tesla Fleet integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] lets you control Tesla vehicles and energy sites using the Tesla Fleet API.

Prerequisites

You need to configure developer credentials and host a public key file to allow Home Assistant to communicate with your Tesla account.

Note

The setup process involves creating encryption keys, registering a Tesla Developer Application, and connecting your Tesla account to Home Assistant. Tesla requires a publicly accessible domain with a valid certificate to verify your application’s identity.

Warning

The China region is currently not supported by this integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more].

Configuration

To set up the Tesla Fleet integration, you need to first generate encryption keys and create a Tesla Developer Application.

Step 1: Generate encryption keys

Choose the method that matches your hosting setup:

Using NGINX Home Assistant SSL proxy Add-on (recommended)

This method works if you have the NGINX Home Assistant SSL proxy Add-on running for external access to Home Assistant.

  1. Open an SSH Terminal using the Terminal & SSH Add-on.

  2. Create your private key:

    openssl ecparam -name prime256v1 -genkey -noout -out tesla_fleet.key
    
    ```shell
    openssl ec -in tesla_fleet.key -pubout -out public-key.pem
    

Set up the keys for Home Assistant

  1. Copy the private key to your Home Assistant configuration:

    cp tesla_fleet.key /config/tesla_fleet.key
    
  2. Create the directory for the public key:

    mkdir -p /share/tesla/.well-known/appspecific/
    
  3. Copy the public key to the web-accessible location:

    cp public-key.pem /share/tesla/.well-known/appspecific/com.tesla.3p.public-key.pem
    

Configure NGINX

  1. Create the NGINX configuration:

    echo 'location /.well-known/appspecific/com.tesla.3p.public-key.pem {
      root /share/tesla;
    }' > /share/nginx_proxy_default_tesla.conf
    
  2. Configure the NGINX Add-on:

    • Go to Settings > Add-ons > NGINX Home Assistant SSL proxy > Configuration
    • Change customize.active from false to true
    • Leave config.default at its default value: nginx_proxy_default*.conf
  3. Restart the NGINX Add-on and verify your public key is accessible at: https://yourdomain.com/.well-known/appspecific/com.tesla.3p.public-key.pem

  4. Backup your keys in a safe location for future use.

Using external web hosting

Use this method if you have your own web hosting or prefer using a third-party service.

  1. Open a terminal on your computer.

  2. Create your private key:

    openssl ecparam -name prime256v1 -genkey -noout -out tesla_fleet.key
    
  3. Create the public key:

    openssl ec -in tesla_fleet.key -pubout -out public-key.pem
    
  4. Rename the public key file:

    mv public-key.pem com.tesla.3p.public-key.pem
    

Set up hosting

  1. Upload the public key to your web hosting at the exact path: /.well-known/appspecific/com.tesla.3p.public-key.pem

    Important

    The file must be accessible at https://yourdomain.com/.well-known/appspecific/com.tesla.3p.public-key.pem with no redirects.

    1. Copy the private key to your Home Assistant configuration directory:

      cp tesla_fleet.key /config/tesla_fleet.key
      
    2. Backup both key files in a safe location for future use.

Step 2: Create Tesla Developer Application

Now you’ll create a Tesla Developer Application to connect Home Assistant with Tesla’s API.

  1. Set up your Tesla Developer account at developer.tesla.com:

    • Verify your email address
    • Enable multi-factor authentication (optional)
  2. Create a new application:

  3. Complete registration:

    • Select your account: Choose your Tesla account from the dropdown
  4. Enter application details:

    • Application name: A name to identify the application
    • Description: Enter a brief description of your integration
    • Purpose of Usage: Explain how you’ll use the API (e.g., “Home automation integration”)
  5. Configure client details:

    • OAuth Grant Type: Select Authorization Code and Machine-to-Machine
    • Allowed Origin URL(s): Enter your domain (example: https://yourdomain.com/)
    • Allowed Redirect URI: Enter https://my.home-assistant.io/redirect/oauth
    • Allowed Returned URL(s): Leave this field empty (not required)
  6. Select API scopes:

    Important

    You must select at least Vehicle Information OR Energy Product Information for the integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] to work.

    Recommended scopes for full functionality:

    • Vehicle Information
    • Vehicle Location
    • Vehicle Commands
    • Energy Product Information
    • Energy Product Settings

    Note

    You can change scopes later, but you’ll need to reconfigure the entire integration.

    1. Set up billing (optional):

      • Tesla provides $10 monthly credit for personal use
      • Most personal usage stays within the free tier
      • You can add billing details later if needed
    2. Save your credentials:

      • After creating the application, go to View Details > Credentials & APIs
      • Note your Client ID and Client Secret - you’ll need these for Home Assistant

    Step 3: Register as Tesla Fleet API partner

    Before you can use your application, you need to register it as an official Tesla Fleet API partner.

    Warning

    The following steps involve sensitive credentials. Never share your Client Secret or access tokens.

    Get an access token

    1. Prepare your credentials from the Tesla Developer Dashboard:

      • Client ID
      • Client Secret
    2. Choose your region URL:

      • North America/Asia-Pacific: https://fleet-api.prd.na.vn.cloud.tesla.com
      • Europe/Middle East/Africa: https://fleet-api.prd.eu.vn.cloud.tesla.com
    3. Get your access token by running this command (replace the variables):

      curl --request POST \
        --header 'Content-Type: application/x-www-form-urlencoded' \
        --data-urlencode 'grant_type=client_credentials' \
        --data-urlencode 'client_id=YOUR_CLIENT_ID' \
        --data-urlencode 'client_secret=YOUR_CLIENT_SECRET' \
        --data-urlencode 'scope=openid vehicle_device_data vehicle_cmds vehicle_charging_cmds' \
        --data-urlencode 'audience=YOUR_REGION_URL' \
        'https://fleet-auth.prd.vn.cloud.tesla.com/oauth2/v3/token'
      

      Note

      If your Client Secret contains ! or $ characters, you may need to escape them depending on your terminal.

      1. Copy the access token from the response:

        {"access_token":"YOUR_ACCESS_TOKEN","expires_in":28800,"token_type":"Bearer"}
        

      Register as a partner

      1. Register your domain with Tesla (replace YOUR_ACCESS_TOKEN and your domain):

        curl --location 'YOUR_REGION_URL/api/1/partner_accounts' \
        --header 'Content-Type: application/json' \
        --header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
        --data '{
            "domain": "yourdomain.com"
        }'
        
      2. Verify success - you should see a response with your application details and pricing information.

      Step 4: Connect to Home Assistant

      Configuration

      To add the Tesla Fleet integration to your Home Assistant instance, use this My button:

      Manual configuration steps

      If the above My button doesn’t work, you can also perform the following steps manually:

      • Browse to your Home Assistant instance.

      • Go to Settings > Devices & Services.

      • In the bottom right corner, select the Add Integration button.

      • From the list, select Tesla Fleet.

      • Follow the instructions on screen to complete the setup.

      1. Start the integration setup:

      2. Enter your application details:

        • Application name: Enter the name you used when creating your Tesla Developer Application
        • Client ID: From your Tesla Developer Dashboard
        • Client Secret: From your Tesla Developer Dashboard
      3. Authenticate with Tesla:

        • You’ll be redirected to Tesla’s login page
        • Enter your Tesla account credentials
        • On the authorization page, select Select All and then Allow
      4. Complete the setup:

        • Confirm you want to Link account to Home Assistant
        • The integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] will automatically discover your Tesla vehicles and energy products

      Tip

      If you encounter any issues during setup, check the troubleshooting section below for common solutions.

      Data updates

      The integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] pollsData polling is the process of querying a device or service at regular intervals to check for updates or retrieve data. By defining a custom polling interval, you can control how frequently your system checks for new data, which can help optimize performance and reduce unnecessary network traffic. [Learn more] each vehicle every 10 minutes while it’s awake. This is designed to stay within Tesla’s $10 monthly credit for most users. Energy product APIs are free to use.

      Note

      Tesla charges for API calls starting January 2025. The default polling interval is optimized to stay within the free tier for typical usage.

      If you need different polling intervals, you can define a custom polling interval.

      Scopes and billing

      When connecting your Tesla account, you must select at least one of Vehicle Information or Energy Product Information. All scopes are recommended for full functionality.

      Tesla provides a $10 monthly credit for personal API usage. You can monitor usage in your Tesla Developer Dashboard.

      Command signing

      Certain vehicles, including all vehicles manufactured since late 2023, require vehicle commands to be signed with a private key. All actionsActions are used in several places in Home Assistant. As part of a script or automation, actions define what is going to happen once a trigger is activated. In scripts, an action is called sequence. [Learn more] on vehicle entitiesAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more] will fail with an error if this is required and the key has not been setup correctly.

      The integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] expects your private key to be located at config/tesla_fleet.key. This should be the same private key file (tesla_fleet.key) that you created during the prerequisites setup, copied to this location as instructed in the setup steps above.

      Your public key must be added to each of your vehicles by visiting https://tesla.com/_ak/YOUR_DOMAIN and following the instructions in the Tesla app. If you’re using an iPhone, you may need to use Safari to open the webpage and finish the setup.

      For more details see Tesla Fleet API vehicle commands documentation.

      Entities

      These are the entities available in the Tesla Fleet integration. Not all entities are enabled by default, and not all values are always available.

      Vehicles

      Domain Name Enabled
      Binary sensor Battery heater No
      Binary sensor Cabin overheat protection actively cooling No
      Binary sensor Charge cable Yes
      Binary sensor Charger has multiple phases No
      Binary sensor Dashcam No
      Binary sensor Front driver door Yes
      Binary sensor Front driver window Yes
      Binary sensor Front passenger door Yes
      Binary sensor Front passenger window Yes
      Binary sensor Preconditioning enabled No
      Binary sensor Preconditioning No
      Binary sensor Rear driver door Yes
      Binary sensor Rear driver window Yes
      Binary sensor Rear passenger door Yes
      Binary sensor Rear passenger window Yes
      Binary sensor Scheduled charging pending No
      Binary sensor Status Yes
      Binary sensor Tire pressure warning front left No
      Binary sensor Tire pressure warning front right No
      Binary sensor Tire pressure warning rear left No
      Binary sensor Tire pressure warning rear right No
      Binary sensor Trip charging No
      Binary sensor User present Yes
      Button Flash lights Yes
      Button HomeLink Yes
      Button Honk horn Yes
      Button Keyless driving Yes
      Button Play fart Yes
      Button Wake Yes
      Climate Cabin overheat protection No
      Climate Climate Yes
      Cover Charge port door Yes
      Cover Frunk Yes
      Cover Sunroof No
      Cover Trunk Yes
      Cover Vent windows Yes
      Device tracker Location Yes
      Device tracker Route Yes
      Lock Charge cable lock Yes
      Lock Lock Yes
      Media player Media player Yes
      Number Charge current Yes
      Number Charge limit Yes
      Select Seat heater front left Yes
      Select Seat heater front right Yes
      Select Seat heater rear center No
      Select Seat heater rear left No
      Select Seat heater rear right No
      Select Seat heater third row left No
      Select Seat heater third row right No
      Select Steering wheel heater Yes
      Sensor Battery level Yes
      Sensor Battery range Yes
      Sensor Charge cable No
      Sensor Charge energy added Yes
      Sensor Charge rate Yes
      Sensor Charger current Yes
      Sensor Charger power Yes
      Sensor Charger voltage Yes
      Sensor Charging Yes
      Sensor Distance to arrival Yes
      Sensor Driver temperature setting No
      Sensor Estimate battery range No
      Sensor Fast charger type No
      Sensor Ideal battery range No
      Sensor Inside temperature Yes
      Sensor Odometer No
      Sensor Outside temperature Yes
      Sensor Passenger temperature setting No
      Sensor Power No
      Sensor Shift state No
      Sensor Speed No
      Sensor State of charge at arrival No
      Sensor Time to arrival Yes
      Sensor Time to full charge Yes
      Sensor Tire pressure front left No
      Sensor Tire pressure front right No
      Sensor Tire pressure rear left No
      Sensor Tire pressure rear right No
      Sensor Traffic delay No
      Sensor Usable battery level No
      Switch Auto seat climate left Yes
      Switch Auto seat climate right Yes
      Switch Auto steering wheel heater Yes
      Switch Charge Yes
      Switch Defrost Yes
      Switch Sentry mode Yes

      Energy sites

      Domain Name Enabled
      Binary sensor Backup capable Yes
      Binary sensor Grid services active Yes
      Binary sensor Grid services enabled Yes
      Binary sensor Storm watch active Yes
      Number Backup reserve Yes
      Number Off grid reserve Yes
      Select Allow export Yes
      Select Operation mode Yes
      Sensor Battery power Yes
      Sensor Consumer imported from battery No
      Sensor Consumer imported from generator No
      Sensor Consumer imported from grid No
      Sensor Consumer imported from solar No
      Sensor Energy left Yes
      Sensor Generator exported Yes
      Sensor Generator power No
      Sensor Grid exported Yes
      Sensor Grid exported from battery No
      Sensor Grid exported from generator No
      Sensor Grid exported from solar No
      Sensor Grid imported No
      Sensor Grid power Yes
      Sensor Grid services exported No
      Sensor Grid services imported No
      Sensor Grid services power Yes
      Sensor Home usage Yes
      Sensor Island status Yes
      Sensor Load power Yes
      Sensor Percentage charged Yes
      Sensor Solar exported No
      Sensor Solar generated Yes
      Sensor Solar power Yes
      Sensor Total pack energy No
      Sensor Version Yes
      Sensor VPP backup reserve Yes
      Switch Allow charging from grid Yes
      Switch Storm watch Yes

      Wall connector

      Domain Name Enabled
      Sensor Fault state No
      Sensor Power Yes
      Sensor State Yes
      Sensor Vehicle Yes

      Vehicle sleep

      Constant API pollingData polling is the process of querying a device or service at regular intervals to check for updates or retrieve data. By defining a custom polling interval, you can control how frequently your system checks for new data, which can help optimize performance and reduce unnecessary network traffic. [Learn more] will prevent most Model S and Model X vehicles manufactured before 2021 from sleeping. The integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] automatically stops pollingData polling is the process of querying a device or service at regular intervals to check for updates or retrieve data. By defining a custom polling interval, you can control how frequently your system checks for new data, which can help optimize performance and reduce unnecessary network traffic. [Learn more] these vehicles for 15 minutes after inactivity. You can call the homeassistant.update_entity actionActions are used in several places in Home Assistant. As part of a script or automation, actions define what is going to happen once a trigger is activated. In scripts, an action is called sequence. [Learn more] to force pollingData polling is the process of querying a device or service at regular intervals to check for updates or retrieve data. By defining a custom polling interval, you can control how frequently your system checks for new data, which can help optimize performance and reduce unnecessary network traffic. [Learn more], which will reset the timer.

      Removing the integration

      To remove an integration instance from Home Assistant

      1. Go to Settings > Devices & services and select the integration card.
      2. From the list of devices, select the integration instance you want to remove.
      3. Next to the entry, select the three-dot menu. Then, select Delete.
      • Removing the integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] does not delete your Tesla Developer Application - you can remove it manually from the Tesla Developer Dashboard if no longer needed.

      Troubleshooting

      • Setup errors: Verify your public key is accessible at the correct URL and you’ve completed all registration steps with Tesla
      • Command failures: Ensure tesla_fleet.key exists in your Home Assistant config directory and add your public key to vehicles via https://tesla.com/_ak/YOUR_DOMAIN
      • IntegrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] stopped working: Use the reconfigure option in Settings > Devices & services > Tesla Fleet
      • Billing errors: Check your Tesla Developer Dashboard for usage limits and add billing information if needed

      If you have an error with your credentials, you can delete them in the Application Credentials user interface.