A fork of the previous official Tesla integration in Home Assistant which has been removed due to Tesla login issues. Do not report issues to Home Assistant.
To use the component, you will need an application to generate a Tesla refresh token:
- Android: Tesla Tokens
- iOS: Auth App for Tesla
- TeslaFi: Tesla v3 API Tokens
- Chromium/Edge: Chromium Tesla Token Generator
- Use HACS, in
HACS > Integrations > Explore & Add Repositories
search for "Tesla". After adding thishttps://github.com/alandtse/tesla
as a custom repository. Skip to 7. - If you do not have HACS, use the tool of choice to open the directory (folder) for your HA configuration (where you find
configuration.yaml
). - If you do not have a
custom_components
directory (folder) there, you need to create it. - In the
custom_components
directory (folder) create a new folder calledtesla_custom
. - Download all the files from the
custom_components/tesla_custom/
directory (folder) in this repository. - Place the files you downloaded in the new directory (folder) you created.
- Restart Home Assistant.
- Add the integration: or in the HA UI go to "Settings" -> "Devices & Services" then click "+" and search for "Tesla Custom Integration".
- For most vehicles, you will need to the Tesla Fleet API Proxy (see below).
Note: This integration will wake up your vehicle(s) during installation.
Tesla has deprecated the Owner API for most vehicles in favor of a new Fleet API with end-to-end encryption. You'll know you're affected if you see teslajsonpy.exceptions.TeslaException
errors in the log when attempting to send commands (sensors will work regardless).
If your vehicle is affected by this (most likely), you'll need to install the Tesla HTTP Proxy add-on and configure this component to use it. This requires a complex setup; see here for step-by-step instructions.
The Tesla
integration offers integration with the Tesla cloud service and provides presence detection as well as sensors such as charger state and temperature.
This integration provides the following entities for vehicles:
- Binary sensors - charger connection, charging status, car online, parking brake, car asleep, and door status.
- Buttons - horn, flash lights, wake up1, force data update1, trigger HomeLink, and remote start. Note: The HomeLink button is disabled by default as some vehicles don't have this option. Enable via configuration/entities if desired.
- Climate - turn HVAC on/off, set target temperature, set preset modes (defrost, keep on, dog mode and camp mode).
- Device tracker - car location1, and active route destination.
- Cover - Charger door, frunk, trunk, and windows.
- Locks - door lock, and charge port latch lock.
Note: Set
state
toheat_cool
oroff
to enable/disable your Tesla's climate system via a scene. - Selects - seat heaters and cabin overheat protection2. Note: Turning on a heated seat will cause the climate to turn on.
- Sensors - battery level, charge rate, energy added, charger power, inside/outside temperature, odometer, estimated range, time charge complete, TPMS pressure, active route arrival time and distance to arrival.
- Switches - heated steering wheel, charger, sentry mode, polling, and valet mode.1.
- Update - software update2
1 Diagnostics entities.
2 Configuration entities.
This integration provides the following entities for energy sites:
- Binary sensors - Powerwall charging and grid status.
- Selects - grid charging, export rule and operation mode.
- Sensors - solar power, grid power, load power, battery level, battery Wh remaining and backup reserve.
Tesla options are set via Configuration -> Integrations -> Tesla -> Options.
- Seconds between polling - referred to below as the
polling_interval
. - Wake cars on start - Whether to wake sleeping cars on Home Assistant startup. This allows a user to choose whether cars should continue to sleep (and not update information) or to wake up the cars potentially interrupting long term hibernation and increasing vampire drain.
- Polling policy - When do we actively poll the car to get updates, and when do we try to allow the car to sleep. See the Wiki for more information.
- Sync Data from TeslaMate via MQTT - Enable syncing of Data from an TeslaMate instance via MQTT, essentially enabling the Streaming API for updates. This requires MQTT to be configured in Home Assistant.
Here are some things to consider and understand when implementing the Tesla component and its potential effect on your car's battery.
- The
polling_interval
determines when to check if the car is awake and new information is available, but the Tesla integration will not wake up a sleeping car during this polling. By default, the polling will occur every 660 seconds. Polling a car too frequently can keep the car awake and drain the battery. Different firmware versions and measurements of Tesla cars can take from 11 to 15 minutes for sleep mode to occur. There is no official information on sleep mode timings so your mileage may vary and you should experiment with different polling times for an optimal experience. - The car will, however, be woken up when a command is actively sent to the car, such as door unlock or turning on the HVAC. It will then also fetch updated information while the car is awake based on the
polling_interval
. - The car can intentionally be woken up to fetch recent information by sending a harmless command, for example, a lock command. This can be used in an automation to, for example, ensure that updated information is available every morning. (Note that the command must be valid for that specific car model. So locking the frunk of a Model 3 will not wake up that car).
- You can also toggle the
polling switch
on/off to disable polling of the vehicle completely via automations or the Lovelace UI.
If you want to contribute to this please read the Contribution guidelines
Component built with integration_blueprint.