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

Model S REST API

This site may earn commission on affiliate links.
Updated firmware from v7.0 (2.7.56) to v7 (2.9.12) Some new fields added:

CommandName=charge_state -- Added Fields
Added Field = charge_port_latch -- Observed value: "Engaged"
Added Field = charge_current_request -- Observed value: 40, 80, ... amps
Added Field = charge_current_request_max -- Observed value: 40, 80, ... amps
Added Field = managed_charging_active -- Observed value: true or false
Added Field = managed_charging_user_canceled -- Observed value: true or false
Added Field = managed_charging_start_time -- Observed value: null

CommandName=vehicle_state -- Added Fields
Added Field = car_type -- Observed value: "s"
Added Field = third_row_seats -- Observed value: "None"
 
It sounds like managed_charging is for utility demand response or fleet management, which could be pretty interesting (there are already fields for scheduled charging in charge_state - scheduled_charging*)

Have you had a chance to try related command names to see what might set the charge current?
 
Updated firmware from v7.0 (2.7.56) to v7 (2.9.12) Some new fields added:

CommandName=charge_state -- Added Fields
Added Field = charge_port_latch -- Observed value: "Engaged"
Added Field = charge_current_request -- Observed value: 40, 80, ... amps
Added Field = charge_current_request_max -- Observed value: 40, 80, ... amps
Added Field = managed_charging_active -- Observed value: true or false
Added Field = managed_charging_user_canceled -- Observed value: true or false
Added Field = managed_charging_start_time -- Observed value: null

CommandName=vehicle_state -- Added Fields
Added Field = car_type -- Observed value: "s"
Added Field = third_row_seats -- Observed value: "None"

Apologies, though search-fu is weak today. How did you enumerate these?

thanks, Mike
 
Being able to set the scheduled start time is great.

I want to write some code to set an intelligent stop charging time to stop my charging just before 7 am. This will require an input of expected charge rate. I may also want to adjust for temperature if it is below 5C.

Now I can do this by running a cron job at 1 am to set a scheduled start charging time. Previously I would have had to run a cron job that would actually start the charging.

So now my algorithm is:
Start charging time= 0700 - Temp Scaling Factor X (Final SoC - Current SoC) / Charge Rate
 
Apologies, though search-fu is weak today. How did you enumerate these?

thanks, Mike

In my interface, I have a list of the known fields. Whenever the firmware release changes the routine looks for dropped or added fields and creates a report.

The Observed values were added by hand after I looked at the results over a period of time. Other values are quite possible depending on your car model, options, etc.
 
Last edited:
I had this same issue. With the new APIs you need to POST a JSON object instead. POST /command/set_temps { driver_temp: 23.7, passenger_temp: 18.1 }

Thanks for your reply. Using your example, it now gives me a "globbing" error - unmatched brace. Tried with a variety of ways removing spaces, using quotes, etc. (using curl on command line). Any other suggestions?
 
POSTing as regular url encoded parameters in the body works fine for me.

Was unaware the api accepted json. You would probably need to set the content-type. Regular Urlencoded bodies work fine for me though in all the commands through the owners-api endpoint.
 
Had problems with this myself.. everything giving "LO" temp.

Read some JSON examples and ended up with needing (replace x´s with actual values):

For setting cabin temp, I use the following values in the HTTP "POST":

HTTP URL:
https://owner-api.teslamotors.com/api/1/vehicles/
xxxxxxxxxxxxxxxxx/command/set_temps

HTTP Header values:
"Content-Type": "application/json", "Accept": "application/json", "Content-Length": "42", "Authorization": "Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

HTTP Body:
{"driver_temp":"22","passenger_temp":"22"}
 
Updated firmware from v7.0 (2.7.56) to v7 (2.9.12) Some new fields added:

CommandName=charge_state -- Added Fields
Added Field = charge_port_latch -- Observed value: "Engaged"
Added Field = charge_current_request -- Observed value: 40, 80, ... amps
Added Field = charge_current_request_max -- Observed value: 40, 80, ... amps
Added Field = managed_charging_active -- Observed value: true or false
Added Field = managed_charging_user_canceled -- Observed value: true or false
Added Field = managed_charging_start_time -- Observed value: null

CommandName=vehicle_state -- Added Fields
Added Field = car_type -- Observed value: "s"
Added Field = third_row_seats -- Observed value: "None"
Are there any fields for seat heaters or steering wheel heater?