Tesla Fleet
The Tesla Fleet API integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] exposes various sensors from Tesla vehicles and energy sites.
Prerequisites
You must have a Tesla
Use a custom OAuth application
The integration has a built-in OAuth application that will be suitable for most users. However, you can create your own applicationhttps://my.home-assistant.io/redirect/oauth
, but the other URLs can be set as desired. You must also complete both step 3
You will be prompted to pick your custom application credential when creating a Tesla Fleet config entry.
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.
-
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.
Scopes
When connecting your Tesla account to Home Assistant, you must select the Vehicle Information
or Energy Product Information
scope. It is recommended you select all scopes for full functionality.
Rate limits
Tesla restricts open-source integrations to the “Discovery” plan
Command signing
Certain vehicles, including all vehicles manufactured since late 2023, require vehicle commands to be signed with a private key. All actions on vehicle entities will fail with an error if this is required and the key has not been added to the vehicle.
You will need to use Tesla’s command line tools
tesla-keygen -key-file tesla_fleet.key create > tesla_fleet.pem
tesla-control -ble -key-file tesla_fleet.key -vin VINVINVINVIN -debug add-key-request tesla_fleet.pem owner cloud_key
Finally, copy tesla_fleet.key
to your Home Assistant config directory and then reload the Tesla Fleet integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more].
If you receive a “BLE connection attempt failed” error, follow these steps:
- Disable Bluetooth on your phone
- Execute the
tesla-control
command - Re-enable Bluetooth after the command completes
This is necessary because the tool cannot establish a connection while another Bluetooth device is connected to the car.
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 | Energy left | Yes |
Sensor | Generator power | No |
Sensor | Grid power | Yes |
Sensor | Grid services power | Yes |
Sensor | Grid status | Yes |
Sensor | Island status | Yes |
Sensor | Load power | Yes |
Sensor | Percentage charged | Yes |
Sensor | Solar power | Yes |
Sensor | Total pack energy | No |
Sensor | VPP backup reserve | Yes |
Sensor | Version | 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 polling will prevent most Model S and Model X vehicles manufactured before 2021 from sleeping, so the integration will stop polling these vehicles for 15 minutes, after 15 minutes of inactivity. You can call the homeassistant.update_entity
service to force polling the API, which will reset the timer.
Energy dashboard
The Tesla Fleet API only provides power data for Powerwall and Solar products. This means they cannot be used on the energy dashboard directly.
Energy flows can be calculated from Battery power
and Grid power
sensors using a Template Sensor to separate the positive and negative values into positive import and export values.
The Load power
, Solar power
, and the templated sensors can then use a Riemann Sum to convert their instant power (kW) values into cumulative energy values (kWh),
which then can be used within the energy dashboard.