Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register
  • We just completed a significant update, but we still have some fixes and adjustments to make, so please bear with us for the time being. Cheers!

Model S REST API

ramonneke

Active Member
Apr 26, 2018
3,419
1,906
Rotterdam
I know that neither battery_range or ideal_battery_range are based on dynamic wH/mile values.

That is what I was assuming, that only "est_battery_range" is a dynamic value. I just verified it with the data in my car and "est_battery_range" is what is presented in the UI as "Projected Range". To be specific, the API returns the value of the last 50 kilometers. Not sure that if I select 10km in the UI is that changes the values in the API (yet..).

wk057 posted the Wh/mile values that are used for the rated range calculation over here:

That is using 285 Wh/Mile, or 177.09Wh/kilometer for "rated" which is "battery_range" in the API results. I'm getting the following results when converting and extrapolating for my S100D:

Code:
Current ranges:
        rated: 381.48km, 237.04m (battery_range)
        ideal: 306.37km, 190.37m
    estimated: 222.12km, 138.02m

Max ranges:
        rated: 625.37km, 388.59m (battery_range)
        ideal: 502.25km, 312.08m
    estimated: 364.13km, 226.26m

Consumption:
        rated: 177.09Wh/km, 285.00Wh/m (battery_range)
        ideal: 220.51Wh/km, 354.87Wh/m
    estimated: 304.14Wh/km, 489.47Wh/m

Pack capacity (SoC: 61%):
      current:  67.56kWh
          max: 110.75kWh

As this extrapolates to 110.75kW I don't think 285Wh/Mile for rated is the correct value.


I've once heard that "rated" in the US is different for the EU.


Who can confirm the API values for US cars from the API?
 

markb1

Active Member
Feb 17, 2012
3,031
638
San Diego, CA
That is what I was assuming, that only "est_battery_range" is a dynamic value. I just verified it with the data in my car and "est_battery_range" is what is presented in the UI as "Projected Range". To be specific, the API returns the value of the last 50 kilometers. Not sure that if I select 10km in the UI is that changes the values in the API (yet..).



That is using 285 Wh/Mile, or 177.09Wh/kilometer for "rated" which is "battery_range" in the API results. I'm getting the following results when converting and extrapolating for my S100D:

Code:
Current ranges:
        rated: 381.48km, 237.04m (battery_range)
        ideal: 306.37km, 190.37m
    estimated: 222.12km, 138.02m

Max ranges:
        rated: 625.37km, 388.59m (battery_range)
        ideal: 502.25km, 312.08m
    estimated: 364.13km, 226.26m

Consumption:
        rated: 177.09Wh/km, 285.00Wh/m (battery_range)
        ideal: 220.51Wh/km, 354.87Wh/m
    estimated: 304.14Wh/km, 489.47Wh/m

Pack capacity (SoC: 61%):
      current:  67.56kWh
          max: 110.75kWh

As this extrapolates to 110.75kW I don't think 285Wh/Mile for rated is the correct value.


I've once heard that "rated" in the US is different for the EU.


Who can confirm the API values for US cars from the API?

It makes sense that that rated would mean something different in the EU, since here in the US, it's based on the rating from a US government agency. That would explain why your rated range is higher than ideal range, which is the opposite for US cars. (For instance, right now, the API shows 148.07, 80.6, 168.39 for battery_range, est_battery_range, ideal_battery_range for my car.)

Also, it looks like wk057's numbers don't cover the non-performance 100D.

Here's someone saying "rated miles in UK = ideal U.S. miles": Calculate usable battery capacity based on rated miles values

(UK is still in the EU, last I checked!)
 

ramonneke

Active Member
Apr 26, 2018
3,419
1,906
Rotterdam
I captures the values from the UI and the API and compared them:

Code:
User interface:
    soc:      55%
    typical: 276km   => 171.49m
    rated:   343m    => 213.13m

Energy display (average):
    10km: 198Wh/km, 271km (168.39km)
    25km: 251Wh/km, 214km (132.97km)
    50km: 261Wh/km, 205km (127.38km)

API: (via Teslafi.com account info)
    battery_level:        55%
    battery_range:       213.21m  => 343.12km (rated in GUI)
    est_battery_range:   127.59m  => 205.33km
    ideal_battery_range: 171.23m  => 168.39km

This means that: (foratleast EU cars)

- Typical in the UI is mapped to "ideal_battery_range" in the API
- Rated in the UI is mapped to "battery_range" in the API

Which makes it a bit strange that "battery_range" from the API isn't used in the EU User Interface. Maybe that is different in US cars.
 

scottf200

Active Member
Feb 3, 2013
3,770
3,326
Chicagoland ModelX S603
I captures the values from the UI and the API and compared them:

This means that: (foratleast EU cars)

