Coder Social home page Coder Social logo

timdorr / tesla-api Goto Github PK

View Code? Open in Web Editor NEW
2.0K 133.0 530.0 965 KB

🚘 A Ruby gem and unofficial documentation of Tesla's JSON API for the Model S, 3, X, and Y.

Home Page: https://tesla-api.timdorr.com/

License: MIT License

Ruby 99.41% API Blueprint 0.59%
tesla ruby api car iot

tesla-api's Introduction

Referrals are back! Need a vehicle to test with? Get a Tesla with free supercharging

Do you work at Tesla? Get in contact! I'd love to help with making this API official.

Tesla JSON API

View Documentation

This is unofficial documentation of the Tesla JSON API used by the iOS and Android apps. The API provides functionality to monitor and control the Model S (and future Tesla vehicles) remotely. The project provides both a documentation of the API and a Ruby library for accessing it.

If any folks at Tesla are reading this, I'd love to help coordinate a developer program for your APIs. If there's any way I can be helpful, please feel free to get in contact. Also, I'd love to be in the beta firmware program 😉

Ruby Gem Gem Version Build Status

This gem provides a basic wrapper around the API to easily query and command the car remotely. It also provides access to the streaming API and a means to process data coming from it.

Installation

Add this line to your application's Gemfile:

gem 'tesla_api'

Or install it yourself:

gem install tesla_api

Usage

Here's a quick example:

require 'tesla_api'

tesla_api = TeslaApi::Client.new(email: email, client_id: client_id, client_secret: client_secret)
tesla_api.login!(password)
# Or if you have an access token:
tesla_api = TeslaApi::Client.new(access_token: access_token)

model_s = tesla_api.vehicles.first # => <TeslaApi::Vehicle>

model_s.wake_up
vehicle_data = model_s.vehicle_data
model_s.auto_conditioning_start unless vehicle_data["climate_state"]["is_auto_conditioning_on"]

model_s.set_charge_limit(90)
model_s.charge_start

charge_state = vehicle_data["charge_state"]
puts "Your Model S is #{charge_state["charging_state"]} " +
     "with a SOC of #{charge_state["battery_level"]}% " +
     "and an estimate range of #{charge_state["est_battery_range"]} miles"

Copyright

Ruby portions are Copyright (c) 2014-Present Tim Dorr. Released under the terms of the MIT license. See LICENSE for details.

tesla-api's People

Contributors

apearson avatar bricesanchez avatar callump01 avatar core-hacked avatar cyu avatar da3210 avatar ferbass avatar gaphi avatar jankeesvw avatar jasminsehic avatar jaxonwright avatar jonahwh avatar jonasman avatar jor-dan avatar josephpage avatar karekaa avatar kikobeats avatar lexnastin avatar markusharmsen avatar mdczaplicki avatar purcell-lab avatar ramonsmits avatar rcdiy avatar rickyromero avatar scottrobertson avatar shred86 avatar sjhill01 avatar tdorssers avatar timdorr avatar zeusf1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tesla-api's Issues

Mistake on my part..

Yesterday, using Swift to make a mac application with the API, everything was fine and i could login normally, but today, i keep getting this response from the server, even though my username and password are correct.
Status = "401 Unauthorized"; "Www-Authenticate" = "Bearer realm=\"Doorkeeper\", error=\"\", error_description=\"translation missing: en.doorkeeper.errors.messages\"";

I've checked for errors in the code, but it's fine as far as i can tell..

