https://github.com/alandtse/tesla

Tesla custom integration for Home Assistant. This requires a refresh token be generated by third-party apps to login.

https://github.com/alandtse/tesla

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.6%) to scientific vocabulary

Keywords

hacktoberfest home-assistant home-assistant-component integration tesla

Keywords from Contributors

spacy-extension packaging profiling transformers zeroconf service-discovery avahi bonjour data-profiling battery
Last synced: 5 months ago · JSON representation

Repository

Tesla custom integration for Home Assistant. This requires a refresh token be generated by third-party apps to login.

Basic Info
  • Host: GitHub
  • Owner: alandtse
  • License: apache-2.0
  • Language: Python
  • Default Branch: dev
  • Homepage:
  • Size: 1.75 MB
Statistics
  • Stars: 679
  • Watchers: 23
  • Forks: 114
  • Open Issues: 162
  • Releases: 111
Topics
hacktoberfest home-assistant home-assistant-component integration tesla
Created almost 5 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License

README.md

Tesla Custom Integration

GitHub Release GitHub all releases GitHub release (latest by SemVer) GitHub Activity

License

hacs Project Maintenance BuyMeCoffee

Discord Community Forum

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:

Installation

  1. Use HACS, in HACS > Integrations > Explore & Add Repositories search for "Tesla". After adding this https://github.com/alandtse/tesla as a custom repository. Skip to 7.
  2. 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).
  3. If you do not have a custom_components directory (folder) there, you need to create it.
  4. In the custom_components directory (folder) create a new folder called tesla_custom.
  5. Download all the files from the custom_components/tesla_custom/ directory (folder) in this repository.
  6. Place the files you downloaded in the new directory (folder) you created.
  7. Restart Home Assistant.
  8. Add the integration: Add Integration or in the HA UI go to "Settings" -> "Devices & Services" then click "+" and search for "Tesla Custom Integration".
  9. 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 Fleet API Proxy

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.

Usage

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 to heat_cool or off 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.

Options

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.

Potential Battery impacts

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.

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines

Component built with integration_blueprint.


Owner

  • Name: Alan Tse
  • Login: alandtse
  • Kind: user

GitHub Events

Total
  • Create event: 5
  • Release event: 3
  • Issues event: 49
  • Watch event: 82
  • Delete event: 4
  • Issue comment event: 219
  • Push event: 89
  • Pull request review comment event: 7
  • Pull request review event: 14
  • Pull request event: 28
  • Fork event: 12
Last Year
  • Create event: 5
  • Release event: 3
  • Issues event: 49
  • Watch event: 82
  • Delete event: 4
  • Issue comment event: 219
  • Push event: 89
  • Pull request review comment event: 7
  • Pull request review event: 14
  • Pull request event: 28
  • Fork event: 12

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 402
  • Total Committers: 55
  • Avg Commits per committer: 7.309
  • Development Distribution Score (DDS): 0.724
Past Year
  • Commits: 40
  • Committers: 14
  • Avg Commits per committer: 2.857
  • Development Distribution Score (DDS): 0.675
Top Committers
Name Email Commits
Alan D. Tse a****e@g****m 111
github-actions g****s@g****m 66
github-actions a****n@g****m 40
pre-commit-ci[bot] 6****] 31
InTheDaylight14 6****4 25
J. Nick Koston n****k@k****g 19
Michael Benz m****l@b****o 12
Carlin Hefner 5****o 11
shred86 3****6 10
ehendrix23 h****k@h****m 7
Dag Stuan D****n@g****m 7
Elliott Balsley 3****m 6
Stephen Jones s****s@r****m 5
dandelionclock y****n@g****m 4
Olen o****a@n****o 4
purcell-lab 7****b 3
Christian Güdel cg@d****h 2
Darren Jones 1****y 2
Emniroll 3****l 1
Doug Fultz d****z 1
DoloresHA c****2@g****m 1
Giovanni Iachello 6****o 1
Ian Brown i****n@c****m 1
Brian Gates b****s@g****m 1
Brett Adams B****7 1
Andy Allsopp a****p@g****m 1
semantic-release s****e 1
kevin brintnall k****t@r****t 1
gkwok1 5****1 1
functionpointer s****n@g****m 1
and 25 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 5 months ago

All Time
  • Total issues: 230
  • Total pull requests: 127
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 16 days
  • Total issue authors: 199
  • Total pull request authors: 34
  • Average comments per issue: 3.76
  • Average comments per pull request: 1.65
  • Merged pull requests: 85
  • Bot issues: 0
  • Bot pull requests: 7
Past Year
  • Issues: 46
  • Pull requests: 28
  • Average time to close issues: 4 days
  • Average time to close pull requests: 10 days
  • Issue authors: 45
  • Pull request authors: 10
  • Average comments per issue: 0.89
  • Average comments per pull request: 2.04
  • Merged pull requests: 14
  • Bot issues: 0
  • Bot pull requests: 2
Top Authors
Issue Authors
  • alandtse (4)
  • colmbuckley (3)
  • Nessy1970 (3)
  • mcolyer (3)
  • ChrisJ60 (3)
  • jherby2k (3)
  • i-am-shodan (2)
  • fcastilloec (2)
  • enoch85 (2)
  • baylanger (2)
  • bdr99 (2)
  • freshfieldx (2)
  • stepir (2)
  • Steve-gnome (2)
  • purcell-lab (2)
Pull Request Authors
  • alandtse (52)
  • pre-commit-ci[bot] (7)
  • bdraco (6)
  • ehendrix23 (6)
  • skipishere (5)
  • llamafilm (5)
  • dandelionclock (5)
  • flaviorighi (4)
  • mcc05 (3)
  • ddaddy (3)
  • ChrisJ60 (2)
  • resnostyle (2)
  • Megabytemb (2)
  • giachello (2)
  • arallsopp (2)
Top Labels
Issue Labels
triage (76) car (66) enhancement (36) help wanted (16) duplicate (12) powerwall (11) good first issue (10) bug (8) teslajsonpy (4) documentation (2) wontfix (2) authcaptureproxy (1) question (1)
Pull Request Labels
triage (3) car (3) dependencies (1)

Dependencies

.github/workflows/codeql.yml actions
  • actions/checkout v2 composite
  • github/codeql-action/analyze v1 composite
  • github/codeql-action/autobuild v1 composite
  • github/codeql-action/init v1 composite
.github/workflows/cron.yml actions
  • actions/checkout v2 composite
  • hacs/action main composite
  • home-assistant/actions/hassfest master composite
.github/workflows/lintpr.yml actions
  • amannn/action-semantic-pull-request v4 composite
.github/workflows/pull.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • actions/setup-python v1 composite
  • hacs/action main composite
  • home-assistant/actions/hassfest master composite
  • snok/install-poetry v1 composite
.github/workflows/push.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • actions/setup-python v1 composite
  • hacs/action main composite
  • home-assistant/actions/hassfest master composite
  • snok/install-poetry v1 composite
.github/workflows/semantic_release.yml actions
  • actions/checkout v3 composite
  • ad-m/github-push-action master composite
  • relekang/python-semantic-release master composite
  • svenstaro/upload-release-action v1-release composite
poetry.lock pypi
  • 133 dependencies
pyproject.toml pypi
  • python ^3.10
  • teslajsonpy ^3.7.2