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.
This allows you to set a time at which you want the charge to finish. Let's say you want to leave at 7 in the morning with a fully charged car, but you don't want to have the car sit with a high SOC over night, so you don't start the charge the previous evening instead you program things so that it starts the charge at just the right time so that it is finished charging at 7am -> no time sitting at high SOC.

This is awesome!
 
Is there a way to get the firmware version from the API? I don't have 5.0 but from what has been reported 4.5 shows "Rated Range" vs "Ideal Range" where 5.0 shows "Rated Range" vs "Tipical Range" I want my app to differentiate 4.5 vs 5.0

It is in the Vehicle State: Cmd Results={"df":0,"dr":0,"pf":0,"pr":0,"ft":0,"rt":0,
"car_version":"1.33.61",
"locked":true,"sun_roof_installed":true,"sun_roof_state":"unknown","sun_roof_percent_open":0,"dark_rims":false,"wheel_type":"Silver21",
"has_spoiler":true,"roof_color":"None","perf_config":"Sport"}
 
Awesome, thanks...

I don't have 5.0 yet but many current users do and they fail to connect for one minute (Tesla Companion - Windows Phone)
So I'm coding the following,

App logins then
if State returns asleep then show "Awakening the car..."
Show animated donut...
Send the command https://portal.vn.teslamotors.com/vehicles/{0}/command/wake_up, I hope this does the job
Pool every 15 seconds until the sate changes from "Waking" to "Online"
Move on to query the rest of the APIs.
 
Looks like I've been blocked from the REST API. Wasn't making an inordinate number of requests based on what I've read here (one every 2 minutes).

Who can we contact to get assistance?
Since we are not using an officially sanctioned api... I really don't know.
First thing to do would be to make sure that you don't have a runaway process somewhere that keeps making requests.
And then check if your phone app works (to see if your login or your IP has been blocked).
And then try support...
 
Looks like I've been blocked from the REST API. Wasn't making an inordinate number of requests based on what I've read here (one every 2 minutes).

API response to all calls:


Who can we contact to get assistance?


I think I might be blocked as well. I haven't been able to extract any data since this am. I've been using the streaming.js module. How can you tell whether you're blocked or not? Right now in the app I keep getting the circle around the car thing but no data.

- - - Updated - - -

Maybe it's just the server is down? Anyone else verify?

- - - Updated - - -

Mine in response to request says that login password is incorrect (and yes I have verified multiple times the correct password). This happened to me a few days ago as well. I wonder if the servers are getting overloaded with all the new cars? I know that sounds implausible that that could happen to such a great company, but hey, my car does make noises when I go over 65 mph...
 
I added a few more delays to streaming.js so that under no circumstances can it request more than once every 10 seconds. I have no reason to believe that this app is causing people to get blocked and I run it constantly myself without issue, but just to be sure I added the delay in every code path. Version is 0.6.51 and is on github and npm.
 
Last edited:
Changing IPs did the trick for me. Confirmed there was no runaway process, and I'm only pinging REST API once every two minutes to see if I should start streaming data (if car is in motion). Anyone have any other recommendations for replicating that check?
 
I added a few more delays to streaming.js so that under no circumstances can it request more than once every 10 seconds. I have no reason to believe that this app is causing people to get blocked and I run it constantly myself without issue, but just to be sure I added the delay in every code path. Version is 0.6.51 and is on github and npm.

Thanks. I updated. Will try it again as my ip (the same one that was apparently blocked yesterday) is working again today. Do you think they just blocked me for 24 hours or is something else going on?
 
Thanks. I updated. Will try it again as my ip (the same one that was apparently blocked yesterday) is working again today. Do you think they just blocked me for 24 hours or is something else going on?
I don't think we have seen 24h blocks before.
But from the symptoms you described earlier I'm inclined to think that from your static IP there was a routing issue to the authentication infrastructure...
 
Thanks. I updated. Will try it again as my ip (the same one that was apparently blocked yesterday) is working again today. Do you think they just blocked me for 24 hours or is something else going on?

Just curious if you have 5.0 firmware? I just closed another potential hole in streaming.js were a sleeping car might receive a short burst of wakeup calls if it takes a while to revive itself. Not sure that this would cause Tesla to notice but I am being paranoid and I would not want someone to get blocked because of something I overlooked in my code. It's on github now as version 0.6.52. npm publish will have to wait until tonight.

I don't think we have seen 24h blocks before.
But from the symptoms you described earlier I'm inclined to think that from your static IP there was a routing issue to the authentication infrastructure...

You can easily test for that using curl. If your IP is "blocked" by Tesla you will still be able to make an HTTP request and you will get a 403 forbidden or some other server side HTTP error.
If you have a routing issue or some other connectivity issue you will not get a response back from Tesla and will simply get a client side HTTP timeout.
 
Last edited:
Just curious if you have 5.0 firmware? I just closed another potential hole in streaming.js were a sleeping car might receive a short burst of wakeup calls if it takes a while to revive itself. Not sure that this would cause Tesla to notice but I am being paranoid and I would not want someone to get blocked because of something I overlooked in my code. It's on github now as version 0.6.52. npm publish will have to wait until tonight.



You can easily test for that using curl. If your IP is "blocked" by Tesla you will still be able to make an HTTP request and you will get a 403 forbidden or some other server side HTTP error.
If you have a routing issue or some other connectivity issue you will not get a response back from Tesla and will simply get a client side HTTP timeout.

I have firmware 4.5, I think .61. The location I was last at before it went down was like a concrete bunker parking garage, ie no signal. Do you think that had something to do with it? When I tried to log in through the app it would say incorrect user/password...