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.
4 updates a second sounds like a lot until you try and measure 0-60 mph times and realize that its either 5.0 seconds or 5.25 second and nothing in between.

Couldn't you interpolate and get an accurate result?

ie. if the car is going 55mph @ 5.0s and 65mph @ 5.25s wouldn't the time be somewhere in the neighbourhood of 5.12s?

If you could calculate the cars acceleration @ 5.0s and @ 5.25s you could probably get something fairly accurate assuming the speedometer is accurate.

I think a 0-60 and 1/4 mile timer Model S app would be awesome to have!

Does the speed in the API come from the speedometer or from the GPS?
 
Last edited:
Visible Tesla 0.1

I slapped together a Java client library and a little interactive command line tool to test it out. I've been meaning to learn a little about the JavaFX library and tools so I set out to put together a simple GUI. I haven't been a programmer for a living for many years and only had little snippets of time to work on this, but I got the basics working. My lower level client library provides access to the streaming APIs, but I didn't expose that functionality in the app (yet, or maybe ever).

Moderators: I've included 12 screenshots below. If there are too many and they should be links instead, I am happy to edit the post. I wasn't sure about the etiquette for this.

The app has a tabbed interface with one tab per functional area. When you launch you start out in a login tab and the other tabs are disabled until you log in. If you've logged in before then it automatically logs you in again based on stored cookies. This screenshot shows the logged-in state:

01 Login Tab.png

The Overview tab shows basic state about the vehicle and gives access to commands like lock/unlock, operating the panoramic roof (if you have one), flashing the lights, etc. These screen shots show the overview tab reflecting various states of the car. The roof was vented using the "Vent" button.
02 Overview Tab.png
03 Overview Vented.png
04 Overview Door Open.png

Next we have the HVAC tab which shows the state of that system. It also allows you to set the target temperature and turn on/off the system.
05 HVAC Tab.png

The location tab embeds a Google map to show the current location and the marker is rotated to show the current heading. There is a "Browse" button that will launch a browser displaying a Google map with the car's location so you can get directions, etc.
06 Location Tab.png

The last tab shows the charge state and allows you to set the charge target (max or std) and start/stop charging. The screen shots show the car when not connected to a charger, connected but not charging, and charging. In this case it is connected to an HPWC which is still limited to 60A.
07 Charge Tab.png
08 Charge Plugged In.png
09 Charging.png

This screen shot shows the "spinner" that is displayed when the app is communicating with the vehicle. Each tab has a refresh button and the app auto-refreshes once 15 seconds have elapsed since the last manual or automatic refresh. Switching tabs does an auto refresh on the newly selected tab.
12 Auto Refresh.png

Finally, I added a simulation menu so I could look at vehicle configurations other than my own. These screen shots show changing the color to red and using dark rims. I don't have images for every possible configuration including the 19" wheels which I happen to have.
10 Simulate Color Red.png
11 Simulate Dark Rims.png

It's been a fun exercise. I wish they would add a few more bits of functionality to the API. For example, I'd love to be able to send a destination to the nav system.
 
I slapped together a Java client library and a little interactive command line tool to test it out. I've been meaning to learn a little about the JavaFX library and tools so I set out to put together a simple GUI. I haven't been a programmer for a living for many years and only had little snippets of time to work on this, but I got the basics working.
This is very nice and impressive, especially considering that you "haven't been a programmer for a living for many years"! I'd like to run this on my computer (Mac) and would really like to see this as something available for everyone.
 
Share, or you're just showing off ;-)

I'm happy to share. I need to make sure I can make it build somewhere other than my machine then I will zip it up and put it someplace.

--- Update ---
OK, have at it: https://dl.dropboxusercontent.com/u/7045813/Dev.zip

Unzip this this and you'll see 2 top level directories: Tesla and ThirdParty. The latter is a collection of the third party libraries that are used (eg apache-commons, etc.). The former has two subdirectories: Tesla and VisibleTesla. These are netbeans projects. The first is the client library and simple test programs. The latter is the app built on the client.

I did build it on another machine but have done no other testing. I've only run this on a mac. I haven't tried Windows or any flavor of Linux and won't be doing that in the future. Good luck!

P.S. If there are any bits that shouldn't be there, please let me know. I tried to remove any vestiges of old libraries and other cruft, but I probably missed things.
 
Last edited:
I'm happy to share. I need to make sure I can make it build somewhere other than my machine then I will zip it up and put it someplace.

--- Update ---
OK, have at it: https://dl.dropboxusercontent.com/u/7045813/Dev.zip

Unzip this this and you'll see 2 top level directories: Tesla and ThirdParty. The latter is a collection of the third party libraries that are used (eg apache-commons, etc.). The former has two subdirectories: Tesla and VisibleTesla. These are netbeans projects. The first is the client library and simple test programs. The latter is the app built on the client.

I did build it on another machine but have done no other testing. I've only run this on a mac. I haven't tried Windows or any flavor of Linux and won't be doing that in the future. Good luck!

P.S. If there are any bits that shouldn't be there, please let me know. I tried to remove any vestiges of old libraries and other cruft, but I probably missed things.


Thanks for sharing!
 
Impressive to say the least! I just downloaded to my mac but I have no clue as how to proceed next...without an install wizard, lol. Screenshots look good though.

There is a chance that if you go to Dev/Tesla/VisibleTesla/dist and double click on VisibleTesla.jar, that it will run properly. It may have other java dependencies (like javafx) that aren't installed on your machine. I no longer have a virgin environment to test with.

Perhaps some kind soul with more up-to-date skills than I will build a properly packaged distribution.
 
There is a chance that if you go to Dev/Tesla/VisibleTesla/dist and double click on VisibleTesla.jar, that it will run properly. It may have other java dependencies (like javafx) that aren't installed on your machine. I no longer have a virgin environment to test with.

Perhaps some kind soul with more up-to-date skills than I will build a properly packaged distribution.


Works for me! I let my wife know because she works with the JavaFX folks at Oracle. I told her you should be on stage giving this demo at JavaOne ;-)
 
There is a chance that if you go to Dev/Tesla/VisibleTesla/dist and double click on VisibleTesla.jar, that it will run properly. It may have other java dependencies (like javafx) that aren't installed on your machine. I no longer have a virgin environment to test with.

Works for me also on my Mac running OSX 10.9 beta. I've created an alias on my desktop so I can launch the app with a single click.

Thanks for your great work. Now you'll start to get feature requests - like to have metric units support ;)
 
Version 0.11 of VisibleTesla is posted here: https://dl.dropboxusercontent.com/u/7045813/Dev0.11.zip

It contains:

  • Minor changes to the login tab (cosmetic changes and field traversal fix)
  • Experimental support for metric units
    • It now checks the car's GUI settings and follows the settings for F|C temp & miles|km
    • This is reflected in the Charge tab and the HVAC tab
    • There is a new item in the Simulate menu that allows you to override your car's unit setting and choose Metric or Imperial. If you do this, you will need to change tabs before the simulated setting takes effect
  • Minor internal tweaks that aren't visible in the GUI

Note:
  • Whenever you send a command via the GUI (e.g., vent the roof or turn on HVAC), the app immediately checks the state to see whether the command succeeded. On occasion I've noticed that the result of the command is not reflected immediately. It will show up when the next auto-refresh happens or if you manually refresh.

I haven't actually changed the units setting in my car - I've only tested through simulation. If you use metric settings, please let me know if it works.
 
aha! brilliant. thanks SO much for sharing. very useful.

i really appreciate all the talented people out there sharing so freely their work and noodling with these things. it's an admirable community and i'm proud to be part.

edit: now all we need is tm to implement the remote drive-by-wire api's and we can have our cars come pick us up. :) (i give it 15 years....)

question: can you implement/does the tm server support https for authentication and data comms? (even though https is feeling less and less secure these days...)
 
Last edited: