Have events in your Google Calendar execute commands on your Tesla car.
(c) 2016 by Lourens Rozema
This is a python program that checks your Google Calendar for events and once the time passes an event it will execute the corresponding command on your Tesla car. This allows amongst others to turning on the airconditioning before departing based on your calendar.
- Download the repository zip file and uncompress it.
- Download and install https://github.com/gglockner/teslajson
- Go to https://developers.google.com/google-apps/calendar/quickstart/python and execute step 1, afterwards put the downloaded file as client_secret.json in the same directory as teslacal.py. Also install google-api-python-client according to step 2: pip install --upgrade google-api-python-client
- Finally create the file teslacal.cfg see below for details.
- And then start adding events in your Google calendar.
[tesla]
username = [email protected]
password = abc123
vin = YOURVINNUMBER
[google]
calendarId = primary
[email]
smtp = localhost
from = [email protected]
to = [email protected]
You have to specify your Tesla account login for connecting to your car. The VIN number is optional, if not specified the first car will be chosen.
When a command is succesfully executed the script will send you an e-mail about it. If you don't want e-mail then remove the email section.
The following events are supported:
- Tesla honk horn
- Tesla flash lights
- Tesla airco
- Tesla start airco
- Tesla stop airco
- Tesla charge
- Tesla start charging
- Tesla stop charging
The event text should be in the summary of the event. Repeated events are not yet supported. Make sure that the duration of the event is longer then the interval of your cronjob.
Finally have the script run from cron. The more often the cronjob executes the more accurate the events execution time will match the event start time. I suggest 5 minutes would be nice.
*/5 * * * * your-user cd ~/teslacal && python teslacal.py > /dev/null