<NSHTTPURLResponse: 0x618000026a80> { URL: https://owner-api.teslamotors.com/oauth/token?grant_type=password&client_id=e4a9949fcfa04068f59abb5a658f2bac0a3428e4652315490b659d5ab3f35a9e&client_secret=c75f14bbadc8bee3a7594412c31416f8300256d7668ea7e6e7f06727bfb9d220&username=********@*****.***&password=**************** }

I also cannot access the access_token with the Apiary page, so my thoughts are that the client id and secret have been updated.

Thanks!

Updated API methods

I need some help documenting the latest API methods found, including any hidden ones. For instance, set_charge_limit was added due to variable charge limiting introduced in the 4.5 firmware. There are possibly others.

I'll leave this issue open so others can comment and indicate any endpoints they've found.

404 Errors

I am able to get an access token and my vehicle id, but all other calls result in 404 errors. I have used both the "vehicle_id" and "id" codes, to no avail. I have a 2016 Model X with the latest firmware build. Is there something specific to a Model X that prevents compatibility with this API? I would appreciate any assistance anyone can offer!

Here is an example of an error I received when trying to retrieve the car's charge state:

Response
404

Headers
• connection:keep-alive
• server:nginx
• date:Thu, 15 Jun 2017 16:58:43 GMT
• content-type:application/json; charset=utf-8
• content-length:60
• status:404 Not Found
• x-frame-options:SAMEORIGIN
• x-xss-protection:1; mode=block
• x-content-type-options:nosniff
• cache-control:no-cache
• x-request-id:c5561f18-e1cc-470d-99ab-4ddfa4598ad3
• x-runtime:0.009613
• x-newrelic-app-data:PxQDVFVRCQITVlZRDgcFV0YdFGQHBDcQUQxLA1tMXV1dSnwZQRNWERdcRE42LGtnH0tLQBsBGVZUAxoDTFNXVgZRDFMKAQQCA1UJUQBNEVRUFBtDAlYIVVMBWFQFBwRSAgkUHwQHDxFVPw==
• via:1.1 vegur
Body
{
"response": null,
"error": "not_found",
"error_description": ""
}

Tesla Model S mileage

Hi there,

I was wondering if there is a code to get the mileage of my tesla?

I am trying to control my trips with the JSON API.

Streaming API

Recently i was trying to implement the streaming API on my swift lib but i noticed that Tesla is not using websockets anymore.

Request

GET /stream/VEHICLE_ID/?values=speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state,range,est_range,heading HTTP/1.1
Connection: Upgrade
Host: streaming.vn.teslamotors.com
Origin: wss://streaming.vn.teslamotors.com/stream/VEHICLE_ID/?values=speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state,range,est_range,heading
User-Agent: SwiftWebSocket
Upgrade: websocket
Sec-WebSocket-Version: 13
Authorization: Basic !REMOVED!
Sec-WebSocket-Key: 6Dc+wQBQoGacYAPXzGctvg==

Response

HTTP/1.1 200 OK
Server: nginx
Date: Sun, 23 Apr 2017 13:19:38 GMT
Content-Type: text/event-stream
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: no-cache

This seems to be HTTP SSE traffic. https://en.wikipedia.org/wiki/Server-sent_events

I implemented this into the lib but no data came from the stream.

Streaming URL:
https://streaming.vn.teslamotors.com/stream/VEHICLE_ID/?values=speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state,range,est_range,heading

Can anyone here validate that this is in fact HTTP SSE and if so that your car produces events?

how to get expire_in variable?

Hi there,

can someone explain me how to get the expire_in parameter after receiving the token?

tesla_api = TeslaApi::Client.new(email, client_id, client_secret)
tesla_api.login!(password)

Thanks

contact / websocket api

Hi Tim,

Sorry if this is not the place for this type of question. Do you have a place where we can chat / maillist etc? Also I have a model 3 and pretty much everything you have done with the s api works for me. Minus the sunroom since it does not have one :)

Websocket stuff.
I didnt see any documentation but do you know anything about getting notifications. Say when you unplug your charger and in the app you get messages saying its unplugged? Is this communication documented?

API Sniffing.
I used to use a packet capture app to sniff ssl enabled communications but its no longer working (I suspect cert pinning?) How are you inspecting the apis from the app? Or are you decompiling it?

Thanks for the help and if you need any model 3 specific tests let me know.

Riley

Charge state has non valid json in examples

In charge state there is an example with non valid json:

{
  "response": {

    "charging_state": "Complete",  // "Charging", ??
    "charge_to_max_range": false,  // current std/max-range setting
    "max_range_charge_counter": 0,
    "fast_charger_present": false, // connected to Supercharger?
    "battery_range": 239.02,       // rated miles
    "est_battery_range": 155.79,   // range estimated from recent driving
    "ideal_battery_range": 275.09, // ideal miles
    "battery_level": 91,           // integer charge percentage
    "battery_current": -0.6,       // current flowing into battery
    "charge_starting_range": null,
    "charge_starting_soc": null,
    "charger_voltage": 0,          // only has value while charging
    "charger_pilot_current": 40,   // max current allowed by charger & adapter
    "charger_actual_current": 0,   // current actually being drawn
    "charger_power": 0,            // kW (rounded down) of charger
    "time_to_full_charge": null,   // valid only while charging
    "charge_rate": -1.0,           // float mi/hr charging or -1 if not charging
    "charge_port_door_open": true
  }
}

