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.
Quick update - the problem to wake up from asleep was that I had lost 3G connection without realising it.
The bars were all there but no 3G symbol so no 3G connection :redface:
The Tesla techs were able to use my WiFi connection to update the car and now my 3G connection is back.
Thanks to everyone I can now talk again to my car :rolleyes:
 
Can someone running some variant of 5.8(.x) please tell me if they've seen what "battery_level" is shown for a rated range of 10 miles or less (from charge_state)? Please let me know what the rated range was and what the battery_level was for that rated range.

Thanks.

9.8 miles = 13%
9.5 miles = 13%
9.2 miles = 13%
8.8 miles = 13%
8.5 miles = 13%
8.1 miles = 13%
7.8 miles = 13%
------------------
7.5 miles = 12%
7.1 miles = 12%
6.1 miles = 12 %
--------------------
5.8 miles = 11 %
5.1 miles = 11 %
4.4 miles = 11 %
--------------------
4.1 miles = 10%
3.7 miles = 10%
3.4 miles = 10%
3.0 miles = 10%
---------------------
2.7 miles = 9%

That was as low as I got. This is on a 60 kWh pack and firmware version 1.49.90
 
Can someone running some variant of 5.8(.x) please tell me if they've seen what "battery_level" is shown for a rated range of 10 miles or less (from charge_state)? Please let me know what the rated range was and what the battery_level was for that rated range.
Here's a sample set of streaming data. Note that my battery_level=21 at the beginning of the log (and I don't sample non-streaming until the next log) but I figure you might find the streaming data useful.

Beginning of the DAT file includes:
Code:
charging_state=Disconnected
charge_limit_soc=90
battery_range=31.8
est_battery_range=24.37
ideal_battery_range=36.6
battery_level=21
battery_current=-84.2
charge_energy_added=37.0
charge_miles_added_rated=121.5
charge_miles_added_ideal=139.5
car_version=1.49.24
gps_as_of=1390077179

Streaming portion of interest:
Code:
timestamp,speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state,range,est_range
1390078206250,75,21564.6,10,28,190,38.390024,-121.950889,24,D,6,4
1390078206500,75,21564.6,9,28,190,38.389965,-121.950903,25,D,6,4
...
1390078211000,75,21564.7,9,28,190,38.388638,-121.951214,26,D,5,4
...
1390078215500,75,21564.7,9,28,191,38.387313,-121.951532,29,D,5,4
...
1390078219750,75,21564.8,9,29,190,38.386045,-121.951825,24,D,5,4
...
1390078220500,75,21564.9,9,29,190,38.385839,-121.951873,23,D,5,4
...
1390078225500,71,21565.0,9,28,191,38.384372,-121.952217,-63,D,5,4
...
1390078231000,66,21565.1,9,28,190,38.382875,-121.952568,8,D,5,4
...
1390078236250,65,21565.2,9,28,190,38.381502,-121.952892,19,D,5,4
...
1390078242000,64,21565.3,9,28,190,38.380032,-121.953232,3,D,5,4
...
1390078247500,61,21565.4,9,29,190,38.378697,-121.953538,32,D,5,4
...
1390078253500,63,21565.5,9,30,191,38.377228,-121.953885,24,D,5,4
...
1390078259250,57,21565.6,9,31,191,38.375854,-121.954214,16,D,5,4
...
1390078265500,52,21565.7,9,31,193,38.374470,-121.954585,-16,D,5,4
...
1390078276000,16,21565.8,9,32,226,38.372954,-121.955389,3,D,5,4
...
1390078301001,29,21565.9,9,31,199,38.372605,-121.956705,21,D,5,4
...
1390078312000,34,21566.0,9,31,227,38.371504,-121.957502,9,D,5,4
...
1390078397449,21,21566.1,9,35,192,38.370525,-121.958995,38,D,5,4
...
1390078410699,20,21566.2,9,38,136,38.369440,-121.957755,-24,D,4,3
...
1390078430199,18,21566.3,9,32,138,38.368478,-121.956566,-7,D,4,3
...
1390078443699,30,21566.4,9,30,228,38.367322,-121.957481,-37,D,4,3
...
1390078468199,7,21566.5,9,30,153,38.366174,-121.957272,4,D,4,3
...
...
1390078494949,1,21566.5,9,31,235,38.366514,-121.958183,1,D,4,3
...
1390078593699,,21566.5,9,32,150,38.366581,-121.958203,0,P,4,3

