Posts Scriptable Shortcuts

Tesla Shortcuts and Scriptable Widgets

Despite my keen interest in iOS automation apps like Shortcuts, I must admit that I hadn’t spent any meaningful time with Scriptable, a powerful automation app that uses JavaScript. It’s far more versatile than Shortcuts though requires knowledge and experience with JavaScript to really take advantage of it.

Scriptable popped up on my radar not long after the release of iOS 14 due to its rich support for widgets. Scripts have complete control over the widget’s appearance and can present whatever information you’d like. Scriptable even refreshes widgets in the background so they can be kept up-to-date.

I recently purchased a Tesla Model 3 and have been tinkering with the Tesla API in Shortcuts. (Although this is Tesla’s API, it’s not officially available to third-parties. The Tesla community has been reverse-engineering and documenting it for years). This was also a good opportunity to learn more about Scriptable.

I’ve created a set of shortcuts to to control and get details about my Tesla, along with some Scriptable widgets to provide at-a-glance information on my iPhone’s home screen.

Tesla’s API requires an access token for authentication. One of the shortcuts generates this token using your Tesla login credentials, then saves it to iCloud Drive for all shortcuts to reference. Your password is not saved at any point and is only used to create the token with Tesla‚Äôs API.

One notable feature of both the shortcuts and scripts is that, where necessary, it automatically converts distance and temperature based on your car’s preferred units of measurement. Tesla’s API uses miles and Celsius, an oddly British combination of metric and imperial, so any conversion is done for kilometers and Fahrenheit automatically.

I plan to spend more time with Scriptable and have set up a GitHub repository for my scripts.