Should I fork and fix it?

Getting 404 error testing basic Authentication call on http://docs.timdorr.apiary.io

Not sure if this is appropriate place to post this issue - apologies if not..

I am using:
http://docs.timdorr.apiary.io/#reference/vehicle-commands/open-trunkfrunk/get-an-access-token?console=1

Passing in the grant_type, client_id, client_secret and my valid Tesla email and password (in plain text -- is that the issue?) --- and when I run that on 'Production' and choose 'Call Resource' - I always get a 404 error....

I can't figure out what I'm doing wrong, but suspect that this call should work. NOOb :|

Add support for new Summon APIs

You can now "Summon" via the app and there is also some HomeLink capability. I have a 2012 Model S, so I'm unable to live test this stuff, but hopefully I can use the HomeLink APIs nonetheless.

Can the charging rate be set via the API?

I'd like to be able to scale down the current drawn while charging if my solar panels are generating much power. I could easily just switch the charging off, but I'd like to be able to make the most out of what is being produced. Do you know of such an API or where else I could ask?

NEWBIE - Need Help deserialize the API.

I am trying to utilize the Tesla Models S JSON API and can’t seem to be able to deserialize the response that gets returned. I am using c# and get the response back for List Vehicles but nothing seems to parse correctly. I have tried a few approaches. Any help or an example would be fantastic. Thank you,

  1.  As an array
          Vehicles[] Cars = JsonConvert.DeserializeObject<Vehicles[]>(responseData);
             foreach (Vehicles car in Cars)
             {
                 int id = car.id;
                 string name = car.display_name.ToString();
    
             }
    
  2.  As a list
    

List list = JsonConvert.DeserializeObject<List>(responseData);

public class Vehicles

{
public object color { get; set; }
public object display_name { get; set; }
public int id { get; set; }
public string option_codes { get; set; }
public int user_id { get; set; }
public int vehicle_id { get; set; }
public string vin { get; set; }
public string[] tokens { get; set; }
public string state { get; set; }
}

set_temps can only max cool

I am trying to use the set_temps method, but it seems like it can only activate max cool and is ignoring the parameters.

Can anyone confirm or disprove this?

open_trunk & open_frunk return 400 Bad Request

These two commands don't seem to work, nor may I get them working per the API docs in CURL. Other commands like opening and closing the Pano Roof work fine.

irb(main):012:0> s.open_trunk
=> #<HTTParty::Response:0x7ff2b2824310 parsed_response={"response"=>nil, "error"=>"invalid_command", "error_description"=>""}, @response=#<Net::HTTPBadRequest 400 Bad Request readbody=true>, @headers={"server"=>["nginx"], "date"=>["Tue, 12 Jan 2016 15:29:34 GMT"], "content-type"=>["application/json; charset=utf-8"], "content-length"=>["66"], "connection"=>["close"], "status"=>["400 Bad Request"], "x-ua-compatible"=>["IE=Edge,chrome=1"], "cache-control"=>["no-cache"], "x-request-id"=>["4d67c7e7de471b6e7f6e4f9d3e75c3cc"], "x-runtime"=>["0.239390"]}>
irb(main):013:0> s.open_frunk
=> #<HTTParty::Response:0x7ff2b322b8e0 parsed_response={"response"=>nil, "error"=>"invalid_command", "error_description"=>""}, @response=#<Net::HTTPBadRequest 400 Bad Request readbody=true>, @headers={"server"=>["nginx"], "date"=>["Tue, 12 Jan 2016 15:29:44 GMT"], "content-type"=>["application/json; charset=utf-8"], "content-length"=>["66"], "connection"=>["close"], "status"=>["400 Bad Request"], "x-ua-compatible"=>["IE=Edge,chrome=1"], "cache-control"=>["no-cache"], "x-request-id"=>["36feb3214fa5850776928740b2e7f924"], "x-runtime"=>["0.047745"]}>

API support for changing charge rate (in amps)

Hello,

