Tesla Automation Thread

  • SUPPORT THE SITE AND ENJOY A PREMIUM EXPERIENCE!
    Welcome to Tesla Owners Online, four years young! For a low subscription fee, you will receive access to an ad-free version of TOO. We now offer yearly memberships! You can subscribe via this direct link:
    https://teslaownersonline.com/account/upgrades

    SUBSCRIBE TO OUR YOUTUBE CHANNEL!
    Did you know we have a YouTube channel that's all about Tesla? Lots of Tesla information, fun, vlogs, product reviews, and a weekly Tesla Owners Online Podcast as well!

eXntrc

Well-known member
Joined
Jan 13, 2019
Messages
343
Location
Houston, TX
Country
Country
Tesla Owner
Model 3
#1
I would like to use this thread as a place to collect valuable apps, scripts and tools we've found to automate our Teslas. Whenever a post gathers a lot of interest it will get linked to here at the top. That way the most popular automations will be easy to find, no matter how long the thread gets.

There are many different ways to automate our Teslas and each option requires a varying degree of effort. For simplicity, I've chosen to group automations into one the following categories:


Built-In

These automations are built-in and are easy to find. There are very few options in this category, but the ones that are included are still quite valuable. In this category I include things like:

  • Precondition the vehicle using the Tesla app, even when we're not in the car.

Prebuilt

These automations are easy to use but you need to know where to find them. You'll find more options in this category, and they too are valuable, but we're still limited to the capabilities that each developer chooses to provide in their app. In this category I include things like:


Some Code Required

This is where we start to see of the most unique and often most valuable automations. While extra effort is required, the learning curve tends to not be as bad as it initially seems and the rewards usually outweigh the challenges. Examples in this category include:

  • iOS Shortcuts - An scripting system that can control many things, Tesla being one of them. There's already an extensive thread on this tool here in the forums.
  • Auto HVAC - Automatically heat or cool the car based on the temperature outside.
  • Drive Mode - Automatically start Spotify, Waze and voice texting simply by getting in the vehicle. Shut them down when you leave too.
  • Auto Navigate - Synchronize Tesla navigation with Waze on the phone. Navigate to destinations automatically based on the time of day.

I will post sample scripts shortly for the automations I've listed above. In the meantime, what tools do you use to automate your Tesla?
 
Last edited:

eXntrc

Well-known member
Joined
Jan 13, 2019
Messages
343
Location
Houston, TX
Country
Country
Tesla Owner
Model 3
#2
Auto HVAC

About


This automation uses Tasker to automatically heat or cool the vehicle based on the current temperature outside.

For this to automation to work you'll need:
To make it easier to understand and maintain, this script was split into 3 parts which you can download here:
IMPORTANT 1: Install Tasker on your phone first, then click those links above on your phone to automatically import the scripts into Tasker.
IMPORTANT 2: The scripts above use a variable called %TeslaName to know the name of your vehicle. You must create this variable and set it to your own vehicle name before these scripts will work. This video shows you how:

How to set Tasker Vars

Installation
  1. Install the software listed above including Tasker
  2. Import the 3 tasks linked above
  3. Run Weather ACE at least once to configure your location
  4. Set your vehicle name in the %TeslaName variable (see video above)
  5. (Optional) Add the Tesla - HVAC Auto command to your notification center using Tasker -> Preferences -> Notification Action Buttons

Code Walk Through

Here's a walk through of how these scripts work. First, let's take a look at HVAC - Heat.

task-tesla-hvac-heat-png.22557


  1. Use Text-To-Speech to say "Heating <Car Name>".
  2. Flash the same text we're speaking on the screen.
  3. Use the Tesla plugin for Tasker to actually set the temperature in the car. (I set it to 74 but you can easily change it to whatever you find comfortable).
  4. Use the same plugin to turn on the seat heater (I only turn it on for the driver but you can easily change it).
  5. When the Tesla plugin completes (meaning the car has accepted the command), say and show "<Car Name> is heating".

HVAC - Cool is very similar

task-tesla-hvac-cool-png.22558


