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.
I had the same issue during that time frame, but a completely different behavior. The server simply didn't answer queries related to my car, as if the car was out of 3G range. I did not receive any authentication errors or anything. The mobile app showed "Contacting car..." yet the car was happily playing Slacker, CC on, etc.


That seems consistent with what should happen when the Tesla authentication system is down, but the 3G internet connectivity to the car is still working. Egress traffic (from the car to the internet) would be unaffected, but ingress traffic (from Tesla to the car) would not work because the necessary tokens are unavailable after the 15 minute automatic expiry window has passed.

 
Interesting effect when driving out of 3G coverage... the car doesn't appear to cache a lot of data, so you are simply getting nothing while driving outside of coverage.
This is from my drive from Sunriver back to Portland today. Quick charge stop in Detroit (but would have made it home without the quick charge as well). Twice you see that I have no coverage (I need to fix the visualization to not draw that diagonal line for the speed but instead to have a gap there).

Screen Shot 2013-08-25 at 3.41.12 PM.png
 
Some examples of the car page I created with the data I'm pulling from the API. I particularly like the battery range graph that highlights estimated vs rated range.

Day mode and night mode!

Cool. Are you doing this based on teslams? I think it would be good if we tried to work together - there are now about half a dozen different projects out there. Some open source, some not...
 
Cool. Are you doing this based on teslams? I think it would be good if we tried to work together - there are now about half a dozen different projects out there. Some open source, some not...

No, I'm a Python guy, so I'm using the PyTesla module with a small modification to cache the auth cookie between runs (I should probably send a pull request for that...). I use this to pull down stats from the API, throw them in RRDTool, and then the rest is python cgi to render the page and graphs. A little javascript to refresh the images. It's all pretty simple and purpose built for what I wanted.

I'm not yet pulling anything from the streaming API. I'll probably modify PyTesla for that too unless someone beat me to it. It looks like the only thing available there that is not in the "REST" API is the power number? Which I suppose is the instantaneous kW usage you see on the dash?

No idea how 5.0 will affect API polling. I'm polling once per minute. I'm guessing polling the API with that sort of frequency will keep the car awake and negate any benefit I'd get from the new sleep mode.
 
How do I get this on my car? Are there instructions posted somewhere? Also, does it work on 5.0? I've done a lot of coding with the flot library, so maybe I can contribute too...

By the way, it looks awesome!!
Which one? There are different ones in this thread. The one I posted is available on github - it is indeed done in flot and I would LOVE another contributor to make it better.
PM me (or send actual email - much preferred; my email is easy to get from my Signed-of-by message :) )
 
Yes, I've sort of been half following the github commits which is why I knew it was flot. But I didn't see any instructions on the main page related to these new graphs... Admittedly I haven't spent much time looking into it yet... :redface:
 
Yes, I've sort of been half following the github commits which is why I knew it was flot. But I didn't see any instructions on the main page related to these new graphs... Admittedly I haven't spent much time looking into it yet... :redface:
Yeah, I'm not doing a good job documenting this, I think.
Something to work on to get more people involved.
Have you tried to set it up at all? Anything specific where you got stuck? Or just general lack of documentation?
 
I'm not yet pulling anything from the streaming API.
It looks like the only thing available there that is not in the ... (non-polling) ... "REST" API is the power number? Which I suppose is the instantaneous kW usage you see on the dash?
The following are only available in the streaming API (AFAIK):
  1. odometer
  2. elevation
  3. power

Also the streaming API can return data as fast as 1/4 second (0.25s) whereas the round-trip time for data over the standard API seems to have a resolution of 1 or 2 seconds judging by the gps_as_of field.

- - - Updated - - -

Really? Nobody has published a C# one yet? Hm, maybe I should package mine up for general consumption.