Forum

Unisciti allacomunità
REGISTRAZIONEAccedi

Python bindings for the Model S API

Hello,

For those inclined to programming I posted python bindings to the Model S REST API: https://github.com/nside/pytesla
It makes it possible to schedule charging time and monitor various stats (battery, driving locations, etc). I'm sure new usage scenarios will emerge with these kind of tools available to developers & users.
Cheers
D

Nice. Thanks.

@dlaprise@gmail.com
Lost.
Does one need programming expertise to understand and take advantage of your link?

@Hills - yes, you would need to be able to write a program in python to be able to use it.

I have a set of PowerShell functions as well if anyone is interested. I'll put them up on Github if anyone wants them.

-Joe

I'm finishing a php class for it. If anyone is interested, you can email me to my user at gmail.com.

Scheduling! Stick a GUI on it any you've got a boatload of customers.

typo: "on it and you've ..."

@BrianH - scheduling is a bit harder for most people, since the car doesn't have a timer yet and therefore the client using these APIs has to initiate charging at the right time. That means the machine telling the car to start charging has to be on, so for people that turn off their computer when it isn't being used they need some place else for it to run.

I'm working on a web app that will run on Google App Engine and provide that functionality, though it may not be done before 4.3 is released which looks like it will have a simple charging timer.

Very cool. Thanks for sharing this!

Very cool! Thanks for sharing.

?? The car must have a clock! The OS' time function, if nothing else.

It does have a clock alright...
It should have cron too, but it's not clear if any of this is exposed via API, and it's not clear what effect the sleep mode has on all of that.
External trigger looks like a better idea to me provided that something is still handling external connections (wake on network activity) while the car is sleeping.

Anyone work on a Java version yet? I was thinking of basing one off of the Python bindings and making a front-end for it.

@dbullard ... Java version would be great.

But, why do you need the Python bindings. Can't you use the REST APY's directly? More information is available at http://docs.timdorr.apiary.io/. I got this URL from dlaprise's README file https://github.com/nside/pytesla/blob/master/README.rst.

@dbullard - yes, I am working on a Java library that can be used on the server, Android, and compiled with GWT.

@prash.saka - sure, you can directly make the calls, but it is nicer to have more structure about it and somebody else to worry about keeping them up to date when the APIs change :).

Actually, I'd missed http://docs.timdorr.apiary.io/ - that will save me a lot of time!

I typically like to look at other folks implementation, even in other languages, as it gives me ideas I might not have thought of.

"Steal from the best, and write the rest!" is my motto.

@jat: Is your Java library published somewhere? Now that I have my Model S I'm ready to start playing with the APIs. I was poking around looking for a Java library and I ran across this thread.

@joe - not yet, a number of things came up so I haven't finished it yet. It probably won't happen until after taxes are filed.

@jat: Good luck with your taxes. I'll check back periodically and look for an update.

@jat@jaet.org - any luck with the java code? I can login successfully, but I get only one cookie "_s_portal_session", not the second one "user_credentials", without which I am unable to use subsequent REST API

Ok, I was able to get the Java login working - the rest should be easy. The key piece that needed to be done was to set the FollowRedirects to false (HttpsURLConnection.setInstanceFollowRedirects(false)) otherwise the "user_credentials" was not being sent for subsequent calls.

> Ok, I was able to get the Java login working - the rest should be easy.

Are you going to share your (Java) code? Would be great to integrate the Model S with HomeAutomation Systems like openHAB … using the TTS-Engine or the Philipps Hue to inform about the current load factor, using Location Data to activate certain "coming home processes", etc..

Cheers,

Thomas E.-E.


X Deutschland Site Besuchen