Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

How To: Automate Preheating/Cooling, Google Play Music (or others) starting automatically, etc!

This site may earn commission on affiliate links.
Last one. Sorry again for hijacking the thread. I just really wanted to share this work with those who would understand and appreciate it.


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
 
  • Informative
Reactions: Aellinsar
I think it's awesome that you used the cars outside temperature. I thought about this after I chose to use WeatherAce. I was going to switch to using the vehicle reported temperature, but then it dawned on me that my car is garage parked and it's an attached garage. So for me it would almost never trigger anything. But if you have the car parked outside, I agree that the cars reported outside temperature is a much better way of going about it.

I park in a garage while at home that is attached to the house but not heated or very insulated. However, the interior temperature of the car is a byproduct of it's immediate exterior temperature, regardless of being garage parked or not (and ignoring sun soaking heat, greenhouse effect). In fact, I would always rather use the vehicles exterior to determine hvac instead of the local weather because if the car is sitting in a garage that is 60 degrees and it's 30 outside of the garage, I don't necessarily need hvac to come on if my car is 60 degrees.
 
Hi this project sounds awesome and I am interested in setting this up, what I want is when get in the gar in the morning it should start Waze automatically and start the route to my work address (also its cool how you set it up the nav on the M3 also set to same address) and then when I exit the car the Waze should close and phone display turned off (I will have a dedicated phone in the dock all time), again when I return from work it should do the same for Home address.

To start I followed your instructions, installed all the apps, imported the script, then I try to set var and I don't see a full list like yours and not %teslaname too.

what am I doing wrong. (btw I am making use of an old spare nexus 4 phone and this phone is not the key)

Last one. Sorry again for hijacking the thread. I just really wanted to share this work with those who would understand and appreciate it.


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
 
Hey @balajeek glad you like the idea.

Unfortunately you have to create those variables manually. See this:

How to set Tasker Vars

How to trigger in tasker when I am in this location and when bluetooth is connected?

The states used to fire a trigger are additive. Like if you look at my screenshots for auto nav you can see that I have Bluetooth connected + time of day. If time of day isn't good enough you can use location. There are a couple of ways of doing this but I recommend a plug-in called AutoLocation. It costs a couple bucks but it let's you define unlimited geofences. You can trigger when entering or exiting a geofences and you can use "in fence" as a condition like the time condition I mentioned above.
 
Thanks, I figured out later and see how powerful this automation can be and also wonder why not much attention to this thread considering the things you can do automate everyday tasks.

Unfortunately the spare Nexus 4 phone I had and setup for this automation broke (SIM card error) and I miss it already, since I use iPhone I started looking to automate using Shortcuts App + Siri, works okay but not powerful as tasker in android. Big disadvantage is the trigger missing in Shortcuts app (like triggering from Bluetooth connected/disconnect) so I have to ask Siri or button click on shortcut. still trying to figure out how to keep Sentry mode on always..

Hey @balajeek glad you like the idea.

Unfortunately you have to create those variables manually. See this:

How to set Tasker Vars



The states used to fire a trigger are additive. Like if you look at my screenshots for auto nav you can see that I have Bluetooth connected + time of day. If time of day isn't good enough you can use location. There are a couple of ways of doing this but I recommend a plug-in called AutoLocation. It costs a couple bucks but it let's you define unlimited geofences. You can trigger when entering or exiting a geofences and you can use "in fence" as a condition like the time condition I mentioned above.
 
Ah, thanks for sharing @balajeek. I've actually been hoping someone would talk about the differences between Tasker and Shortcuts. I appreciate you sharing that.

I too am curious why more people aren't interested in automation. I think maybe some feel like they might have to learn too much about coding, but that's just a guess. Tasker and Shortcuts are really easy to pick up, however, with no coding experience required. And I'd love to see more about how people automate their Teslas.

Hope you're able to find another replacement phone soon, or find a better way to trigger Shortcuts!
 
Auto Sentry

About

No video this time since nothing happens on screen, but this may be my favorite automation yet!

