# TeslaTasks (was: Winter is coming)



## tbeernot (Oct 11, 2019)

Ok, even though game of thrones has stopped, it appears that winter is still coming this year. Last winter I wrote a simple application dubbed TeslaTasks that makes it possible to schedule heating (and charging) your Tesla from a Google calendar. Back then I needed testers, because the Tesla API turned out to be not impressively stable. But it seems things are stable now, so we can really unfreeze our cars coming winter. TeslaTasks  is free (as in beer), so if you like to stay in bed while your car is preheating...










I've created TeslaTasks initially just for myself, but the effort of making it usable for more people was not that big, so why not be a social human and share. Yes, registering requires trust by the owner of the car, and it is something that everyone needs to decide for him/herself if it is worth the risk. I have blogged about it, but it is what we have to live with, it simply is the way Tesla created their API. You can always temporarily change your password, and after registering with TeslaTasks change it back. Oh, Zac from now-you-know has tested it, and I still don't know his password.


----------



## Stach (Mar 27, 2019)

This looks like it could be very useful and easy enough to use. I will just have to keep a little cheatsheet handy for the proper commands. One quick question for you, but does this in any way contribute to phantom drain (I doubt that it does)? I use the Stats app and I recently enabled Background Refresh on it so that I could schedule charging, but that does appear to contribute some to phantom drain, so I'd prefer your app, so long that it does not.


----------



## tbeernot (Oct 11, 2019)

No, TT does not contribute to the fantom drain, because all is done on the Microsoft Azure cloud, until the time something needs to happen with your car; then TT reaches out and instructs your car to do something. But up until then your car can sleep (just like you ;-) ).


----------



## Stach (Mar 27, 2019)

I set this up tonight and it works very slick. Have you thought about adding other keywords / functions like:
- Window Venting (new v10 feature)
- Locking doors (night time protection)
- Heating specific seats (or at least the drivers seat)
- Turn on/off Sentry


----------



## tbeernot (Oct 11, 2019)

I've already added the charge keyword, heating seats would make sense, window venting also, but for the others I don't see a clear use case? The car automatically locks the door and enables sentry mode.


----------



## Stach (Mar 27, 2019)

tbeernot said:


> I've already added the charge keyword, heating seats would make sense, window venting also, but for the others I don't see a clear use case? The car automatically locks the door and enables sentry mode.


If somebody doesn't like the auto-lock feature, but would like to make sure that their car is locked at night, then they could setup a calendar entry to make sure that it's locked.

Similar scenario for Sentry Mode, I have Sentry configured not to turn on at home (in order to save battery), but at night it could be useful to turn it on (most crime happens at night) and then also turn it off in the morning after I'm awake.

In general, if you can add keywords for these commands, I'm sure there are use cases that would support them. If there aren't, then there's no harm either, but at least they are available as an option.

Thanks for listening and being so responsive.
Stach


----------



## Long Ranger (Jun 1, 2018)

Stach said:


> I have Sentry configured not to turn on at home (in order to save battery), but at night it could be useful to turn it on (most crime happens at night) and then also turn it off in the morning after I'm awake.


I do the same with Sentry Mode. Car is parked in my driveway, not garage. I don't want to record all the comings and goings in my driveway during the day, so I toggle Sentry Mode on every night.


----------



## tbeernot (Oct 11, 2019)

Well, I've added it to the to-do list. Won't be hard to add.


----------



## Stach (Mar 27, 2019)

tbeernot said:


> Well, I've added it to the to-do list. Won't be hard to add.


Excellent and looking forward to it!


----------



## Love (Sep 13, 2017)

tbeernot said:


> Ok, even though game of thrones has stopped, it appears that winter is still coming this year. Last winter I wrote a simple application dubbed TeslaTasks that makes it possible to schedule heating (and charging) your Tesla from a Google calendar. Back then I needed testers, because the Tesla API turned out to be not impressively stable. But it seems things are stable now, so we can really unfreeze our cars coming winter. TeslaTasks  is free (as in beer), so if you like to stay in bed while your car is preheating...
> 
> View attachment 29817
> 
> ...