The last part is the magic that chooses which one to run. That's handled by HVAC - Auto:

task-tesla-hvac-auto-png.22559


I chose Weather ACE because it's super easy to use within Tasker. You do need to have the Weather ACE app installed on your phone and you need to run it at least once to select your location. After that you never have to run the app again, but I rather like the interface.

Finally, notice that if the temperature is already in a comfortable range neither Heat or AC get run. Instead it simply says "Climate is already comfortable".
 
Last edited:

MelindaV

☰ > 3
Moderator
Joined
Apr 2, 2016
Messages
10,427
Location
Vancouver, WA
Country
Country
Tesla Owner
Model 3
#3
I would like to use this thread as a place to collect valuable apps, scripts and tools we've found to automate our Teslas. Whenever a post gathers a lot of interest it will get linked to here at the top. That way the most popular automations will be easy to find, no matter how long the thread gets.

There are many different ways to automate our Teslas and each option requires a varying degree of effort. For simplicity, I've chosen to group automations into one the following categories:


Built-In

These automations are built-in and are easy to find. There are very few options in this category, but the ones that are included are still quite valuable. In this category I include things like:

  • Precondition the vehicle using the Tesla app, even when we're not in the car.

Prebuilt

These automations are easy to use but you need to know where to find them. You'll find more options in this category, and they too are valuable, but we're still limited to the capabilities that each developer chooses to provide in their app. In this category I include things like:


Some Code Required

This is where we start to see of the most unique and often most valuable automations. While extra effort is required, the learning curve tends to not be as bad as it initially seems and the rewards usually outweigh the challenges. Examples in this category include:

Auto HVAC - Automatically heat or cool the car based on the temperature outside.
Drive Mode - Automatically start Spotify, Waze and voice texting simply by getting in the vehicle. Shut them down when you leave too. (Post coming shortly)
Auto Navigate - Synchronize Tesla navigation with Waze on the phone. Navigate to destinations automatically based on the time of day. (Post coming shortly)



I will post sample scripts shortly for the automations I've listed above. In the meantime, what tools do you use to automate your Tesla?
don't forget Siri Shortcuts with an extensive thread already
 

eXntrc

Well-known member
Joined
Jan 13, 2019
Messages
343
Location
Houston, TX
Country
Country
Tesla Owner
Model 3
#5
Drive Mode

About


More Tesla automation using Tasker. This time, "Drive Mode".