Would it be possible to add support for changing the charge rate? I'd like to use my surplus power from solar to send it to the grid. Via the Tesla Powerwall API I can see how much power is going to the grid. I'd like to vary the charge rate of the car to match the excess power going to the grid.

I would need someone to sniff the API call from the phone application to capture the POST message and document.

Thank you,
-Vince

ID/Secret seems to have expired

The ID/Secret used to talk to the Tesla servers seems to have expired. Can you generate a new one (or post how to generate a new one)?

Move docs off of Apiary

Apiary is a great tool for documenting REST APIs. However, the Tesla API is not true REST and this incongruity results in a lot of confusion. There are two main issues:

  • Not all of the API Blueprint format conforms well to the Tesla API. Also, the mock API server is not a proper representation of how the Tesla API operates, leading to even more confusion.
  • The API Blueprint, while a great format for REST APIs in general, is not commonly used yet and puts up a barrier to entry for contribution. I would love to get every little bit of the API documented, but I can't do it all myself!

So, I'd like to move the docs off of Apiary and over to Github Pages. We can use the built-in Jekyll or another static site generator. There are quite a few options here. I'm going to get started on the infrastructure ASAP and hopefully we can have this all moved over quickly and easily.

Sandbox mode?

Hi Tim,

is there a sandbox mode? Who would I need to contact, so I get a demo dataset? I am trying to prepare sth for an upcoming hackathon, but buying a Tesla for that is a bit out of budget. ;)

Cheers, Oliver

Sunroof control (not working on Tesla's end)

After lots of playing around, I've been able to use almost all of the documented API calls EXCEPT the sun_roof_control.

Whether I'm using the interface provided by Tim Dorr or a simple (ish) Java application I've written, I can't seem to find any combination of sunroof calls parameters that work. States of "close", "open", "comfort", "move" all return 400 errors ({"response": null, "error": "invalid_state", "error_description": ""} but "vent" returns a 200 but with the following: {"response": {"reason": "unknown state requested: ", "result": false}}. Results seem to be the same with and without "percent" provided.

I'm definitely working on a car that has a panosunroof. I'm not sure it should make any difference, but the car is about 2 weeks out from delivery so it has the newest hardware. When I do a data_request/vehicle_state on the vehicle, I get the following back (among other parts): "sun_roof_installed": 2,"sun_roof_percent_open": 0,"sun_roof_state": "unknown",

Does anyone know of any differences in the API for the sunroof? Are there other combinations of parameters that anyone has had any success with.

Thanks so much for any help you can give!

Is there a way to get the battery size?

I was wondering if there is a way to get the car's battery size? I saw that there is a battery_range parameter in the response of the charge_state request (which I assume is the range for the fully charged battery) but it seems like a strange place to put the battery size, which is a static value that should be returned with the car information. Is this parameter referring to something else maybe?

Thanks in advance for the response and for the great work documenting these APIs!!

Trunks

Did anyone found out how to control the trunks?

Streaming API Broken after Model 3 updated to 2018.18.3 04dfd3c

Expected behavior

The streaming API works as intended, and returns updates every ~250 msec.

Actual behavior

The streaming API connects successfully, but does not return anything regardless of the state of the Model 3 (awake, driving, etc - nothing is returned).

Steps to reproduce the behavior

This started as soon as my Model 3 updated to version 2018.18.3 04dfd3c. Streaming was working before that, then immediately after the update, it began returning nothing. I've restarted the car, restarted the server, tried across several different days, and the streaming API continues to return nothing.

Model 3 APIs

Model 3 support just landed in the apps. I haven't done any poking around, but perhaps some new stuff was added? If someone else wants to beat me to it, go right ahead!

Turn On/Off Window Defrosters

A much older version of the official Tesla app allowed you to turn the window defrosters on and off. That API call must still exist, can we figure it out?

Android Programming Problem using API

Thanks to a number of contributors who are much wiser than I, I've got a plain vanilla version of what I'm trying to do in Java working in EclipseJavaNeon. But ultimately, I'm trying to get this into an Android app. The goal is ultimately to close an open (or vented) sunroof. There is something about how I'm using the API that's just not right (or I'm just too uneducated to be programming this stuff). There are two parts to my problem right now and a kind of third problem listed way below.


1) On the effort to get the access token, I can get the token but only if all the parameters are in the URL itself with https://private-anon-3f2af7cab3-timdorr.apiary-proxy.com/oauth/token?client_id=e4a9949fcfa04068f59abb5a658f2bac0a3428e4652315490b659d5ab3f35a9e&client_secret=c75f14bbadc8bee3a7594412c31416f8300256d7668ea7e6e7f06727bfb9d220&[email protected]&password=[my password]&grant_type=password

This works but it seems as if I should be able to pass the parts either as JSON or the equivalent of headers so that it's not passed in plain text with the password. Here's the code that I'm using. This is in a separate thread as required by Android and I THINK I'm managing the Async stuff correctly. So the following works but I'd like to get the parameters out of the URL if there's a way to do it:

String realUrl = "https://owner-api.teslamotors.com/oauth/token?grant_type=password&client_id={id token}&client_secret={client secret token}&email={[email protected]}&password={mypassword}";
URL url = null;
try {
         url = new URL(realUrl);
} catch (MalformedURLException e) {
         e.printStackTrace();
}
HttpsURLConnection myURLConnection = null;
try {
         myURLConnection = (HttpsURLConnection) url.openConnection();
} catch (IOException e) {
  e.printStackTrace();
}
try {
         myURLConnection.setRequestMethod("POST");
} catch (ProtocolException e) {
         e.printStackTrace();
}
myURLConnection.setConnectTimeout(3000);  **//THIS LINE DOESN’T SEEM TO MAKE ANY DIFFERENCE WHEN I LOOK AT DEBUG**
myURLConnection.setReadTimeout(3000);      **//DITTO WITH THIS LINE**
myURLConnection.setRequestProperty("User-Agent", "Mozilla/5.0");
myURLConnection.setRequestProperty("Content-Type", "application/json");
myURLConnection.setDoOutput(true);
myURLConnection.setDoInput(true);

_/*Tried to put all of the parameters into JSON and write it here, but this didn’t work
String json = "{\"grant_type\":"\password,client_id\":\"[id token]\","\client_secret\":"\[client secret token]\",\"email\":\"[email protected]\",\"password\":\"mypassword\"}";
DataOutputStream dStream = null;
try {
         dStream = new DataOutputStream(myURLConnection.getOutputStream());
         dStream.writeBytes(json);
         dStream.flush();
         dStream.close();
} catch (IOException e) {
         e.printStackTrace();
} */_

int response = 0;
try {
         response = myURLConnection.getResponseCode();
} catch (IOException e) {
         e.printStackTrace();
}
StringBuffer result = new StringBuffer();
BufferedReader rd;
try {
         rd = new BufferedReader(new InputStreamReader(myURLConnection.getInputStream()));
         String line = "";
         while ((line = rd.readLine()) != null) {
                 result.append(line);
         }
         rd.close();
} catch (IOException e) {
         e.printStackTrace();
}
myURLConnection.disconnect();
accessToken = [subroutine pulls global String accessToken from result; works];
return;

2) Once I have a good access token, I'm next trying to get the vehicleID. The following code is returning a 404 from the server. I suspect I'm missing something really easy and obvious. Any help here again would be greatly appreciated:

String realUrl = "https://owner-api.teslamotors.com/api/1/vehicles";
URL url = null;
try {
         url = new URL(realUrl);
} catch (MalformedURLException e) {
         e.printStackTrace();
}
HttpsURLConnection myURLConnection = null;
try {
         myURLConnection = (HttpsURLConnection) url.openConnection();
} catch (IOException e) {
  e.printStackTrace();
}
try {
         myURLConnection.setRequestMethod("GET");
} catch (ProtocolException e) {
         e.printStackTrace();
}
myURLConnection.setConnectTimeout(3000);  **//THIS LINE DOESN’T SEEM TO MAKE ANY DIFFERENCE WHEN I LOOK AT DEBUG**
myURLConnection.setReadTimeout(3000);      **//DITTO WITH THIS LINE**
myURLConnection.setRequestProperty("User-Agent", "Mozilla/5.0");
myURLConnection.setDoOutput(true);
myURLConnection.setDoInput(true);
myURLConnection.setRequestProperty("Authorization", "Bearer " + accessToken); //accessToken is global variable set in getAuth()