Amazing work!


----------



## tbeernot (Oct 11, 2019)

Stach said:


> Excellent and looking forward to it!


You have to bear with me for a little bit, I'm in the process of "maturing up" the code base. Up until now it was "let's see if this works", well, it does. So I'm adding unit test to make sure things don't break when I add new features.


----------



## Stach (Mar 27, 2019)

That sounds great as I'm all for nice clean code. It would be interesting if you could post some simple statistics on your website as well, kind of like McDonald's old "xx billion served" (number of users and number of commands issued).


----------



## tbeernot (Oct 11, 2019)

Ah, that would be something totally at the bottom of the TODO list, but right now there are 31 cars in the system.


----------



## tbeernot (Oct 11, 2019)

Ok, you should now be able to set "sentry" in an appointment, which will enable and disable sentry mode.
And you should be able to specify "lock doors", which will lock the doors when the appointment starts.
You can combine instructions, so an appointment with "lock doors, sentry" should work fine. (I tested it of course)


----------



## Mike Ferris (Aug 7, 2016)

Am just trying now, good for you and many thanks!


----------



## Mike Ferris (Aug 7, 2016)

Just thought, I am also using TeslaFi.com which monitors my energy use. Could there be a conflict?


----------



## Mike Ferris (Aug 7, 2016)

Sorry to bug you,

Works beautifully thanks so much, are the titles CAP sensitive? So, add Sentry, just type - sentry? Charge 90%?


----------



## Mike Ferris (Aug 7, 2016)

Sorry, meant, case sensitive, as your T,t for temperature is.


----------



## tbeernot (Oct 11, 2019)

Mike Ferris said:


> Just thought, I am also using TeslaFi.com which monitors my energy use. Could there be a conflict?


No, both applications use their own access tokens, it only conflicts if they send commands at the same time.


----------



## tbeernot (Oct 11, 2019)

Mike Ferris said:


> Sorry to bug you,
> 
> Works beautifully thanks so much, are the titles CAP sensitive? So, add Sentry, just type - sentry? Charge 90%?


It should no longer be case sensitive, it was before, but I've rewritten the recognition code a few days back.

Considering adding conditions, something like "if-temp < 78" or "if-charge < 20%", so you can say "temp=85 if-temp < 78" (no idea if those value makes sense BTW :-D )
Still doubting if conditions add value, and what the best notation would be.


----------



## Mike Ferris (Aug 7, 2016)

Know what you mean, but not sure if they would be useful. 
Living in Montreal with the occasional -30C, we have to heat the battery up for about an hour before driving (well, we don't have to, but better for the battery and good to loosen or get rid ice on the windows, unfreeze door locks etc. ). Been trying out at 4C, exterior, 26C interior. Using TT, I run for an hour and lose 10% of the battery. Not sure yet if car is on charge (but fully charged, so not charging) whether charger will automatically come on. I should find out by Wednesday. If not a TT command would be useful here so as to maintain max. daily trip range.


----------



## tbeernot (Oct 11, 2019)

Ah, Canada, then we can talk sensible units  
Yes, when it is freezing enough, an hour of preconditioning is needed indeed. And since I go from bed to car in under 30 minutes in the morning, you see the reason I created TT ;-)


----------



## Mike Ferris (Aug 7, 2016)

LOL! Yes. Your reason, absolutely. In the last 5 years we have hit -53C in the morning, colder than Alaska. Climate change is hitting many places, the Netherlands I think is ahead of the scale, spent a lot time there in the '70's, my first girlfriend!


----------



## Needsdecaf (Dec 27, 2018)

Does anyone seem to think that "regen limited" is more aggressive than it used to be? Meaning it kicks in when the weather is warmer than last winter? 

Reason I ask is down here in temperate Houston, we've only had one "cold" spell, and temps were down in the high 30's. It's warmed up since then. Over the weekend, I got in the car and noticed I had limited regen even though the temp was about 60. This was Saturday night and I hadn't used the car since Friday night. Charging was done sometime around midnight on Friday night, so it had a good long time to soak in the cold. But I can't recall seeing limited regen until temps were much colder last year. 

Also was surprised that even though it was 60, and that I drove about 10 miles, by the time I got home, I still had limited regen.


----------



## Stach (Mar 27, 2019)

*tbeernot*, your TeslaTasks is still working great and has been extremely useful to precondition my car now that winter has been around for a while. I've got another request that I'm hoping TeslaTasks can provide. I like to keep my Model 3 sitting with a charge around 50-60%. That way I still have enough juice to get around in an emergency or drive to the nearest supercharger if need be, however ideally, before use I would precondition the car by charging and warming to 80%, so that I get better regen.

My hope is that very much like setting an initial temperature with a fallback, but for charging. I'd like to set an initial charge value of say 80%, but have it automatically set back to 50% when the calendar entry ends, like with the following command.

Charge 80% End 50%

This way, when I plug back in after my trip, I don't have to remember to set the charger back to 50% from the 80% that I charged it to earlier.

Thanks in advance for listening and let me know what you think.


----------



## tbeernot (Oct 11, 2019)

Stach said:


> *tbeernot*, your TeslaTasks is still working great and has been extremely useful to precondition my car now that winter has been around for a while. I've got another request that I'm hoping TeslaTasks can provide. I like to keep my Model 3 sitting with a charge around 50-60%. That way I still have enough juice to get around in an emergency or drive to the nearest supercharger if need be, however ideally, before use I would precondition the car by charging and warming to 80%, so that I get better regen.
> 
> My hope is that very much like setting an initial temperature with a fallback, but for charging. I'd like to set an initial charge value of say 80%, but have it automatically set back to 50% when the calendar entry ends, like with the following command.
> 
> ...


Actually I already had been thinking about that, but was still undecided on the notation. Preconditioning uses T= and TA= (or Temp and TempAfter), I find that notation not ideal. But I want to keep the same style for precond and charge. So I was considering

*charge 80%/50%* and *precond 25/21*, but that may not be very obvious.
*charge 80% end 50%* and *precond 25 end 21* is what you suggest, also not really obvious what that means.

How about:
charge 80% then 50%?
charge 80% afterwards 50%?
charge 80% at end 50%?
charge 80% then set 50%?
charge 80% afterwards set 50%?

What do you think?


----------



## Stach (Mar 27, 2019)

tbeernot said:


> What do you think?


Thanks for listening and it's great that we were having the same thoughts. My choice would be for something simple yet obvious, so of the ones you mentioned, I like the following:

*charge 80% then 50%* (It's simple and it sounds the most like a logical expression)
charge 80% at end 50% (I'm biased as it's most like what I had in mind) 

I look forward to test / use whatever new phrase you decide upon for this.


----------



## tbeernot (Oct 11, 2019)

Stach said:


> *charge 80% then 50%* (It's simple and it sounds the most like a logical expression)
> 
> I look forward to test / use whatever new phrase you decide upon for this.


Well, give it a shot... then. 

I have not put it in the documentation yet, so we can still change it if we find a better word. "then" means "after that", so it seems to be a good choice. But OTOH it's not really "after that" but "at the end of the appointment", which would make "at end" better. Hard to decide, so I went for the simplest version for now. But are there any other "at" things one could say as an instruction?


----------



## Stach (Mar 27, 2019)

I've got it all setup for my first trip later today and thanks for the fast response! I'll see if I can come up with anything for AT, but nothing comes to mind.

I couldn't see it in this post or your manual, so did you ever create commands for the Heated Seats? I think it would be handy to have separate commands for heating just the seats and setting the temperature and heating the seats in the same calendar entry. "Unfortunately" there are lots of heated seat choices, so starting with the drivers seat would be best / easiest, but you could also denote which seat to heat as follows and the level of heat to set:
<Car Front>
LF RF
LR MR RR
<Car Rear>

1 = Low
2 = Mid
3 = High (Same as what Tesla indicates in the graphic)

Heat Seat LF2 RF3 (would heat both of the Front seats, Left to 2 and Right to 3)

Thoughts?


----------



## tbeernot (Oct 11, 2019)

Stach said:


> did you ever create commands for the Heated Seats?


No, same issue, a good API, and also that it does not really contribute much in getting the car ready to drive. I'm seeing heated seats as a true comfort function, and if the car is warm already, do not contribute much. The new "defrost" function is much more interesting  I'll give your suggestion some thought.


----------



## Stach (Mar 27, 2019)

tbeernot said:


> No, same issue, a good API, and also that it does not really contribute much in getting the car ready to drive. I'm seeing heated seats as a true comfort function, and if the car is warm already, do not contribute much. The new "defrost" function is much more interesting  I'll give your suggestion some thought.


For me, it's about getting the car as ready as possible for a reduced range winter drive (preconditioning), without using the battery. I would guess that our lower temperatures are similar and I don't have a heated garage (I've been thinking about getting it insulated). When I climb into my Model 3 after it's been sitting in the garage at -10 C, it's great for it be lightly warmed, with a nice warm seat, so that I can get the best range possible.

Thanks for listening and hopefully my explanation makes sense.


----------



## tbeernot (Oct 11, 2019)

Stach said:


> For me, it's about getting the car as ready as possible for a reduced range winter drive (preconditioning), without using the battery. I would guess that our lower temperatures are similar and I don't have a heated garage (I've been thinking about getting it insulated). When I climb into my Model 3 after it's been sitting in the garage at -10 C, it's great for it be lightly warmed, with a nice warm seat, so that I can get the best range possible.
> 
> Thanks for listening and hopefully my explanation makes sense.


I still think that it does not really make a difference, especially since the heated seats and steering wheel heat up so quickly, but I started to take a look at the API. Turns out you can not activate the heated seats independently, only as part of the preconditioning. Should activating a heated seat also activate the precond? I do not think users will expect that. Then it means the heated seats are an option to precond.

The API style you suggest with FL2 is a bit technical, suited for IT guys, I'm more inclined towards something like "driver seat low". Longer but better readable. Or maybe two notations.


----------



## Stach (Mar 27, 2019)

Here's what I noticed and received from charging yesterday. I set the following calendar entry to Charge to 85% and then fall back to 50%

*CHARGE 85% Then 50%*

Charging start as expected with the following email received.

*...aka Bandit: charge level set to 85%, charging started*

Then about 10 minutes before I was planning to leave, I set the temperature to 68F with the following command:

*T=68 TA=67*

and received the following email

*...aka Bandit: temperature set to 68.0, AC started*

Both of the these worked flawlessly, but when each calendar entries time was up, the set back part of the command was not allowed to work, based upon this email that I received for each event.

*...aka Bandit: not in park (but in D), ignoring this event*

It looks like the commands were correctly entered by me, processed and sent by your program, but that Tesla does not allows neither the charge rate or temperature to be set through the API when the Tesla is in Drive.

Thoughts? Is this something that can be fixed or are we at the mercy of Tesla's API?

Another interesting thing to note is that I can set the charging level while driving, using either Tesla's iOS app or the Stats iOS app, which would suggest that this could be possible hopefully.


----------



## tbeernot (Oct 11, 2019)

Stach said:


> *...aka Bandit: not in park (but in D), ignoring this event*


No, this is the behavior of TeslaTasks; once the car is being driven I do not tamper with it. It would be strange that you just manually adjusted the temperature while driving, and then an appointment comes in and changes that. But for charging that maybe could be allowed. Will requires some rewriting though because now TT ignores any event if the car is being driven. OTOH charging usually is done while not driving; would you mind trying the charging thing without driving the car during?


----------



## Stach (Mar 27, 2019)

Thanks for the clarification and I definitely agree with you about the climate, but being able to automatically set the Charge percentage back while driving, is the killer feature for me, so that it's set to say 50%, when I get home and plug it back in. I will set a calendar entry now to charge it to 55% and then end at 50%, and will see how it handles that when I get home.


----------



## Stach (Mar 27, 2019)

Here's how my test charge went with it parked....just as you expected.

My calendar entry was, "*CHARGE 55% Then 50%*"

I received this via email when it started, "*...aka Bandit: charge level set to 55%, charging started*"

and I received this via email when it ended, "*...aka Bandit: charge level set to 50%, charging stopped*"

And this is how my Tesla looks in the Stats app afterwards, charged to 55% and set to a charge level of 50%, just like I wanted (except for the ability to do this while driving).


----------



## tbeernot (Oct 11, 2019)

Stach said:


> just like I wanted (except for the ability to do this while driving).


Great. I'll look into refactoring the process to allow certain steps to be executed while driving. But not today; I'll be replacing the floor in my home office with a heated one. Snuggly warm feet ahead! :-D


----------



## Stach (Mar 27, 2019)

tbeernot said:


> Great. I'll look into refactoring the process to allow certain steps to be executed while driving. But not today; I'll be replacing the floor in my home office with a heated one. Snuggly warm feet ahead! :-D


That sounds great and I can't wait to try it out. I work from my home office as well, which is in the basement, so I can definitely appreciate how a warmer floor would be great. Best of luck with your project and enjoy the warmer feet!!!


----------



## tbeernot (Oct 11, 2019)

Give it a try; only set chargelevel is allowed when not in park.


----------



## Stach (Mar 27, 2019)

tbeernot said:


> Give it a try; only set chargelevel is allowed when not in park.


Awesome and I have a calendar entry already setup to test it tonight.

Thanks for the update!


----------



## Stach (Mar 27, 2019)

Stach said:


> Awesome and I have a calendar entry already setup to test it tonight.


My plans changed tonight, so no testing was done. I'll let you know how it works when I try it in the next couple of days.


----------



## Stach (Mar 27, 2019)

I tested it over lunch today and your update worked just as expected (charged to 80% and then set the charge rate back to 50% while I was Driving). Thanks again for listening and the efficient / excellent work on TeslaTasks!


----------



## tbeernot (Oct 11, 2019)

Stach said:


> I tested it over lunch today and your update worked just as expected (charged to 80% and then set the charge rate back to 50% while I was Driving). Thanks again for listening and the efficient / excellent work on TeslaTasks!


Ok! I was quite curious if it would accept commands while driving. It was a restriction I've build in TT from day one, so I never tested anything while driving.


----------



## Stach (Mar 27, 2019)

Unfortunately the charging fallback didn't work the next time I tried it (yesterday). It started charing right on time to 85%, but then I never received a notification that it was being set back to 50% and the charge level did indeed stay at 85%, long after the calendar entry had completed.


----------



## tbeernot (Oct 11, 2019)

Stach said:


> Unfortunately the charging fallback didn't work the next time I tried it (yesterday). It started charing right on time to 85%, but then I never received a notification that it was being set back to 50% and the charge level did indeed stay at 85%, long after the calendar entry had completed.


I've just tested it myself and it worked correctly.


----------



## Stach (Mar 27, 2019)

Just a quick update, I've used the command to fallback after charging successfully 2 times now. The only time I had an issue I may have created the calendar event within a couple of minutes of it activating, so maybe that was a possibility for my issue.


----------



## Gabzqc (Oct 15, 2016)

@tbeernot
Thanks for making such a great little program for us to use! 
Today I changed my tesla account password and the system stopped working, how do I update my details?

on the website, the REGISTER! link is dead...

Thank you!


----------

