tesla_api 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/README.md +2 -1
- data/Rakefile +5 -0
- data/apiary.apib +401 -123
- data/circle.yml +10 -0
- data/lib/tesla_api.rb +1 -0
- data/lib/tesla_api/stream.rb +49 -0
- data/lib/tesla_api/vehicle.rb +43 -61
- data/lib/tesla_api/version.rb +1 -1
- data/spec/cassettes/{vehicle-remove_start_drive.yml → vehicle-remote_start_drive.yml} +0 -0
- data/spec/cassettes/vehicle-reset_valet_pin.yml +85 -0
- data/spec/cassettes/vehicle-set_valet_mode.yml +85 -0
- data/spec/lib/tesla_api/vehicle_spec.rb +22 -2
- data/spec/spec_helper.rb +1 -0
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18033816ec5eb77b7103295925eecef144e0c601
|
4
|
+
data.tar.gz: 372b7eccdcba14d8c7be82a45d3df1719f3c7ec5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a38e04aa77bf22edc412f1d3af818b7a2f4c79255ce909e96a282808ca9441a71d42d51bc47760696b0783365fb89a4f186eb150fddec8afe2b075eb57da2af6
|
7
|
+
data.tar.gz: aaceed89e6cc188b2dfcf8a51c07bb3bf5158f4c86f62a978c2b20c78d94dfeae6e4d114d9ffb52a1dc1d9d1d9fe3b91863a837e6db59cd954aaf28245ad592d
|
data/.travis.yml
CHANGED
@@ -2,12 +2,14 @@ language: ruby
|
|
2
2
|
rvm:
|
3
3
|
- 1.9.3
|
4
4
|
- 2.0.0
|
5
|
-
- 2.
|
5
|
+
- 2.2.2
|
6
|
+
- 2.3.0
|
6
7
|
env:
|
7
8
|
global:
|
8
9
|
- TESLA_EMAIL=elon.musk@teslamotors.com
|
9
10
|
- TESLA_PASS=oilLOL
|
10
11
|
- TESLA_CLIENT_ID=1
|
11
12
|
- TESLA_CLIENT_SECRET=2
|
13
|
+
- TESLA_API_TOKEN=3
|
12
14
|
notifications:
|
13
15
|
email: false
|
data/README.md
CHANGED
@@ -30,7 +30,8 @@ Here's a quick example:
|
|
30
30
|
```ruby
|
31
31
|
require 'tesla_api'
|
32
32
|
|
33
|
-
tesla_api = TeslaApi::Client.new(email,
|
33
|
+
tesla_api = TeslaApi::Client.new(email, client_id, client_secret)
|
34
|
+
tesla_api.login!(password) # Or tesla_api.token = token if you have an existing token.
|
34
35
|
model_s = tesla_api.vehicles.first # => <TeslaApi::Vehicle>
|
35
36
|
|
36
37
|
model_s.wake_up
|
data/Rakefile
CHANGED
@@ -5,4 +5,9 @@ RSpec::Core::RakeTask.new(:spec) do |task|
|
|
5
5
|
task.rspec_opts = ['--color', '--format', 'documentation', '--require', 'spec_helper']
|
6
6
|
end
|
7
7
|
|
8
|
+
desc "Open an irb session preloaded with this library"
|
9
|
+
task :console do
|
10
|
+
sh "irb -rubygems -I lib -r tesla_api.rb -rdotenv"
|
11
|
+
end
|
12
|
+
|
8
13
|
task default: :spec
|
data/apiary.apib
CHANGED
@@ -1,62 +1,57 @@
|
|
1
1
|
FORMAT: 1A
|
2
|
-
HOST: https://
|
2
|
+
HOST: https://owner-api.teslamotors.com
|
3
3
|
|
4
4
|
# Tesla Model S JSON API
|
5
5
|
This is unofficial documentation of the Tesla Model S JSON API used by the iOS and Android apps. It features functionality to monitor and control the Model S remotely.
|
6
6
|
|
7
|
-
# Group Authentication
|
8
|
-
These endpoints handle login and session management
|
7
|
+
# Group Authentication
|
9
8
|
|
10
|
-
##
|
11
|
-
Returns the login form. Sets a `_s_portal_session` cookie for the session
|
12
|
-
+ Response 200
|
9
|
+
## Tokens [/oauth/token]
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
Set-Cookie: _s_portal_session={cookie}; path=/; secure; HttpOnly
|
17
|
-
|
18
|
-
+ Body
|
11
|
+
### Get an Access Token [POST]
|
12
|
+
Performs the login. Takes in an plain text email and password, matching the owner's login information for [https://my.teslamotors.com/user/login](https://my.teslamotors.com/user/login).
|
19
13
|
|
20
|
-
|
14
|
+
Returns a `access_token` which is passed along as a header with all future requests to authenticate the user.
|
21
15
|
|
22
|
-
|
23
|
-
Performs the login. Takes in an plain text email and password, matching the owner's login from [http://teslamotors.com/mytesla](http://teslamotors.com/mytesla).
|
16
|
+
You must provide the `Authorization: Bearer {access_token}` header in all other requests.
|
24
17
|
|
25
|
-
|
18
|
+
The current client ID and secret are [available here](http://pastebin.com/fX6ejAHd)
|
26
19
|
|
27
|
-
|
28
|
-
+
|
20
|
+
+ Parameters
|
21
|
+
+ grant_type: `password` (string) - The type of oAuth grant. Always "password"
|
22
|
+
+ client_id: `abc` (string) - The oAuth client ID
|
23
|
+
+ client_secret: `123` (string) - The oAuth client secret
|
24
|
+
+ email: `elon@teslamotors.com` (string) - The email for my.teslamotors.com
|
25
|
+
+ password: `edisonsux` (string) - The password for my.teslamotors.com
|
29
26
|
|
27
|
+
+ Response 200 (application/json)
|
30
28
|
+ Body
|
31
29
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
Set-Cookie: _s_portal_session={cookie}; path=/; secure; HttpOnly
|
39
|
-
Set-Cookie: user_credentials=x; path=/; expires=Fri, 03-May-2013 03:01:54 GMT; secure; HttpOnly
|
40
|
-
Location: https://portal.vn.teslamotors.com/
|
41
|
-
|
30
|
+
{
|
31
|
+
"access_token": "abc123",
|
32
|
+
"token_type": "bearer",
|
33
|
+
"expires_in": 7776000
|
34
|
+
}
|
42
35
|
|
43
|
-
|
36
|
+
# Group Vehicles
|
37
|
+
A logged in user can have multiple vehicles under their account. This resource is primarily responsible for listing the vehicles and the basic details about them.
|
44
38
|
|
45
|
-
|
39
|
+
## Vehicle Collection [/api/1/vehicles]
|
46
40
|
|
41
|
+
### List all Vehicles [GET]
|
42
|
+
Retrieve a list of your owned vehicles (includes vehicles not yet shipped!)
|
47
43
|
|
48
|
-
|
49
|
-
|
44
|
+
+ Request
|
45
|
+
+ Headers
|
50
46
|
|
51
|
-
|
47
|
+
Authorization: Bearer {access_token}
|
52
48
|
|
53
|
-
## GET /vehicles
|
54
|
-
Retrieve a list of your owned vehicles (includes vehicles not yet shipped!)
|
55
49
|
+ Response 200 (application/json)
|
56
50
|
|
57
51
|
+ Body
|
58
52
|
|
59
|
-
|
53
|
+
{
|
54
|
+
"response": [{
|
60
55
|
"color": null,
|
61
56
|
"display_name": null,
|
62
57
|
"id": 321,
|
@@ -66,40 +61,56 @@ Retrieve a list of your owned vehicles (includes vehicles not yet shipped!)
|
|
66
61
|
"vin": "5YJSA1CN5CFP01657",
|
67
62
|
"tokens": ["x", "x"],
|
68
63
|
"state": "online"
|
69
|
-
|
64
|
+
}],
|
65
|
+
"count":1
|
66
|
+
}
|
70
67
|
|
71
68
|
|
72
|
-
|
69
|
+
## State and Settings [/api/1/vehicles/{vehicle_id}]
|
73
70
|
These resources are read-only and determine the state of the vehicle's various sub-systems.
|
74
71
|
|
75
|
-
|
72
|
+
+ Parameters
|
76
73
|
|
77
|
-
|
74
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
75
|
+
|
76
|
+
## Mobile Access [GET /api/1/vehicles/{vehicle_id}/mobile_enabled]
|
78
77
|
Determines if mobile access to the vehicle is enabled.
|
78
|
+
|
79
|
+
+ Request
|
80
|
+
+ Headers
|
81
|
+
|
82
|
+
Authorization: Bearer {access_token}
|
83
|
+
|
79
84
|
+ Parameters
|
80
85
|
|
81
|
-
+
|
86
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
82
87
|
|
83
88
|
+ Response 200 (application/json)
|
84
89
|
|
85
90
|
+ Body
|
86
91
|
|
87
92
|
{
|
88
|
-
"
|
89
|
-
"result":true
|
93
|
+
"response": true
|
90
94
|
}
|
91
95
|
|
92
|
-
## GET /vehicles/{
|
96
|
+
## Charge State [GET /api/1/vehicles/{vehicle_id}/data_request/charge_state]
|
93
97
|
Returns the state of charge in the battery.
|
98
|
+
|
99
|
+
+ Request
|
100
|
+
+ Headers
|
101
|
+
|
102
|
+
Authorization: Bearer {access_token}
|
103
|
+
|
94
104
|
+ Parameters
|
95
105
|
|
96
|
-
+
|
106
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
97
107
|
|
98
108
|
+ Response 200 (application/json)
|
99
109
|
|
100
110
|
+ Body
|
101
111
|
|
102
112
|
{
|
113
|
+
"response": {
|
103
114
|
"charging_state": "Complete", // "Charging", ??
|
104
115
|
"charge_to_max_range": false, // current std/max-range setting
|
105
116
|
"max_range_charge_counter": 0,
|
@@ -118,19 +129,27 @@ Returns the state of charge in the battery.
|
|
118
129
|
"time_to_full_charge": null, // valid only while charging
|
119
130
|
"charge_rate": -1.0, // float mi/hr charging or -1 if not charging
|
120
131
|
"charge_port_door_open": true
|
132
|
+
}
|
121
133
|
}
|
122
134
|
|
123
|
-
## GET /vehicles/{
|
135
|
+
## Climate Settings [GET /api/1/vehicles/{vehicle_id}/data_request/climate_state]
|
124
136
|
Returns the current temperature and climate control state.
|
137
|
+
|
138
|
+
+ Request
|
139
|
+
+ Headers
|
140
|
+
|
141
|
+
Authorization: Bearer {access_token}
|
142
|
+
|
125
143
|
+ Parameters
|
126
144
|
|
127
|
-
+
|
145
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
128
146
|
|
129
147
|
+ Response 200 (application/json)
|
130
148
|
|
131
149
|
+ Body
|
132
150
|
|
133
151
|
{
|
152
|
+
"response": {
|
134
153
|
"inside_temp": 17.0, // degC inside car
|
135
154
|
"outside_temp": 9.5, // degC outside car or null
|
136
155
|
"driver_temp_setting": 22.6, // degC of driver temperature setpoint
|
@@ -139,56 +158,80 @@ Returns the current temperature and climate control state.
|
|
139
158
|
"is_front_defroster_on": null, // null or boolean as integer?
|
140
159
|
"is_rear_defroster_on": false,
|
141
160
|
"fan_status": 0 // fan speed 0-6 or null
|
161
|
+
}
|
142
162
|
}
|
143
163
|
|
144
|
-
## GET /vehicles/{
|
164
|
+
## Driving and Position [GET /api/1/vehicles/{vehicle_id}/data_request/drive_state]
|
145
165
|
Returns the driving and position state of the vehicle.
|
166
|
+
|
167
|
+
+ Request
|
168
|
+
+ Headers
|
169
|
+
|
170
|
+
Authorization: Bearer {access_token}
|
171
|
+
|
146
172
|
+ Parameters
|
147
173
|
|
148
|
-
+
|
174
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
149
175
|
|
150
176
|
+ Response 200 (application/json)
|
151
177
|
|
152
178
|
+ Body
|
153
179
|
|
154
180
|
{
|
181
|
+
"response": {
|
155
182
|
"shift_state": null, //
|
156
183
|
"speed": null, //
|
157
184
|
"latitude": 33.794839, // degrees N of equator
|
158
185
|
"longitude": -84.401593, // degrees W of the prime meridian
|
159
186
|
"heading": 4, // integer compass heading, 0-359
|
160
187
|
"gps_as_of": 1359863204 // Unix timestamp of GPS fix
|
188
|
+
}
|
161
189
|
}
|
162
190
|
|
163
|
-
## GET /vehicles/{
|
191
|
+
## GUI Settings [GET /api/1/vehicles/{vehicle_id}/data_request/gui_settings]
|
164
192
|
Returns various information about the GUI settings of the car, such as unit format and range display.
|
193
|
+
|
194
|
+
+ Request
|
195
|
+
+ Headers
|
196
|
+
|
197
|
+
Authorization: Bearer {access_token}
|
198
|
+
|
165
199
|
+ Parameters
|
166
200
|
|
167
|
-
+
|
201
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
168
202
|
|
169
203
|
+ Response 200 (application/json)
|
170
204
|
|
171
205
|
+ Body
|
172
206
|
|
173
207
|
{
|
208
|
+
"response": {
|
174
209
|
"gui_distance_units": "mi/hr",
|
175
210
|
"gui_temperature_units": "F",
|
176
211
|
"gui_charge_rate_units": "mi/hr",
|
177
212
|
"gui_24_hour_time": false,
|
178
213
|
"gui_range_display": "Rated"
|
214
|
+
}
|
179
215
|
}
|
180
216
|
|
181
|
-
## GET /vehicles/{
|
217
|
+
## Vehicle State [GET /api/1/vehicles/{vehicle_id}/data_request/vehicle_state]
|
182
218
|
Returns the vehicle's physical state, such as which doors are open.
|
219
|
+
|
220
|
+
+ Request
|
221
|
+
+ Headers
|
222
|
+
|
223
|
+
Authorization: Bearer {access_token}
|
224
|
+
|
183
225
|
+ Parameters
|
184
226
|
|
185
|
-
+
|
227
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
186
228
|
|
187
229
|
+ Response 200 (application/json)
|
188
230
|
|
189
231
|
+ Body
|
190
232
|
|
191
233
|
{
|
234
|
+
"response": {
|
192
235
|
"df": false, // driver's side front door open
|
193
236
|
"dr": false, // driver's side rear door open
|
194
237
|
"pf": false, // passenger's side front door open
|
@@ -205,229 +248,464 @@ Returns the vehicle's physical state, such as which doors are open.
|
|
205
248
|
"has_spoiler": false, // spoiler is installed
|
206
249
|
"roof_color": "Colored", // "None" for panoramic roof
|
207
250
|
"perf_config": "Base"
|
251
|
+
}
|
208
252
|
}
|
209
253
|
|
210
254
|
# Group Vehicle Commands
|
211
255
|
These commands alter the vehicles state, and return result (true/false) to indicate success, and if failure reason contains the cause of failure.
|
212
256
|
|
213
|
-
|
257
|
+
## Wake Up Car [POST /api/1/vehicles/{vehicle_id}/wake_up]
|
258
|
+
Wakes up the car from the sleep state. Necessary to get some data from the car.
|
259
|
+
|
260
|
+
+ Request
|
261
|
+
+ Headers
|
262
|
+
|
263
|
+
Authorization: Bearer {access_token}
|
264
|
+
|
265
|
+
+ Parameters
|
266
|
+
|
267
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
268
|
+
|
269
|
+
+ Response 200 (application/json)
|
270
|
+
|
271
|
+
+ Body
|
272
|
+
|
273
|
+
{
|
274
|
+
"response": {
|
275
|
+
"result": true,
|
276
|
+
"reason": ""
|
277
|
+
}
|
278
|
+
}
|
279
|
+
|
280
|
+
## Set Valet Mode [POST /api/1/vehicles/{vehicle_id}/command/set_valet_mode]
|
281
|
+
Sets valet mode on or off with a PIN to disable it from within the car. Reuses last PIN from previous valet session.
|
282
|
+
Valet Mode limits the car's top speed to 70MPH and 80kW of acceleration power. It also disables Homelink, Bluetooth and
|
283
|
+
Wifi settings, and the ability to disable mobile access to the car. It also hides your favorites, home, and work
|
284
|
+
locations in navigation.
|
285
|
+
|
286
|
+
+ Request
|
287
|
+
+ Headers
|
288
|
+
|
289
|
+
Authorization: Bearer {access_token}
|
290
|
+
|
291
|
+
+ Parameters
|
292
|
+
|
293
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
294
|
+
+ on: true (boolean) - Whether to enable or disable valet mode.
|
295
|
+
+ password: 1234 (number) - (optional) A 4 digit PIN code to unlock the car.
|
296
|
+
|
297
|
+
+ Response 200 (application/json)
|
298
|
+
|
299
|
+
+ Body
|
300
|
+
|
301
|
+
{
|
302
|
+
"response": {
|
303
|
+
"result": true,
|
304
|
+
"reason": ""
|
305
|
+
}
|
306
|
+
}
|
307
|
+
|
308
|
+
## Reset Valet PIN [POST /api/1/vehicles/{vehicle_id}/command/reset_valet_pin]
|
309
|
+
Resets the PIN set for valet mode, if set.
|
310
|
+
|
311
|
+
+ Request
|
312
|
+
+ Headers
|
313
|
+
|
314
|
+
Authorization: Bearer {access_token}
|
315
|
+
|
316
|
+
+ Parameters
|
317
|
+
|
318
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
319
|
+
|
320
|
+
+ Response 200 (application/json)
|
321
|
+
|
322
|
+
+ Body
|
323
|
+
|
324
|
+
{
|
325
|
+
"response": {
|
326
|
+
"result": true,
|
327
|
+
"reason": ""
|
328
|
+
}
|
329
|
+
}
|
330
|
+
|
331
|
+
## Open Charge Port [POST /api/1/vehicles/{vehicle_id}/command/charge_port_door_open]
|
332
|
+
Opens the charge port. Does not close the charge port (for now...)
|
333
|
+
|
334
|
+
+ Request
|
335
|
+
+ Headers
|
336
|
+
|
337
|
+
Authorization: Bearer {access_token}
|
214
338
|
|
215
|
-
## GET /vehicles/{id}/command/charge_port_door_open
|
216
|
-
Open the charge port.
|
217
339
|
+ Parameters
|
218
340
|
|
219
|
-
+
|
341
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
220
342
|
|
221
343
|
+ Response 200 (application/json)
|
222
344
|
|
223
345
|
+ Body
|
224
346
|
|
225
347
|
{
|
226
|
-
"
|
227
|
-
|
348
|
+
"response": {
|
349
|
+
"result": true,
|
350
|
+
"reason": ""
|
351
|
+
}
|
228
352
|
}
|
229
353
|
|
230
|
-
##
|
231
|
-
Set the charge mode to standard (
|
354
|
+
## Set Charge Limit to Standard [POST /api/1/vehicles/{vehicle_id}/command/charge_standard]
|
355
|
+
Set the charge mode to standard (90% under the new percentage system introduced in 4.5).
|
356
|
+
|
357
|
+
+ Request
|
358
|
+
+ Headers
|
359
|
+
|
360
|
+
Authorization: Bearer {access_token}
|
361
|
+
|
232
362
|
+ Parameters
|
233
363
|
|
234
|
-
+
|
364
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
235
365
|
|
236
366
|
+ Response 200 (application/json)
|
237
367
|
|
238
368
|
+ Body
|
239
369
|
|
240
370
|
{
|
241
|
-
"
|
242
|
-
|
371
|
+
"response": {
|
372
|
+
"result": false,
|
373
|
+
"reason": "already_standard"
|
374
|
+
}
|
243
375
|
}
|
244
376
|
|
245
|
-
##
|
246
|
-
Set the charge mode to max range (100% under the new percentage system introduced in 4.5).
|
377
|
+
## Set Charge Limit to Max Range [POST /api/1/vehicles/{vehicle_id}/command/charge_max_range]
|
378
|
+
Set the charge mode to max range (100% under the new percentage system introduced in 4.5). Use sparingly!
|
379
|
+
|
380
|
+
+ Request
|
381
|
+
+ Headers
|
382
|
+
|
383
|
+
Authorization: Bearer {access_token}
|
384
|
+
|
247
385
|
+ Parameters
|
248
386
|
|
249
|
-
+
|
387
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
250
388
|
|
251
389
|
+ Response 200 (application/json)
|
252
390
|
|
253
391
|
+ Body
|
254
392
|
|
255
393
|
{
|
256
|
-
"
|
257
|
-
|
394
|
+
"response": {
|
395
|
+
"result": false,
|
396
|
+
"reason": "already_max_range"
|
397
|
+
}
|
258
398
|
}
|
259
399
|
|
260
|
-
##
|
400
|
+
## Set Charge Limit [POST /api/1/vehicles/{vehicle_id}/command/set_charge_limit?percent={limit_value}]
|
261
401
|
Set the charge limit to a custom percentage.
|
402
|
+
|
403
|
+
+ Request
|
404
|
+
+ Headers
|
405
|
+
|
406
|
+
Authorization: Bearer {access_token}
|
407
|
+
|
262
408
|
+ Parameters
|
263
409
|
|
264
|
-
+
|
265
|
-
+ limit_value (number)
|
410
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
411
|
+
+ limit_value: `75` (number) - The percentage value
|
266
412
|
|
267
413
|
+ Response 200 (application/json)
|
268
414
|
|
269
415
|
+ Body
|
270
416
|
|
271
417
|
{
|
272
|
-
"
|
273
|
-
|
418
|
+
"response": {
|
419
|
+
"result": true,
|
420
|
+
"reason": ""
|
421
|
+
}
|
274
422
|
}
|
275
423
|
|
276
|
-
##
|
277
|
-
Start charging.
|
424
|
+
## Start Charging [POST /api/1/vehicles/{vehicle_id}/command/charge_start]
|
425
|
+
Start charging. Must be plugged in, have power available, and not have reached your charge limit.
|
426
|
+
|
427
|
+
+ Request
|
428
|
+
+ Headers
|
429
|
+
|
430
|
+
Authorization: Bearer {access_token}
|
431
|
+
|
278
432
|
+ Parameters
|
279
433
|
|
280
|
-
+
|
434
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
281
435
|
|
282
436
|
+ Response 200 (application/json)
|
283
437
|
|
284
438
|
+ Body
|
285
439
|
|
286
440
|
{
|
287
|
-
"
|
288
|
-
|
441
|
+
"response": {
|
442
|
+
"result": true,
|
443
|
+
"reason": "" // "already_started" if a charge is in progress
|
444
|
+
}
|
289
445
|
}
|
290
446
|
|
291
|
-
##
|
292
|
-
Stop charging.
|
447
|
+
## Stop Charging [POST /api/1/vehicles/{vehicle_id}/command/charge_stop]
|
448
|
+
Stop charging. Must already be charging.
|
449
|
+
|
450
|
+
+ Request
|
451
|
+
+ Headers
|
452
|
+
|
453
|
+
Authorization: Bearer {access_token}
|
454
|
+
|
293
455
|
+ Parameters
|
294
456
|
|
295
|
-
+
|
457
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
296
458
|
|
297
459
|
+ Response 200 (application/json)
|
298
460
|
|
299
461
|
+ Body
|
300
462
|
|
301
463
|
{
|
302
|
-
"
|
303
|
-
|
464
|
+
"response": {
|
465
|
+
"result": true,
|
466
|
+
"reason": "" // "not_charging" if a charge was not in progress
|
467
|
+
}
|
304
468
|
}
|
305
469
|
|
306
|
-
##
|
470
|
+
## Flash Lights [POST /api/1/vehicles/{vehicle_id}/command/flash_lights]
|
307
471
|
Flash the lights once.
|
472
|
+
|
473
|
+
+ Request
|
474
|
+
+ Headers
|
475
|
+
|
476
|
+
Authorization: Bearer {access_token}
|
477
|
+
|
308
478
|
+ Parameters
|
309
479
|
|
310
|
-
+
|
480
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
311
481
|
|
312
482
|
+ Response 200 (application/json)
|
313
483
|
|
314
484
|
+ Body
|
315
485
|
|
316
486
|
{
|
317
|
-
"
|
318
|
-
|
487
|
+
"response": {
|
488
|
+
"result": true,
|
489
|
+
"reason": ""
|
490
|
+
}
|
319
491
|
}
|
320
492
|
|
321
|
-
##
|
493
|
+
## Honk Horn [POST /api/1/vehicles/{vehicle_id}/command/honk_horn]
|
322
494
|
Honk the horn once.
|
495
|
+
|
496
|
+
+ Request
|
497
|
+
+ Headers
|
498
|
+
|
499
|
+
Authorization: Bearer {access_token}
|
500
|
+
|
323
501
|
+ Parameters
|
324
502
|
|
325
|
-
+
|
503
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
326
504
|
|
327
505
|
+ Response 200 (application/json)
|
328
506
|
|
329
507
|
+ Body
|
330
508
|
|
331
509
|
{
|
332
|
-
"
|
333
|
-
|
510
|
+
"response": {
|
511
|
+
"result": true,
|
512
|
+
"reason": ""
|
513
|
+
}
|
334
514
|
}
|
335
515
|
|
336
|
-
##
|
516
|
+
## Unlock Doors [POST /api/1/vehicles/{vehicle_id}/command/door_unlock]
|
337
517
|
Unlock the car's doors.
|
518
|
+
|
519
|
+
+ Request
|
520
|
+
+ Headers
|
521
|
+
|
522
|
+
Authorization: Bearer {access_token}
|
523
|
+
|
338
524
|
+ Parameters
|
339
525
|
|
340
|
-
+
|
526
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
341
527
|
|
342
528
|
+ Response 200 (application/json)
|
343
529
|
|
344
530
|
+ Body
|
345
531
|
|
346
532
|
{
|
347
|
-
"
|
348
|
-
|
533
|
+
"response": {
|
534
|
+
"result": true,
|
535
|
+
"reason": ""
|
536
|
+
}
|
349
537
|
}
|
350
538
|
|
351
|
-
##
|
539
|
+
## Lock Doors [POST /api/1/vehicles/{vehicle_id}/command/door_lock]
|
352
540
|
Lock the car's doors.
|
541
|
+
|
542
|
+
+ Request
|
543
|
+
+ Headers
|
544
|
+
|
545
|
+
Authorization: Bearer {access_token}
|
546
|
+
|
353
547
|
+ Parameters
|
354
548
|
|
355
|
-
+
|
549
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
356
550
|
|
357
551
|
+ Response 200 (application/json)
|
358
552
|
|
359
553
|
+ Body
|
360
554
|
|
361
555
|
{
|
362
|
-
"
|
363
|
-
|
556
|
+
"response": {
|
557
|
+
"result": true,
|
558
|
+
"reason": ""
|
559
|
+
}
|
364
560
|
}
|
365
561
|
|
366
|
-
##
|
562
|
+
## Set Temperature [POST /api/1/vehicles/{vehicle_id}/command/set_temps?driver_temp={driver_degC}&passenger_temp={pass_degC}]
|
367
563
|
Set the temperature target for the HVAC system.
|
564
|
+
|
565
|
+
+ Request
|
566
|
+
+ Headers
|
567
|
+
|
568
|
+
Authorization: Bearer {access_token}
|
569
|
+
|
368
570
|
+ Parameters
|
369
571
|
|
370
|
-
+
|
371
|
-
+ driver_degC (number)
|
372
|
-
+ pass_degC (number)
|
572
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
573
|
+
+ driver_degC: `23.7` (number) - The desired temperature on the driver's side in celcius.
|
574
|
+
+ pass_degC: `18.1` (number) - The desired temperature on the passenger's side in celcius.
|
373
575
|
|
374
576
|
+ Response 200 (application/json)
|
375
577
|
|
376
578
|
+ Body
|
377
579
|
|
378
580
|
{
|
379
|
-
"
|
380
|
-
|
581
|
+
"response": {
|
582
|
+
"result": true,
|
583
|
+
"reason": ""
|
584
|
+
}
|
381
585
|
}
|
382
586
|
|
383
|
-
##
|
587
|
+
## Start Air Condition [POST /api/1/vehicles/{vehicle_id}/command/auto_conditioning_start]
|
384
588
|
Start the HVAC system. Will cool or heat automatically, depending on set temperature.
|
589
|
+
|
590
|
+
+ Request
|
591
|
+
+ Headers
|
592
|
+
|
593
|
+
Authorization: Bearer {access_token}
|
594
|
+
|
385
595
|
+ Parameters
|
386
596
|
|
387
|
-
+
|
597
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
388
598
|
|
389
599
|
+ Response 200 (application/json)
|
390
600
|
|
391
601
|
+ Body
|
392
602
|
|
393
603
|
{
|
394
|
-
"
|
395
|
-
|
604
|
+
"response": {
|
605
|
+
"result": true,
|
606
|
+
"reason": ""
|
607
|
+
}
|
396
608
|
}
|
397
609
|
|
398
|
-
##
|
610
|
+
## Stop Air Condition [POST /api/1/vehicles/{vehicle_id}/command/auto_conditioning_stop]
|
399
611
|
Stop the HVAC system.
|
612
|
+
|
613
|
+
+ Request
|
614
|
+
+ Headers
|
615
|
+
|
616
|
+
Authorization: Bearer {access_token}
|
617
|
+
|
400
618
|
+ Parameters
|
401
619
|
|
402
|
-
+
|
620
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
403
621
|
|
404
622
|
+ Response 200 (application/json)
|
405
623
|
|
406
624
|
+ Body
|
407
625
|
|
408
626
|
{
|
409
|
-
"
|
410
|
-
|
627
|
+
"response": {
|
628
|
+
"result": true,
|
629
|
+
"reason": ""
|
630
|
+
}
|
411
631
|
}
|
412
632
|
|
413
|
-
##
|
633
|
+
## Move Pano Roof [POST /api/1/vehicles/{vehicle_id}/command/sun_roof_control?state={state}&percent={percent}]
|
414
634
|
Controls the car's panoramic roof, if installed.
|
635
|
+
|
636
|
+
+ Request
|
637
|
+
+ Headers
|
638
|
+
|
639
|
+
Authorization: Bearer {access_token}
|
640
|
+
|
415
641
|
+ Parameters
|
416
642
|
|
417
|
-
+
|
418
|
-
+ state (string)
|
643
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
644
|
+
+ state: `open` (enum[string])
|
419
645
|
The desired state of the panoramic roof. The approximate percent open values for each state are `open` = 100%, `close` = 0%, `comfort` = 80%, and `vent` = ~15%
|
420
|
-
+
|
421
|
-
+ `open`
|
422
|
-
+ `close`
|
423
|
-
+ `comfort`
|
424
|
-
+ `vent`
|
646
|
+
+ Members
|
647
|
+
+ `open` - Open the roof fully
|
648
|
+
+ `close` - Close the roof completely
|
649
|
+
+ `comfort` - Open to the comfort (80%) setting
|
650
|
+
+ `vent` - Open the roof to the vent (~15%) setting
|
651
|
+
+ `move` - Indicates you will provide a percentage to move the roof.
|
652
|
+
+ percent: `50` (number, optional) - The percentage to move the roof to.
|
653
|
+
|
654
|
+
+ Response 200 (application/json)
|
655
|
+
|
656
|
+
+ Body
|
657
|
+
|
658
|
+
{
|
659
|
+
"response": {
|
660
|
+
"result": true,
|
661
|
+
"reason": ""
|
662
|
+
}
|
663
|
+
}
|
664
|
+
|
665
|
+
## Remote Start [POST /api/1/vehicles/{vehicle_id}/command/remote_start_drive?password={password}]
|
666
|
+
Start the car for keyless driving. Must start driving within 2 minutes of issuing this request.
|
667
|
+
|
668
|
+
+ Request
|
669
|
+
+ Headers
|
670
|
+
|
671
|
+
Authorization: Bearer {access_token}
|
672
|
+
|
673
|
+
+ Parameters
|
674
|
+
|
675
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
676
|
+
+ password: `edisonsux` (string) - The password to the authenticated my.teslamotors.com account.
|
677
|
+
|
678
|
+
+ Response 200 (application/json)
|
679
|
+
|
680
|
+
+ Body
|
681
|
+
|
682
|
+
{
|
683
|
+
"response": {
|
684
|
+
"result": true,
|
685
|
+
"reason": ""
|
686
|
+
}
|
687
|
+
}
|
688
|
+
|
689
|
+
## Open Trunk/Frunk [POST /api/1/vehicles/{vehicle_id}/command/trunk_open]
|
690
|
+
Open the trunk or frunk. Currently inoperable.
|
691
|
+
|
692
|
+
+ Request
|
693
|
+
+ Headers
|
694
|
+
|
695
|
+
Authorization: Bearer {access_token}
|
696
|
+
|
697
|
+
+ Parameters
|
698
|
+
|
699
|
+
+ vehicle_id: `1` (number) - The id of the Vehicle.
|
700
|
+
+ which_trunk: `rear` (string) - The trunk to open. `rear` is the only one known currently.
|
425
701
|
|
426
702
|
+ Response 200 (application/json)
|
427
703
|
|
428
704
|
+ Body
|
429
705
|
|
430
706
|
{
|
431
|
-
"
|
432
|
-
|
707
|
+
"response": {
|
708
|
+
"result": true,
|
709
|
+
"reason": ""
|
710
|
+
}
|
433
711
|
}
|