Why can't we have Sentry Mode always turn on when we leave the car? Maybe it has something to do with power consumption? Maybe it doesn't make sense to leave Sentry Mode on when parked in a garage?

This automation turns on Sentry Mode every time you leave the vehicle but aren't at home.

If you live in an apartment, park outside, or simply prefer to leave Sentry on all the time you can skip AutoLocation altogether.


For this to automation to work you'll need:
This script is very simple and can be download here:

IMPORTANT 1
: Install Tasker on your phone first, then click the link above on your phone to automatically import the script into Tasker.

IMPORTANT 2: The script above uses 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 this 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 task linked above
  3. (Optional) Run AutoLocation at least once and create a geofence for your house called 'Home'. If you want to learn how to use AutoLocation, check out their homepage here.
  4. Set your vehicle name in the %TeslaName variable (see video above)
  5. Trigger Tesla - Auto Sentry to run whenever you leave the car. (See below)

Code Walk Through

There is only one task and it's actually quite simple:

Tesla - Auto Sentry.png

  1. Use the Tesla Plugin for Tasker to turn on Sentry Mode.
  2. Say "Sentry On" to confirm that Sentry was enabled.

Now we just need to trigger the task whenever you leave the vehicle (Bluetooth disconnects). And if you only want it on when you're not at home, you can do this through a geofence check.

Drive - Park Away.png


Just make sure to specify the condition for outside the geofence rather than the default (which is inside):

AutoLocation - Away from Home.png


(You may also be able to leave it set to Inside the fence and then check the Invert box, but Outside made more sense to me and it may change how AutoLocation monitors the fence under the covers.)



Enjoy never having to remember to turn on Sentry Mode again!
 
Last edited:
Hi,
I have read this great thread and started automating my new M3 as well. I bought automagic and the tesla plugin. turning the AC on on workdays in the morning works great. also turning Sentry mode on while not at home.
I would also like to turn off my headlights while driving into my carport, because this shines a bright light into my own home and that of my neighbours. But then turn it on again to automatic when I leave my home.
Next to that I would also like to turn off automatic honking when my M3 locks after I exit the cars. But only when I am at home. all other places i would like to have it on.
Those two functions I have not yet found in the plugin for automagic, so the control of the headlights and the honking for auto locking. Are they available in the Tasker plugin for Tesla?
Finally I am looking for a quick way to unlock my charge port. I have a charging port at home, but it is not one of tesla. It does not have a button on the charging plug to stop the charging and unlock the charge port. So I have to use the tesla app to unlock the port, or go into my car and unlock it. I was thinking of using a command via google assistent to start an automation via automagic, or maybe Tasker.
Can anyone help me on this?
Would be great!
Thanks in advance
 
Unfortunately you can only automate the things of the car which Tesla provides an API for. The Tasker Plugin for Tesla controls every currently available function and lists them on the store page. Sadly, many of the things you want to do (turn off the lights or horn for example) cannot be accomplished because there is no API. The one thing you did mention that has an API is unlocking and opening the charge port. There is a plugin for Tasker called AutoVoice that lets you use voice commands to run tasks. You could create a voice command to open the charging port in this way. Sorry, I know that's not the answer you were hoping for, but I hope it helps point you in the right direction.
 
  • Informative
Reactions: Aellinsar
I bookmarked this thread a while back, but finally got around to using the tools provided. Many thanks! I had a Tasker routine for heating the car, but in spring, the need often switches between heating and cooling and it was nice to use this routine for automatically determining which one.
 
I just came upon this thread. Great stuff!

I'm about to start, but with some basic stuff like waking the car up in the mornings when I depart instead of me popping a door first. I use a juicebox and it doesn't have the wake up button that the Tesla chargers do.
 
I just came upon this thread. Great stuff!

I'm about to start, but with some basic stuff like waking the car up in the mornings when I depart instead of me popping a door first. I use a juicebox and it doesn't have the wake up button that the Tesla chargers do.

Cool. Yeah, you can use Tasker to wake the car on a schedule for sure. If you happen to be subscribed to TeslaFi you can do it with that as well, completely independent of your phone. Have fun!