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.
HA is unfortunately not an option here, but what I wanted was the opposite of this. Home link works perfectly from the car, but I still need the garage opener when entering the garage on foot.
So if it was possible to trigger Home link in the car from my phone, I could do that and not bother with the remote for the garage at all.
 
If you have a home automation system, VisibleTesla makes that possible. I have VT notify the HA system when the car enters or leaves the area, and adjust lights, open garage door, etc.
Which HA system do you use and how did you integrate?

VisibleTesla has a notification system that can send emails when certain events occur including when your car enters or exits a target area (defined as a radius around a point). Normally VT would send an email notification, but it can also do an HTTP GET on a url of your choosing. In the next version it will be able to execute an arbitrary command of your choosing, including a cURL command, shell script, or whatever else you'd like. This will make it much more flexible in terms of how it integrates with other services. I've tried this out by having it run cURL commands that talk to my insteon controller to turn lights on and off.

I have some high priority bugs I need to exterminate, but once those are handled, I'll get this capability out there.
 
VisibleTesla has a notification system that can send emails when certain events occur including when your car enters or exits a target area (defined as a radius around a point). Normally VT would send an email notification, but it can also do an HTTP GET on a url of your choosing. In the next version it will be able to execute an arbitrary command of your choosing, including a cURL command, shell script, or whatever else you'd like. This will make it much more flexible in terms of how it integrates with other services. I've tried this out by having it run cURL commands that talk to my insteon controller to turn lights on and off.

I have some high priority bugs I need to exterminate, but once those are handled, I'll get this capability out there.

Sounds cool. I use homeseer so should be able to figure out how to do this with http commands. Thanks!
 
Anyone else seeing intermittent (but frequent) 503 return codes when querying state? For example when doing a:
/vehicles/VVVV/command/charge_state​
It's been acting up for me over the past few days. I posted elsewhere that waking up the car remotely is dodgy for me now too - even using the official app.
 
Is there a complete list of available parameters for the streaming api anywhere?

I am currently trying to get the lock-status, but neither "locked", "locked_status" or "lock_status" returns anything from the streaming.js command.
I can ofcourse use teslacmd -v, but as I am already polling the streaming API it would be better if I could get all info from that process, rather than polling Teslas servers (and the car) more frequently than really necessary.
 
Is there a complete list of available parameters for the streaming api anywhere?

I am currently trying to get the lock-status, but neither "locked", "locked_status" or "lock_status" returns anything from the streaming.js command.
I can ofcourse use teslacmd -v, but as I am already polling the streaming API it would be better if I could get all info from that process, rather than polling Teslas servers (and the car) more frequently than really necessary.

Lock state is from the REST api not the streaming. Search on Tesla API and you will find the docs.
 
Lock state is from the REST api not the streaming. Search on Tesla API and you will find the docs.

I have the docs on the apiary site. And I am aware of the REST call to get lock status. I only hoped that this info was also available via the streaming API. And I can't seem to find a full list of parameters this API accept.
In the documentation for streaming.js, all I could find was:
-v, --values List of values to collect [default: "speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state"](from hjespers/teslams · GitHub)
But these are the _default_ values. It is not stated that these are the _only_ possible values.

Another, unrelated issue is that I am currently unable to log in via the API. It worked fine until yesterday. I can log in on the My Tesla webpage, but all API-calls return a "Login failed".
The official android app works though, so something fishy is going on...

- - - Updated - - -

So, the last issue has been "resolved":
"You have been blocked for making too many requests!"
- Which is what I feared - and the reason I wanted to get as much info from the streaming api as possible - to avoid extra connections to the servers just to get trivial info like lock status and charge status.

Any idea if the block is removed automatically after a while?
 
So, the last issue has been "resolved":
"You have been blocked for making too many requests!"
- Which is what I feared - and the reason I wanted to get as much info from the streaming api as possible - to avoid extra connections to the servers just to get trivial info like lock status and charge status.

Any idea if the block is removed automatically after a while?

Yes, they do. Stop making requests for a few days (or longer) and it will start working again. I'm not sure what the threshold is for getting blocked, I have a few times now. I query every 5 minutes and I still get blocked some times. I need to re-write my departure time based charge scheduling script to draw from already queried data instead of pulling charge stats for itself. I think that puts me at 2-3 queries every 5 minutes.
 
Yeah. I was unblocked after about a day or so. Fortunately I have plenty of IP-addresses to connect from, so I just had to connect from another source IP to continue my development.

I have now pulled data from all the known REST-functions about once every minute for more than 24 hours, and it seems to work fine so far.
I wrote a simple "daemon" that pulls the data, and insert it into a SQLite-database, so I can query this database from other apps/frontends without bothering Teslas servers with more than one process.