Skip to content

JakobLichterfeld/Tesla_API_in_Tasker

Repository files navigation

Tesla API in Tasker

latest release donation

Access the Tesla API in Tasker (Android App)

This is a Tasker Profile to access the unofficial Tesla API.

The idea was born during discussing a feature request for TeslaMate

Screenshots

Tasks Tasks 2 Tasks 3 Tasks 4 Scenes

Table of contents

Security

Why not using Tasker Plugin for Tesla? You never know what a closed source application will do with your credentials :-)

So this Project is different. Access token is generated: asked for Tesla account data with Tasker scene, store data only in local variable to get access token from Tesla and than destroy local copy of access data.

Token will be refreshed when expires in 10 or less days.

Features

  • Token get/refresh (OAuth)
  • get vehicles
  • get vehicle
  • wake up
  • set sentry mode (true|false default:true)
  • door unlock
  • door lock
  • actuate trunk (rear|front default:rear)
  • honk horn
  • flash lights
  • media toggle playback
  • media next track
  • media prev track
  • media next fav
  • media prev fav
  • media volume up
  • media volume down
  • sharing
  • get climate state
  • set temps (driver temp, passenger temp default:20.5)
  • auto conditioning start
  • auto conditioning stop
  • set preconditioning max (true|false default:true)
  • set remote seat heater request (heater=0..5, level=0...3 default:0=driver,3=max)
  • set remote steering wheel heater request (true|false default:true)
  • get charge state (return battery_level)
  • set charge limit (0...100 default:80)
  • set charge limit max range
  • set charge limit standard
  • charge port door open
  • charge port door close
  • charge start
  • charge stop
  • window control (close|vent default:close)
  • get drive state
  • remote start drive (will not be included, because current Tesla account password is needed, which is not stored)
  • upcoming calendar entries
  • set valet mode (true|false, password default:true,)
  • reset valet pin
  • speed limit activate (4DigitPIN default:4321)
  • speed limit deactivate (4DigitPIN default:4321)
  • speed limit set limit mph (50...90 default:50)
  • speed limit clear pin (4DigitPIN default:4321)
  • trigger homelink

Everything not yet included will be when my Tesla is connected to my account and I am able to test the tasks.

Dependencies

  • Tasker
  • AutoTools (can be removed with JavaScriplets to read JSON and removing AutoTools Text action)

Installation

Install Dependencies.

The easiest way is to open the Taskernet url on you Android Phone and press import.

If you prefer to install in manually: Import Tesla_API_in_Tasker.prj.xml on your Android Phone using Tasker, see Tasker-FAQs on how to import xml files. It is recommended to backup your data first.

Update

To update Tesla API in Tasker the same steps as described under Installation are necessary.

Usage

This project provides Tasker tasks to access the Tesla API. To use them in your own automation projects/tasks/profiles/scenes in Tasker just call the function: use the "Perform Task" Action in Tasker to call the desired function.

If parameters are needed the function name gives you a hint about what is needed. For example: "set temps (driver temp, passenger temp default:20.5)" --> this function accepts two parameters, driver temp and passenger temp. If both or one is not given, the default value is taken, in this case 20.5. To call the function with the parameters use the "Perform Task" action and use "Parameter 1" and "Parameter 2" for the parameters you want to set.

You only need to call the function you want, for example set temps (driver temp, passenger temp default:20.5). The Tesla API in Tasker project does take care of the token, wakeup and other preconditions. The task return true if it was successful and false if not.

Do not store your own automation tasks within the Tesla API in Tasker Project in Tasker to prevent data loss when updating Tesla API in Tasker.

Contributing

All contributions are welcome and greatly appreciated!

Donation

Maintaining this project isn't effortless, or free. If you would like to kick in and help me cover those costs, that would be awesome. If you don't, no problem; just share your love and show your support.

Donate with PayPal

Disclaimer

Please note that the use of the Tesla API in general and this software in particular is not endorsed by Tesla. Use at your own risk.