Scriptable Widgets for Tesla

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.

You must install the Auth app for Tesla iOS app to generate this token. This app handles authentication using your Tesla credentials and provides it to these shortcuts. Your credentials are not stored anywhere. This access token does expire and the app will handle updating it. However, you will need to update the access token in your widgets when this happens (usually 45 days).

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 get the necessary access token using your login credentials. They also retrieve the car 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.

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.

Credits

My thanks to Tim Dorr for the unofficial Tesla API documentation and to Kim Hansen for Auth app for Tesla.

Changelog

  • 2021-03-28
    • Updated required shortcuts to use Auth app for Tesla iOS app to handle Tesla authentication. These shortcuts no longer handle token generation.
  • 2020-10-17
    • Added missing shortcut for configuration