1390078689120,,21566.5,9,32,150,38.366581,-121.958203,0,P,4,3
1390078700620,,21566.5,9,32,150,38.366581,-121.958203,1,P,4,3
1390078700870,,21566.5,9,32,150,38.366581,-121.958203,0,P,4,3
1390078701370,,21566.5,9,32,150,38.366581,-121.958203,-1,P,4,3
1390078701620,,21566.5,9,32,150,38.366581,-121.958203,-2,P,4,3
1390078702120,,21566.5,9,32,150,38.366581,-121.958203,-3,P,4,3
1390078703120,,21566.5,9,32,150,38.366581,-121.958203,-6,P,4,3
1390078703620,,21566.5,9,32,150,38.366581,-121.958203,-7,P,4,3
1390078704120,,21566.5,9,32,150,38.366581,-121.958203,-8,P,4,3
1390078704370,,21566.5,9,32,150,38.366581,-121.958203,-9,P,4,3
1390078706120,,21566.5,9,32,150,38.366581,-121.958203,-10,P,4,3
1390078706620,,21566.5,9,32,150,38.366581,-121.958203,-11,P,4,3
1390078706870,,21566.5,9,32,150,38.366581,-121.958203,-12,P,4,3
1390078707120,,21566.5,9,32,150,38.366581,-121.958203,-13,P,4,3
1390078707370,,21566.5,9,32,150,38.366581,-121.958203,-14,P,4,3
1390078707620,,21566.5,9,32,150,38.366581,-121.958203,-16,P,4,3
1390078707870,,21566.5,9,32,150,38.366581,-121.958203,-17,P,4,3
1390078708120,,21566.5,9,32,150,38.366581,-121.958203,-19,P,4,3
1390078708370,,21566.5,9,32,150,38.366581,-121.958203,-21,P,4,3
1390078708620,,21566.5,9,32,150,38.366581,-121.958203,-23,P,4,3
1390078708870,,21566.5,9,32,150,38.366581,-121.958203,-24,P,4,3
1390078709120,,21566.5,9,32,150,38.366581,-121.958203,-26,P,4,3
1390078709370,,21566.5,9,32,150,38.366581,-121.958203,-28,P,4,3
1390078709620,,21566.5,9,32,150,38.366581,-121.958203,-30,P,4,3
1390078709870,,21566.5,9,32,150,38.366581,-121.958203,-31,P,4,3
1390078710120,,21566.5,9,32,150,38.366581,-121.958203,-33,P,4,3
1390078710370,,21566.5,9,32,150,38.366581,-121.958203,-34,P,4,3
1390078710620,,21566.5,9,32,150,38.366581,-121.958203,-36,P,4,3
1390078710870,,21566.5,9,32,150,38.366581,-121.958203,-37,P,4,3
1390078711120,,21566.5,9,32,150,38.366581,-121.958203,-38,P,4,3
1390078711370,,21566.5,9,32,150,38.366581,-121.958203,-40,P,4,3
1390078711620,,21566.5,9,32,150,38.366581,-121.958203,-42,P,4,3
1390078711870,,21566.5,9,32,150,38.366581,-121.958203,-43,P,4,3
1390078712120,,21566.5,9,32,150,38.366581,-121.958203,-45,P,4,3
1390078712370,,21566.5,9,32,150,38.366581,-121.958203,-46,P,4,3
1390078712620,,21566.5,9,32,150,38.366581,-121.958203,-48,P,4,3
1390078712870,,21566.5,9,32,150,38.366581,-121.958203,-50,P,4,3
1390078713120,,21566.5,9,32,150,38.366581,-121.958203,-52,P,4,3
1390078713370,,21566.5,9,32,150,38.366581,-121.958203,-53,P,4,3
1390078713620,,21566.5,9,32,150,38.366581,-121.958203,-55,P,4,3
1390078713870,,21566.5,9,32,150,38.366581,-121.958203,-56,P,4,3
1390078714120,,21566.5,9,32,150,38.366581,-121.958203,-59,P,4,3
1390078714370,,21566.5,9,32,150,38.366581,-121.958203,-60,P,4,3
1390078714620,,21566.5,9,32,150,38.366581,-121.958203,-62,P,4,3
1390078714870,,21566.5,9,32,150,38.366581,-121.958203,-63,P,4,3
1390078715120,,21566.5,9,32,150,38.366581,-121.958203,-66,P,4,3
1390078715370,,21566.5,9,32,150,38.366581,-121.958203,-67,P,4,3
1390078715620,,21566.5,9,32,150,38.366581,-121.958203,-69,P,4,3
1390078715870,,21566.5,9,32,150,38.366581,-121.958203,-71,P,4,3
1390078716120,,21566.5,9,32,150,38.366581,-121.958203,-73,P,4,3
1390078716370,,21566.5,9,32,150,38.366581,-121.958203,-74,P,4,3
1390078716620,,21566.5,9,32,150,38.366581,-121.958203,-76,P,4,3
1390078716870,,21566.5,9,32,150,38.366581,-121.958203,-78,P,4,3
1390078717120,,21566.5,9,32,150,38.366581,-121.958203,-80,P,4,3
1390078717370,,21566.5,9,32,150,38.366581,-121.958203,-81,P,4,3
1390078717620,,21566.5,9,32,150,38.366581,-121.958203,-82,P,5,3
1390078718120,,21566.5,9,32,150,38.366581,-121.958203,-83,P,5,3
1390078718370,,21566.5,9,32,150,38.366581,-121.958203,-84,P,5,3
1390078719120,,21566.5,9,32,150,38.366581,-121.958203,-85,P,5,3
1390078719620,,21566.5,9,32,150,38.366581,-121.958203,-85,P,5,4
1390078720870,,21566.5,9,32,150,38.366581,-121.958203,-86,P,5,4
1390078730620,,21566.5,10,32,150,38.366581,-121.958203,-86,P,5,4

If you need any more specific details out of this file [20140118_123257.dat] let me know.
 
Thanks, this is great.

I have so much data it is insane.. I record the full rest api info every minute, and I'm ALWAYS recording streaming info..

I have a P85... Keep in mind the firmware version on my car may have changed during these samples so they may be inconsistent. I don't run my car very low very often.

1388066736218,0,17712.1,8,197,233,x,x,3,P,1,1
1388066616218,25,17711.6,9,196,150,x,x,7,D,2,1
1382498980795,0,13149.8,8,236,83,x,x,6,P,2,2
1382498886044,29,13149.6,8,236,357,x,x,25,D,3,2
1382498873044,28,13149.5,8,230,270,x,x,40,D,3,3
1382498831044,44,13149.2,9,225,269,x,x,43,D,4,3
1382498812045,40,13149.0,9,224,270,x,x,3,D,4,4
1388066395132,52,17709.1,10,206,154,x,x,31,D,5,3
1382498774044,30,13148.6,9,220,177,x,x,45,D,5,4
1382498751044,41,13148.5,9,222,180,x,x,12,D,6,4
1382498662079,65,13147.5,10,224,89,x,x,-21,D,6,5
1382498649579,61,13147.3,10,230,87,x,x,-1,D,7,5
1382498605079,61,13146.6,10,240,360,x,x,21,D,7,6
1382498587329,67,13146.3,10,238,1,x,x,63,D,8,6
1382498564079,60,13145.9,10,240,8,x,x,7,D,8,7
1382066943266,29,12444.9,10,234,260,x,x,26,D,8,8
1382498563079,60,13145.8,10,240,8,x,x,51,D,9,7


Need more?
 
I have so much data it is insane.. (a) I record the full rest api info every minute, and (b) I'm ALWAYS recording streaming info..
(a) I only do this when I start a new log file -- every 15-30 min. I figure Tesla can't complain about this rate because it's driven by the requirement to get a new token for the streaming API.
(b) Yah, same here. Except when Azure needs to reboot my VM.
 
As of around 8:30PM PST on 03/30, I'm now seeing:

System.Net.WebException: The remote server returned an error: (429).


I've never seen the REST login server reject requests for this long (7 hours so far). Anybody else seeing this?
 
As of around 8:30PM PST on 03/30, I'm now seeing:

System.Net.WebException: The remote server returned an error: (429).


I've never seen the REST login server reject requests for this long (7 hours so far). Anybody else seeing this?

Not sure, but pretty sure I would see that when tesla blocked my IP. Use curl.exe to see what results from your request...typically, if your IP is blocked it is for 24 hrs.
 
Apologies for the question, as the answer might well be somewhere in the 800 posts in this thread but I couldn't find it easily. I'm looking for an explanation (or even better, an example) of how to periodically refresh the tokens using curl so that you can stream data indefinitely. I've got enough programming background to understand all the control flow, etc - it's just not entirely clear how you do the token refresh/cycling/whatever part.

And since I don't have my car (yet!) I can't actually test it to figure out what it does...

if anyone has a script (perl, python, bash) that implements this, I'm sure it will become obvious as soon as I see the code. ;-)
 
Apologies for the question, as the answer might well be somewhere in the 800 posts in this thread but I couldn't find it easily. I'm looking for an explanation (or even better, an example) of how to periodically refresh the tokens using curl so that you can stream data indefinitely. I've got enough programming background to understand all the control flow, etc - it's just not entirely clear how you do the token refresh/cycling/whatever part.

And since I don't have my car (yet!) I can't actually test it to figure out what it does...

if anyone has a script (perl, python, bash) that implements this, I'm sure it will become obvious as soon as I see the code. ;-)

a description and sample curl commands are in the REST Wiki
 
With 5.9, fast_charger_type suddenly reports "ChargerTypeTesla" instead of None.
I usually try to report on the differences when I get new firmware, but I'm late. Apologies.

Comparing with 1.49.90, the 1.51.94 firmware also adds:
usable_battery_level=88

For comparison, this value was present next to this "88" sample:
battery_level=88

I'm sure we'll see a trend showing the difference between usable_battery_level and battery_level as we get more data points.

My 5.9 data starts on 04/08 and in most cases the two values match but there are some examples like:
battery_level=85
usable_battery_level=84
The gap so far is always 0 or 1 for my data. I suspect we might see a larger delta consistently for the 40/ vehicles either now or in future firmware.
 
I'm seeing a lot of codes that I cant find definitions for. (This is with 5.9).

QYMT
WTX1 and WTTP on same car
FG01 (may be folding mirrors?, which I have)
UTMF
IX01 (new seat code?)
HP03 (have HP00 for no hpwc, this is new)
YF00

BS00
X021, X027, X028, X031, X037

Any hints? Or is there a newer source for options I should be using?

Thanks