Update 2021-02-01: It looks like Tesla have deprecated their authentication endpoint so these shortcuts won’t work for new users. I’m working to update the shortcuts to support Tesla’s new authentication flow. Existing users who have already generated token information can continue to use them until their access token expires.
A set of four scripts to use as widgets that provide at-a-glance information about your Tesla’s battery, security, climate, and trunk/frunk.
Setup and usage
These scripts use Tesla’s (unofficial) API to get information about your car. An access token is required for authentication when making these API requests, along with a specific car’s ID. The token is initially generated using your Tesla login credentials.
Scriptable updates widgets automatically in the background. The frequency of updates is handled by iOS and there’s no control over when this occurs. Every time a widget updates it has to wake the car from sleep. While this won’t significantly impact the battery, keep this in mind if you have concerns about vampire drain.
Getting an access token and car ID
The following shortcuts for the Shortcuts iOS app are used to generate an access token using your login credentials and to get the ID of your Tesla.
All shortcuts must be installed but you only need to run the Scriptable Widgets for Tesla shortcut (the others are run within the shortcut). I created these shortcuts as part of my Shortcuts for Tesla collection: a set of shortcuts to control and get information about your Tesla.
On its first run, the shortcut prompts for your Tesla login credentials so it can create the access token for your account. Your password is not saved at any point and is only used to create the token with Tesla’s API. The shortcut then gets the ID of your Tesla. If you have more than one Tesla associated with your account, the Tesla Car Select shortcut displays a list to select from.
These shortcuts are also used for my collection of Tesla shortcuts. You only need to install the above shortcuts once to use these Scriptable widgets or my other Tesla shortcuts.
Setting up the scripts
The shortcut formats the token and car ID as variables and copies them to the clipboard. For example:
const accessToken = 'token123'
const carId = '123id'
Paste this into each script so it can retrieve information about your Tesla.
Each script gets specific information about your Tesla from Tesla’s API and creates a widget for you to use on the home screen. You can also add these scripts to Siri and display them when making a Siri request.
The scripts automatically retrieves the name of your car and the unit of measurement it uses for temperature and distance. Tesla’s API returns celsius and miles units so the scripts automatically convert these for you.
Tesla battery status
Displays the battery level and estimated range of your Tesla in either miles or kilometers. Also displays the estimated charge time if the car is currently charging.
Tesla climate status
Displays the interior and exterior temperatures in either celsius or fahrenheit. Also displays the specified climate control temperature if the car is preconditioning.
Tesla security status
Displays the locked or unlocked status of the doors and whether Sentry Mode is on or off.
Tesla trunk and frunk status
Displays the open or closed status of the trunk and frunk.
- Added missing shortcut for configuration