int response = 0;
try {
         response = myURLConnection.getResponseCode();
         **//response = 404!!!!**
} catch (IOException e) {
         e.printStackTrace();
}
StringBuffer result = new StringBuffer();
BufferedReader rd;
try {
         rd = new BufferedReader(new InputStreamReader(myURLConnection.getInputStream()));
         String line = "";
         while ((line = rd.readLine()) != null) {
                 result.append(line);
         }
         rd.close();
} catch (IOException e) {
         e.printStackTrace();
}
myURLConnection.disconnect();
vehicleID = [subroutine pulls global String vehicleID from result; probably works but havent gotten useful result yet];
return;

3. If anyone has any thoughts about why the .setConnectTimeout and .setReadTimeout methods don't seem to be changing the values for the properties when I'm looking the debugger either for myURLConnection or for the delegate property of myURLConnection, again, I would appreciate your ideas. As a related item, I learned that the .setRequestMethod, .setDoOutput, and .setDoInput methods don't change these properties for myURLConnection but do set these properties for the delegate, but this doesn't happen for the . ...Timeout methods. Why?

THANK YOU!

new all data API

Hi,

I saw that there's a new all data API that is not yet documented. If i have time i can do PR for this.
Endpoint: /api/1/vehicles/vehicle_ID/data

Library Updates and Gemification

(Doing this partly after the fact)

The library needs to be updated for all the new API changes. This represents a good chance to convert it to a real Ruby gem and publish it.

  • Convert to gem
  • Add tests
    • Test Client
    • Test Vehicle
  • Publish on Rubygems
  • Travis and Coveralls

Update for new endpoints

Tesla has moved quite a bit around on the API with the release of 6.0 and the latest apps. There are a couple new endpoints and most have been moved around.

The server has switched to owner-api.teslamotors.com and there is certificate pinning in the apps, making sniffing via proxy more difficult. I may try poking around with APK Studio to see if I can remove the pin or have it trust a different cert.

Changes

  • Update server to owner-api.teslamotors.com
  • New /command/ endpoints
    • charge_max_range
    • charge_standard
    • sun_roof_control
    • flash_lights
    • honk_horn
    • door_lock
    • charge_port_door_open
    • trunk_open
    • remote_start_drive
    • upcoming_calendar_entries
    • set_temps
    • charge_start
    • auto_conditioning_start
    • charge_stop
    • auto_conditioning_stop
    • door_unlock
  • New /data_request/ endpoints
    • charge_state
    • climate_state
    • drive_state
    • gui_settings
    • vehicle_state
  • Misc vehicle endpoints
    • wake_up
    • mobile_enabled
  • notification_preferences
  • vehicle_subscriptions

Incorrect OPEN_TRUNK documentation

For my TMX (2018.26 3bbd9fd), the OPEN_TRUNK documentation seemed to be off. After fiddling, I found that the suggested URL parameter "which_trunk" should actually be in the posted JSON body.

POST https://owner-api.teslamotors.com/api/1/vehicles/XXXXXXX/command/trunk_open with JSON body:

{
  "which_trunk": "rear"
}

In the URL, XXXXXXX is your vehicle ID, of course.

Apiary lacks states, needs update(s)

Let me start by saying that this is meant to be progressive, and I have come across each of these through the feeling of "why did I need to go through trial-and-error to reach that answer", and thought that there might need to be an update.

Anyways, onto the list, feel free to add as I don't have a ton to push on initially, although I know there are some hiding out there.

  • = already in the Apiary,
  • = not (i think)

Vehicle states

shift_state

  • Parked
  • Drive
  • Reverse
  • Neutral

autopark_state

  • ready
  • ??
  • ?? - please add if you know

autopark_style

  • standard
  • ?? - please add if you know

calendar_supported

  • true
  • false

Charge states

charging_state

  • Charging
  • Complete
  • Disconnected (surprised this wasn't in the API)

charge_limit_soc

  • Current charge limit set

vehicle_id versus id

In the apiary documentation, almost all the methods require a "vehicle_id" parameter, however it actually seems this must be the value labeled "id" in the list of all vehicles.

Update for oAuth flow

Some time around the release of the 6.0 firmware, Tesla switched to a more sane oAuth-based API (good move! 👍).

I assume posting the raw oAuth tokens is a no-no, so either instructions need to be provided on how to get them or we leave that as an exercise for the reader. Either way, the project is busted without it.

  • oAuth Login
  • Bearer token auth
  • How to find the oAuth token/secret (or not?)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.