When the user enters the vehicle:
  1. Spotify starts (if it wasn't already running)
  2. Spotify resumes playback
  3. A hands-free texting app called Drivemode is started
  4. Waze automatically opens

When the user exits the vehicle:
  1. Spotify is paused
  2. Waze closes
  3. Drivemode shuts down

For this to automation work you'll need:

This script is split into two parts which can be downloaded here:

IMPORTANT 1: Install Tasker on your phone first, then click those links above on your phone to automatically import the scripts into Tasker.

Installation
  1. Install the software listed above including Tasker
  2. Import the 2 Tasks linked above
  3. Trigger Drive Begin to run when the vehicles Bluetooth connects.
  4. Trigger Drive End to run when the vehicles Bluetooth disconnects.

Code Walk Through

These two scripts are heavily self-commented using Taskers 'Label' feature. In the screenshots below, look at the dark grey bars to understand what's happening at that line.

Drive Begin:

task-drive-begin-png.22560


Drive End:

task-drive-end-png.22561


The %AutoNav variable on Line 1 is used for AutoNav, which I'll be posting about soon.

Interestingly Android doesn't allow apps to 'kill' other apps unless your phone is rooted. This is why I'm not using the Tasker 'kill' command to close Waze. Instead we have to send an Android intent that Waze is listening for and will shut down when the intent is received.

The final piece is getting these two tasks to run at the right time. In Tasker we do this on the first tab in the app: Profiles.

  1. Make sure your phone has already been paired with the car.
  2. In Tasker, on the Profiles tab tap the + button at the bottom of the screen.
  3. Tap on the State trigger
  4. Tap on the Net state
  5. Tap on BT Connected
  6. Next to the Name field, tap the magnifying glass then choose "Tesla Model 3" (or whatever your Tesla is named)
  7. Tap the Android Back arrow
  8. A task list pops up. Choose the Drive Begin task.

Here's what it looks like when configured correctly:

profile-drive-begin-png.22562


For Drive End the steps are the same but we need to INVERT the Bluetooth connection.

  1. Make sure your phone has already been paired with the car.
  2. In Tasker, on the Profiles tab tap the + button at the bottom of the screen.
  3. Tap on the State trigger
  4. Tap on the Net state
  5. Tap on BT Connected
  6. Next to the Name field, tap the magnifying glass then choose "Tesla Model 3" (or whatever your Tesla is named)
  7. CHECK THE INVERT CHECKBOX
  8. Tap the Android Back arrow
  9. A task list pops up. Choose the Drive End task.

Here's what it looks like when configured correctly:

profile-drive-end-png.22563


That's it. Everything should run automatically whenever you enter or exit the car.
 
Last edited:

eXntrc

Well-known member
Joined
Jan 13, 2019
Messages
343
Location
Houston, TX
Country
Country
Tesla Owner
Model 3
#6
Auto Nav

About


This time we'll use Tasker to route the Tesla navigation and Waze on the phone to the same destination at the same time. Even better, we can do the routing automatically just by getting in the car at a certain time of day.

For this to work you'll need:


This is all accomplished using a single script, which you can download here:

An example of how to call this script can be downloaded here:

IMPORTANT 1: The address must be fully qualified including City, State and Zip (in the US). Favorite names do not work due to a limitation of the Tesla navigation API.

IMPORTANT 2: The 'Auto Nav' script uses several variables. Those variables are described below and you must create these variables before the script will work. This video shows you how:

How to set Tasker Vars


Installation
  1. Install the software listed above including Tasker
  2. Import the Tesla - Auto Nav Task linked above
  3. (Recommended) Import the Nav Home Task linked above
  4. Set your vehicle name in the %TeslaName variable (see video above)
  5. Set your home address in the %HomeAddress variable (see video above)
  6. Set the %NavPromptTimeout variable to the number of seconds you'd like to wait for the user to confirm navigation before it's automatically cancelled
  7. Set the %NavPromptWait variable to the number of seconds you'd like to wait after the car is started before the user is prompted for navigation (this can be zero seconds)
  8. (Optional) Add the Nav Home Task to your notification center using Tasker -> Preferences -> Notification Action Buttons

Below is a photo of what the variables look like after they've been configured. %NavConfirm and %NavAddress may change each time, but the other variables are usually only set once.

vars-png.22564



Code Walk Through

The main guts of the automation are in the Tesla - Auto Nav script, but something needs to tell Auto Nav where to route. That's where the %NavConfirm and %NavAddress variables come into play.

In fact, here's a picture of the Nav Home script, which basically just sets these variables.

task-nav-home-png.22565


Here we're setting %NavAddress to another variable %HomeAddress. But %NavAddress can be set to any fully formed address (including City, State and Zip). Unfortunately Tesla favorite names do not work due to a limitation of their API.

After the variables are set, we simply call Tesla - Auto Nav to do the work. Let's take a look at that script:

task-tesla-auto-nav-png.22566


This is a little long, but basically what we do is speak the confirmation prompt and show the user a Yes / No menu.

If the user selects Yes, we send the address on to Tesla using the Tesla plugin and send the same address to Waze using an Intent that Waze is listening for.

If the user selects No, we just speak the words "Navigation canceled".

Finally, we set a variable %AutoNavResult to either true or false in case some other script wants to know what the user chose.


This last part is optional but it's super powerful. As we showed in the Drive Mode automation, we can have tasks run automatically whenever the user gets in the car. We can also add conditions like "but only on these days" and "only during these times". With this in place you can set the car to automatically navigate to common destinations simply by getting in the car.

Here's an example:

profile-kids-dropoff-png.22567
 
Last edited: