Tesla automation

Last updated 27-Feb-2024

Tesla have made extensuive changes to the 3rd party app access but thankfully also to the shortcuts that can be embedded in iOS and Android devices which means 3rd party apps are required less than they used to be.

We've created a video on iOS shortcuts and scheduling, and while this is not as flexible as our previous approach where you could embed our requests in a variety of tools, you can now only retrieve car data. That said, the data can still be used in an iOS routine for automation.

Why can I not call the Tesla API myself?

You can, the API is documented on the internet, however it is not that straightforward.

To execute a command such as start charging, the following steps are required:

To make life easier, we perform all these steps behind the scenes, youjust provide the refresh token and the request, optionally the car Id if you have multiple cars on the account (otherwise we default to the first car on the account) and then report back success or fail. If the request is for information, then we return the information in JSON format enabling the information to be used in other programmes.


Token generation

We have created a utility to generate a Tesla token. This utility uses a Tesla feature so we do not need your Tesla user name and password, and will return the Tesla token and the vehicle ID for each car on your account.

The only way to expire a refresh token is to change your password on MyTesla.

For the purposes of the examples below we will use [token] to represent the use of the API token, and [refresh] the use of the refresh token.

Command builder

You can generate your own command to get car data using the simple command builder below. We have removed support for sending requests as these are being retired by Tesla and replaced with a new approach which is more complicated and requires various approvals. Tesla are also leaving the door open to charge for the use of this approach and as we provide our services for freem this is not something we can sustain.

Tesla have started to reorder the cars on your account and it's now not always safe to assume the order if you have more than one car. While we will default to the first car on the account if no car is specified, and this is fine for accounts with only one car, it is prudent to provide the car id to be sure the right car is used when there are multiple cares on an account.

Finally, some of the commands are dependant on state, e.g. the heated steering wheel and heated seats require the HVAC to be turned on first.






Example of the results

We have created a fairly simple API which in practice just looks like a web page URL. The format for the API is as follows, which will work on the first car on your Tesla account (for most people this will be their only car on the account).

https://tesla-info.com/api/control_v3.php?refresh=[refresh]&request=get_data

An example of the response is:

{"car":"MyTeslaCarName", "response":{"battery_heater":false, "battery_heater_no_power":null, "climate_keeper_mode":"off", "defrost_mode":0, "driver_temp_setting":20.0, "fan_status":0, "inside_temp":8.7, "is_auto_conditioning_on":false, "is_climate_on":false, "is_front_defroster_on":false, "is_preconditioning":false, "is_rear_defroster_on":false, "left_temp_direction":906, "max_avail_temp":28.0, "min_avail_temp":15.0, "outside_temp":5.5, "passenger_temp_setting":20.0, "remote_heater_control_enabled":false, "right_temp_direction":897, "seat_heater_left":0, "seat_heater_rear_center":0, "seat_heater_rear_left":0, "seat_heater_rear_right":0, "seat_heater_right":0, "side_mirror_heaters":false, "timestamp":1637933181574, "wiper_blade_heater":false}, "token":"qts-abcdefghijklmnopqrstuvwxyz"}

Tesla API tokens expire every few hours and as a result we now require the refresh token. Once provided, we will maintain a working API token which we will use on receipt of the same refresh token. After the first successful request, you can just provide the end of the refresh token, at least 100 characters, which we will use to match to the refresh token. This avoids you needing to store or resend the full refresh token each time. If we do not achieve a match, we will not execute amy commands.

If at any time you feel your phone or security has been compromised, or ours, visit tesla.com and change your Tesla password.

tesla-info on facebook Contact tesla-info on linkedin tesla-info on twitter tesla-info on youtube tesla-info on Discord

By using our site, you acknowledge that you have read and understand our Privacy and Cookie Policy. Your use of the tesla-info website is subject to these policies and terms. All data is provided on a reasonable endeavours basis but errors and omissions may exist. No data should be relied upon as being accurate and additional checks should be made if the information is material to any purchase or use of the car.
Ways you can support tesla-info