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.
Has anyone tested the horn extensively? Is it limited to 60 times per second, for example?
/vehicles/{id}/command/honk_horn
Spamming the method continuously seems to max out at 2-5 honks per second.

I may trying it with multiple threads just to satisfy my curiosity.

Update: Running 5 copies of my test app in parallel doesn't speed up the rate of honking. I'm done here, for now. :)
 
Same for me. I always get the climate setting returned, but the interior and exterior temp sensor readings come and go. Must be on a circuit with other stuff that wakes up from time to time for some reason. Sending a "wake up" REST request doesn't wake up any of the temperature sensors. The funny thing is that it always knows if the rear defroster is on, but when it "sleeps" it doesn't know if the front defroster is on.

I've been dumping all readings every 10 minutes to a database since I thought to do it a couple months ago. I've graphed some of the data here: http://www.teslametrics.com/chart

The temps definitely stop reporting regularly when the car isn't charging. The vampire drain, unfortunately, continues whether the temps are reported or not, so I doubt the temp reporting is related to battery temp maintenance or any other system shutting down.
 
Thank you guys for all of the documentation. I created a C# library for the Tesla Model S API's. I can post a link if anyone wants to use it. I am still waiting for my car to arrive too can fully test it, but it seems to work using the Test API from the documentation website.

I am very excited about making apps for the Tesla!! What other car comes with developer API's?!
 
So I have copied and modified the shell script slightly:

1.) Send me a text message if the car cannot be reached
2.) Send me a text message (with the current range) if the car is not plugged in
3.) Send me a mail message with the current range if the car IS plugged in - this is a heartbeat so I know the script is running as I don't check my email on my phone

I also run the script at 9:30pm and 6:00am via cron.

The last 4 times the script ran the car was plugged in and I got:

1.) Could not communicate
2.) Not plugged in
3.) Not plugged in
4.) Not plugged in

After the 2nd or 3rd message I immediately logged into the server and re-ran the script manually and it worked...
Should I attempt two accesses before giving up? Is anyone else seeing this type of behavior.

On second thought, I rebooted this morning to fix the "Slacker not showing song names on the 17" display" issue.
Now I'm feeling like it will work tonight..
 
I've been dumping all readings every 10 minutes to a database since I thought to do it a couple months ago. I've graphed some of the data here: http://www.teslametrics.com/chart

The temps definitely stop reporting regularly when the car isn't charging. The vampire drain, unfortunately, continues whether the temps are reported or not, so I doubt the temp reporting is related to battery temp maintenance or any other system shutting down.

you know that the vampire drain is caused by you fully waking up the car every time you ping it with the REST API, right? I was told by a lead tech that using the iphone app or REST API fully wakes up the car and immediately starts draining the 12V battery, then the MS battery kicks on to start recharging the 12V, then the heating and cooling systems kick on to stabilize the MS battery temps, etc... he said this is the cause of the big "vampire drains" and not good for the battery - i.e. unnecessary drain means you need to charge more every day...more cycles over the battery's life which speeds up lithium ion battery degradation. So in short, by pinging your car every 10 minutes it's fully awake 24/7 and you're essentially "maximizing" the degradation rate of the battery.
 
you know that the vampire drain is caused by you fully waking up the car every time you ping it with the REST API, right? I was told by a lead tech that using the iphone app or REST API fully wakes up the car and immediately starts draining the 12V battery, then the MS battery kicks on to start recharging the 12V, then the heating and cooling systems kick on to stabilize the MS battery temps, etc... he said this is the cause of the big "vampire drains" and not good for the battery - i.e. unnecessary drain means you need to charge more every day...more cycles over the battery's life which speeds up lithium ion battery degradation. So in short, by pinging your car every 10 minutes it's fully awake 24/7 and you're essentially "maximizing" the degradation rate of the battery.

Nice story but it's just not true. The vampire drain is from the embedded computer that runs all the time and does not sleep (amongst other things). It's got nothing to do with the REST API. Plenty of people have vampire drain without using the REST API or the phone apps. Heck, I had vampire drain on my car before the mobile apps and the REST API where even invented.

Now when Sleep Mode is reintroduced this might be possible but for now, the car doesn't sleep in any appreciable way with or without the REST API calls.

Also, keep in mind that the REST API calls the Tesla servers NOT the car directly. The communications between Telsa's datcenter and the car is an separate link from the calls to portal.teslamotors.com. Obviously some REST commands do trigger load on the cars battery. Like explicitly turning on the HVAC system. However that doesn't mean that every REST API call drains the battery.
 
Also, keep in mind that the REST API calls the Tesla servers NOT the car directly. The communications between Telsa's datcenter and the car is an separate link from the calls to portal.teslamotors.com. Obviously some REST commands do trigger load on the cars battery. Like explicitly turning on the HVAC system. However that doesn't mean that every REST API call drains the battery.

yeah, i was gonna point this out. hans, any idea how often the tm server pings the car normally, if no mobile app or other portal access is requesting data is there a set interval that the tm server will use to keep telemetry updated? just curious...
 
yeah, i was gonna point this out. hans, any idea how often the tm server pings the car normally, if no mobile app or other portal access is requesting data is there a set interval that the tm server will use to keep telemetry updated? just curious...

Its unknown how frequently the car talks to the mothership. Since this data path is over 3G it's harder to snoop.
 
Hi Folks!

I'm eagerly awaiting my model S. I cranked out a quick script to notify me once my car is listed in the the /vehicles call.

Does anyone know if /vehicles/{id}/command/drive_state works once the car is on the truck? Or is all of that disabled until delivery? I thought it might be fun to track it across the country prior to delivery. :)
 
Hi Folks!

I'm eagerly awaiting my model S. I cranked out a quick script to notify me once my car is listed in the the /vehicles call.

Does anyone know if /vehicles/{id}/command/drive_state works once the car is on the truck? Or is all of that disabled until delivery? I thought it might be fun to track it across the country prior to delivery. :)

Likely will not work as the default is to have mobile access disabled (and that's something that can only be changed from the console of the car).
Congrats Eggplant!