You can install our site as a web app on your iOS device by utilizing the Add to Home Screen feature in Safari. Please see this thread for more details on this.
Note: This feature may not be available in some browsers.
Tesla switched to WebSockets for Summon and HomeLink.
They connect to wss://streaming.vn.teslamotors.com/
On a successful connection, the server responds with
{"autopark":{"autopark_pause_timeout":2000,"autopark_stop_timeout":10000,"heartbeat_frequency":500},"connection_timeout":20000,"msg_type":"control:hello"}
followed by:
{"autopark_state":"ready","msg_type":"autopark:status"}
{"homelink_nearby":true,"msg_type":"homelink:status"}
During auto park/summon, the server will send a heartbeat, like this:
{"msg_type":"autopark:heartbeat_car","timestamp":488163277436.176025}
{"msg_type":"autopark:heartbeat_car","timestamp":488163277936.211975}
When summon forward is requested, the server replies with:
{"cmd_type":"autopark:cmd_forward","msg_type":"autopark:cmd_result","reason":"","result":true}.E{"msg_type":"autopark:heartbeat_car","timestamp":488163276934.765991}
When summon is cancelled, the server sends:
{"cmd_type":"autopark:cmd_abort","msg_type":"autopark:cmd_result","reason":"","result":true}
{"autopark_state":"aborting","msg_type":"autopark:status"}
{"latitude":43.589033,"longitude":-121.858813,"msg_type":"vehicle_data:location"} (altered to not publish my house's location )
{"autopark_state":"ready","msg_type":"autopark:status"}
Obviously, this is missing what the client sends to the server. That's mostly because it's either compressed or not ASCII and I need to recompile my test code to give me hex bytes instead of ASCII in that situation before I can figure out the commands.
@Polyport You were close. They're using some interesting choices of JSON serialization for their message objects in the Android client. Not sure of the equivalent over on the iOS side, but I haven't looked into that version in a while. (Perhaps they're binding to Java now?)
Anyways, I'll list out some initial findings over on the Github repo: GitHub - timdorr/model-s-api: A Ruby gem and unofficial documentation of the Tesla JSON API
Nope, it's in there. There's a heartbeat_car server response and heartbeat_app client command. You should issue those at the rate that the control:hello asks you to.I think you missed the autopark:heartbeat_app -> timestamp in your list
Nope, it's in there. There's a heartbeat_car server response and heartbeat_app client command. You should issue those at the rate that the control:hello asks you to.
@rog, it was not working for me either however, I rebooted my car computer and force shut down the app. When loading again it successfully connected and summon started working. My guess is Tesla kind of sends the connection data to the app and it updates the endpoints behind the seen!
I've added some very basic support to the tesla_api Ruby gem: Autopark support in gem by timdorr · Pull Request #31 · timdorr/model-s-api · GitHub
I don't have a recent MS to test against, so I can't do anything other than connect and confirm the heartbeat stuff all works. If anyone can help, that would be appreciated!
Since you could validly do this via the mobile apps I am guessing they would account for this scenario.
<script>
var request = new XMLHttpRequest();
request.open('POST', 'https://owner-api.teslamotors.com/api/1/vehicles/<?=$VEHICLE_ID?>/wake_up');
request.setRequestHeader('Authorization', 'Bearer <?=$token?>');
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
alert ("response: "+this.status + " -- " + this.responseText);
}
};
request.send();
</script>
XMLHttpRequest cannot load https://owner-api.teslamotors.com/api/1/vehicles/71923157...0506/wake_up. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://iteconomy.ch' is therefore not allowed access. The response had HTTP status code 404.
So since commands in PHP always return 404, I tried javascript:
<snip>
Code:XMLHttpRequest cannot load https://owner-api.teslamotors.com/api/1/vehicles/71923157...0506/wake_up. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://iteconomy.ch' is therefore not allowed access. The response had HTTP status code 404.
Am I blocked or something??