- Typical in the UI is mapped to "ideal_battery_range" in the API
- Rated in the UI is mapped to "battery_range" in the API

Which makes it a bit strange that "battery_range" from the API isn't used in the EU User Interface. Maybe that is different in US cars.
Related?

More 'realistic' range:
* 'rated' in USA &
* 'typical' in non-USA

'Constant value' range:
* 'ideal' in USA &
* 'rated' in non-USA

Typical, rated and ideal range explained
 

ramonneke

Active Member
Apr 26, 2018
3,419
1,906
Rotterdam
Related?

More 'realistic' range:
* 'rated' in USA &
* 'typical' in non-USA

'Constant value' range:
* 'ideal' in USA &
* 'rated' in non-USA

Not really, I would like to actually know if the values reported with the Tesla API are different between US and EU. I already know that both "est_battery_range" and "ideal_battery_range" use fixed consumption rates.

Its just that I don't think the consumption rate of 160Wh/km for my S100D is correct as that extrapolates to a usable pack capacity of 99.86kWh.

Is someone able to share API output from a US S100D ?
 

NotAUsername

Member
Nov 19, 2017
16
18
Los Angeles
Thank you! Do you also know what the body of the http should be to turn it on/off?
Unfortunately no. My car hasn't gotten the sentry mode update yet. When I send a request with a blank body I get a 500 internal server error with this response:
Code:
{
    "error": "system",
    "error_description": "An unknown error has occurred."
}

but when I send a request with anything in the body like:
Code:
{
    on: false
}
I get a 404 not found error with this response:
Code:
{
    "response": null,
    "error": "`` for txid `(txid here)`",
    "error_description": ""
}
I hope I can get this update soon...
 
  • Informative
Reactions: f8K37Sq31

xilex

Model P3D
Jul 5, 2018
350
205
Cypress, CA
Hi all, what is the proper way to turn on climate in the car to a set temperature, such as LO/60F or 70F? Would you run auto_conditioning_start, then set_temps for both passenger/driver sides, or the reverse order? Thanks.
 

markb1

Active Member
Feb 17, 2012
3,031
638
San Diego, CA
I'm seeing 502 Bad Gateway for the streaming API, today. (The main API continues to work.) Anybody else seeing this? Doesn't seem like something that would be on my end, but just want to make sure.
 

bmah

Moderator, Model S/X, California Forums
Mar 17, 2015
3,837
6,795
Lafayette, CA, USA
I'm seeing 502 Bad Gateway for the streaming API, today. (The main API continues to work.) Anybody else seeing this? Doesn't seem like something that would be on my end, but just want to make sure.

I have a data acquisition program running that logged some server-side errors (Request Timeout and Internal Server Error) today around 0830 and 1530 PDT, but those were using the main API, not the streaming API.

Bruce.
 

markb1

Active Member
Feb 17, 2012
3,031
638
San Diego, CA
I have a data acquisition program running that logged some server-side errors (Request Timeout and Internal Server Error) today around 0830 and 1530 PDT, but those were using the main API, not the streaming API.

Bruce.

Now I'm seeing many many failures from the main API (error code 500) since 9:42 PM PST yesterday. Many more failures than successes. (For each polling interval, my script tries a few times before giving up, and it usually gets through on one of the retries.)

And the streaming API is still returning 502 consistently. Is anybody else monitoring the streaming API these days?
 

tornado

Member
Dec 7, 2012
47
9
Seattle-Area
I'm seeing 502 Bad Gateway for the streaming API, today. (The main API continues to work.) Anybody else seeing this? Doesn't seem like something that would be on my end, but just want to make sure.
Seeing the same streaming errors. Haven't been able to stream since 3/7 in the am.
 

tornado

Member
Dec 7, 2012
47
9
Seattle-Area
This is pretty much what I'm getting, over and over:

Code:
9 Mar 11:03:09 - timestamp,speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state,range,est_range,heading
9 Mar 11:03:10 - Bad timestamp (<html>)
9 Mar 11:03:10 - Unexpected problem with request:
    Response status code = 502  Error code = null
 Polling again in 10 seconds...
.
.
.
.
9 Mar 11:23:22 - 4 of 6 Stream requests since 1552159362263
9 Mar 11:23:22 - Bad timestamp (<html>)
9 Mar 11:23:22 - Unexpected problem with request:
    Response status code = 502  Error code = null
 Polling again in 10 seconds...
 

About Us

Formed in 2006, Tesla Motors Club (TMC) was the first independent online Tesla community. Today it remains the largest and most dynamic community of Tesla enthusiasts. Learn more.

Do you value your experience at TMC? Consider becoming a Supporting Member of Tesla Motors Club. As a thank you for your contribution, you'll get nearly no ads in the Community and Groups sections. Additional perks are available depending on the level of contribution. Please visit the Account Upgrades page for more details.


SUPPORT TMC
Top