tesla_api 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/SUMMARY.md +35 -34
- data/docs/miscellaneous/endpoints.md +23 -3
- data/docs/vehicle/commands/README.md +11 -3
- data/docs/vehicle/commands/climate.md +19 -0
- data/docs/vehicle/commands/homelink.md +21 -0
- data/docs/vehicle/commands/{navigation.md → sharing.md} +11 -9
- data/docs/vehicle/commands/windows.md +22 -0
- data/docs/vehicle/optioncodes.md +11 -1
- data/lib/tesla_api/vehicle.rb +48 -0
- data/lib/tesla_api/version.rb +1 -1
- data/spec/cassettes/vehicle-media_next_fav.yml +109 -0
- data/spec/cassettes/vehicle-media_next_track.yml +109 -0
- data/spec/cassettes/vehicle-media_prev_fav.yml +109 -0
- data/spec/cassettes/vehicle-media_prev_track.yml +109 -0
- data/spec/cassettes/vehicle-media_toggle_playback.yml +109 -0
- data/spec/cassettes/vehicle-media_volume_down.yml +109 -0
- data/spec/cassettes/vehicle-media_volume_up.yml +109 -0
- data/spec/cassettes/vehicle-vehicle_config.yml +108 -0
- data/spec/lib/tesla_api/vehicle_spec.rb +57 -0
- metadata +21 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4379e187bc321aa06bf2675be264b8f7dba76d33d08ae2088b5491e718aeb387
|
4
|
+
data.tar.gz: d0efa66690fa5ed2edb6b624c77ea1fef140e88c7a4aa177cb6f68c82fe4e88a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d705d155f086cbd9e8476575973d45b346f29dd3b77f7df29295e88bf1dc0563841e745e6f3e79fb33db59fa2d03bec4ce8f3cd6b9e06d849309a6c9709b0575
|
7
|
+
data.tar.gz: ea8910775ee4536f95249ffe0fedb1a8468d9996ebaaab01fab5569955053e515a937c920cff817d76c508d4b3c32b682b5a24b4863a1487f46f01c0cba15339
|
data/docs/SUMMARY.md
CHANGED
@@ -1,45 +1,46 @@
|
|
1
1
|
# Table of contents
|
2
2
|
|
3
|
-
|
3
|
+
- [Introduction](README.md)
|
4
4
|
|
5
5
|
## API Basics
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
- [Authentication](api-basics/authentication.md)
|
8
|
+
- [Vehicles](api-basics/vehicles.md)
|
9
9
|
|
10
10
|
## Vehicle
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
12
|
+
- [State](vehicle/state/README.md)
|
13
|
+
- [Data](vehicle/state/data.md)
|
14
|
+
- [Charge State](vehicle/state/chargestate.md)
|
15
|
+
- [Climate State](vehicle/state/climatestate.md)
|
16
|
+
- [Drive State](vehicle/state/drivestate.md)
|
17
|
+
- [GUI Settings](vehicle/state/guisettings.md)
|
18
|
+
- [Vehicle State](vehicle/state/vehiclestate.md)
|
19
|
+
- [Vehicle Config](vehicle/state/vehicleconfig.md)
|
20
|
+
- [Mobile Enabled](vehicle/state/mobileenabled.md)
|
21
|
+
- [Nearby Charging Sites](vehicle/state/nearbychargingsites.md)
|
22
|
+
- [Commands](vehicle/commands/README.md)
|
23
|
+
- [Wake](vehicle/commands/wake.md)
|
24
|
+
- [Alerts](vehicle/commands/alerts.md)
|
25
|
+
- [Remote Start](vehicle/commands/remotestart.md)
|
26
|
+
- [Homelink](vehicle/commands/homelink.md)
|
27
|
+
- [Speed Limit](vehicle/commands/speedlimit.md)
|
28
|
+
- [Valet Mode](vehicle/commands/valet.md)
|
29
|
+
- [Sentry Mode](vehicle/commands/sentrymode.md)
|
30
|
+
- [Doors](vehicle/commands/doors.md)
|
31
|
+
- [Frunk/Trunk](vehicle/commands/trunk.md)
|
32
|
+
- [Windows](vehicle/commands/windows.md)
|
33
|
+
- [Sunroof](vehicle/commands/sunroof.md)
|
34
|
+
- [Charging](vehicle/commands/charging.md)
|
35
|
+
- [Climate](vehicle/commands/climate.md)
|
36
|
+
- [Media](vehicle/commands/media.md)
|
37
|
+
- [Sharing](vehicle/commands/sharing.md)
|
38
|
+
- [Software Updates](vehicle/commands/softwareupdate.md)
|
39
|
+
- [Calendar](vehicle/commands/calendar.md)
|
40
|
+
- [Streaming](vehicle/streaming.md)
|
41
|
+
- [Autopark/Summon](vehicle/autopark.md)
|
42
|
+
- [Option Codes](vehicle/optioncodes.md)
|
41
43
|
|
42
44
|
## Miscellaneous
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
+
- [Endpoints File](miscellaneous/endpoints.md)
|
@@ -1,9 +1,14 @@
|
|
1
1
|
# Endpoints File
|
2
2
|
|
3
|
-
This the latest contents of the ownerapi_endpoints.json file from the 3.
|
3
|
+
This the latest contents of the ownerapi_endpoints.json file from the 3.10.0 version of the app.
|
4
4
|
|
5
5
|
```json
|
6
6
|
{
|
7
|
+
"STATUS": {
|
8
|
+
"TYPE": "GET",
|
9
|
+
"URI": "status",
|
10
|
+
"AUTH": false
|
11
|
+
},
|
7
12
|
"AUTHENTICATE": {
|
8
13
|
"TYPE": "POST",
|
9
14
|
"URI": "oauth/token",
|
@@ -84,6 +89,11 @@ This the latest contents of the ownerapi_endpoints.json file from the 3.9.0 vers
|
|
84
89
|
"URI": "api/1/vehicles/{vehicle_id}/command/auto_conditioning_stop",
|
85
90
|
"AUTH": true
|
86
91
|
},
|
92
|
+
"MAX_DEFROST": {
|
93
|
+
"TYPE": "POST",
|
94
|
+
"URI": "api/1/vehicles/{vehicle_id}/command/set_preconditioning_max",
|
95
|
+
"AUTH": true
|
96
|
+
},
|
87
97
|
"CHANGE_CLIMATE_TEMPERATURE_SETTING": {
|
88
98
|
"TYPE": "POST",
|
89
99
|
"URI": "api/1/vehicles/{vehicle_id}/command/set_temps",
|
@@ -99,6 +109,11 @@ This the latest contents of the ownerapi_endpoints.json file from the 3.9.0 vers
|
|
99
109
|
"URI": "api/1/vehicles/{vehicle_id}/command/sun_roof_control",
|
100
110
|
"AUTH": true
|
101
111
|
},
|
112
|
+
"WINDOW_CONTROL": {
|
113
|
+
"TYPE": "POST",
|
114
|
+
"URI": "api/1/vehicles/{vehicle_id}/command/window_control",
|
115
|
+
"AUTH": true
|
116
|
+
},
|
102
117
|
"ACTUATE_TRUNK": {
|
103
118
|
"TYPE": "POST",
|
104
119
|
"URI": "api/1/vehicles/{vehicle_id}/command/actuate_trunk",
|
@@ -109,6 +124,11 @@ This the latest contents of the ownerapi_endpoints.json file from the 3.9.0 vers
|
|
109
124
|
"URI": "api/1/vehicles/{vehicle_id}/command/remote_start_drive",
|
110
125
|
"AUTH": true
|
111
126
|
},
|
127
|
+
"TRIGGER_HOMELINK": {
|
128
|
+
"TYPE": "POST",
|
129
|
+
"URI": "api/1/vehicles/{vehicle_id}/command/trigger_homelink",
|
130
|
+
"AUTH": true
|
131
|
+
},
|
112
132
|
"CHARGE_PORT_DOOR_OPEN": {
|
113
133
|
"TYPE": "POST",
|
114
134
|
"URI": "api/1/vehicles/{vehicle_id}/command/charge_port_door_open",
|
@@ -450,9 +470,9 @@ This the latest contents of the ownerapi_endpoints.json file from the 3.9.0 vers
|
|
450
470
|
"URI": "api/1/notification_confirmations",
|
451
471
|
"AUTH": true
|
452
472
|
},
|
453
|
-
"
|
473
|
+
"SHARE_TO_VEHICLE": {
|
454
474
|
"TYPE": "POST",
|
455
|
-
"URI": "api/1/vehicles/{vehicle_id}/command/
|
475
|
+
"URI": "api/1/vehicles/{vehicle_id}/command/share",
|
456
476
|
"AUTH": true
|
457
477
|
},
|
458
478
|
"REMOTE_SEAT_HEATER_REQUEST": {
|
@@ -18,6 +18,10 @@ Controls for honking the horn and flashing the lights.
|
|
18
18
|
|
19
19
|
Start the car remotely.
|
20
20
|
|
21
|
+
{% page-ref page="homelink.md" %}
|
22
|
+
|
23
|
+
Open or close the primary garage door via Homelink.
|
24
|
+
|
21
25
|
{% page-ref page="speedlimit.md" %}
|
22
26
|
|
23
27
|
Limit the maximum speed of the car.
|
@@ -34,6 +38,10 @@ Lock and unlock the car.
|
|
34
38
|
|
35
39
|
Open and close the trunk and frunk.
|
36
40
|
|
41
|
+
{% page-ref page="windows.md" %}
|
42
|
+
|
43
|
+
Open and vent the windows.
|
44
|
+
|
37
45
|
{% page-ref page="sunroof.md" %}
|
38
46
|
|
39
47
|
Open and close the panoramic sunroof.
|
@@ -50,9 +58,9 @@ Adjust the temperature settings of the car.
|
|
50
58
|
|
51
59
|
Control the media playing in the car.
|
52
60
|
|
53
|
-
{% page-ref page="
|
61
|
+
{% page-ref page="sharing.md" %}
|
54
62
|
|
55
|
-
|
63
|
+
Share a location to navigate to or video to play in theatre mode.
|
56
64
|
|
57
65
|
{% page-ref page="softwareupdate.md" %}
|
58
66
|
|
@@ -64,4 +72,4 @@ Enable or disable Sentry Mode.
|
|
64
72
|
|
65
73
|
{% page-ref page="calendar.md" %}
|
66
74
|
|
67
|
-
Synchronize a calendar with the car.
|
75
|
+
Synchronize a calendar with the car.
|
@@ -48,6 +48,25 @@ Note: The parameters are always in celsius, regardless of the region the car is
|
|
48
48
|
}
|
49
49
|
```
|
50
50
|
|
51
|
+
## POST `/api/1/vehicles/{id}/command/set_preconditioning_max`
|
52
|
+
|
53
|
+
Toggles the climate controls between Max Defrost and the previous setting.
|
54
|
+
|
55
|
+
### Parameters
|
56
|
+
|
57
|
+
| Parameter | Example | Description |
|
58
|
+
| :-------- | :------ | :---------------------------------- |
|
59
|
+
| on | true | True to turn on, false to turn off. |
|
60
|
+
|
61
|
+
### Response
|
62
|
+
|
63
|
+
```json
|
64
|
+
{
|
65
|
+
"reason": "",
|
66
|
+
"result": true
|
67
|
+
}
|
68
|
+
```
|
69
|
+
|
51
70
|
## POST `/api/1/vehicles/{id}/command/remote_seat_heater_request`
|
52
71
|
|
53
72
|
Sets the specified seat's heater level.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Homelink
|
2
|
+
|
3
|
+
## POST `/api/1/vehicles/{id}/command/trigger_homelink`
|
4
|
+
|
5
|
+
Opens or closes the primary Homelink device. The provided location must be in proximity of stored location of the Homelink device.
|
6
|
+
|
7
|
+
### Parameters
|
8
|
+
|
9
|
+
| Parameter | Example | Description |
|
10
|
+
| :-------- | :----------------- | :----------------- |
|
11
|
+
| lat | 36.98765432109876 | Current lattitude. |
|
12
|
+
| lon | -77.12345678901234 | Current longitude. |
|
13
|
+
|
14
|
+
### Response
|
15
|
+
|
16
|
+
```json
|
17
|
+
{
|
18
|
+
"reason": "",
|
19
|
+
"result": true
|
20
|
+
}
|
21
|
+
```
|
@@ -1,8 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# Sharing
|
2
2
|
|
3
|
-
## POST `/api/1/vehicles/{id}/command/
|
3
|
+
## POST `/api/1/vehicles/{id}/command/share`
|
4
4
|
|
5
|
-
Sends a location for the car to start navigation.
|
5
|
+
Sends a location for the car to start navigation or play a video in theatre mode.
|
6
6
|
|
7
7
|
These docs take from the Android app, which sends the data in JSON form. However, a urlencoded POST body will work as well. The basic format to a request looks like this:
|
8
8
|
|
@@ -17,14 +17,16 @@ These docs take from the Android app, which sends the data in JSON form. However
|
|
17
17
|
}
|
18
18
|
```
|
19
19
|
|
20
|
+
Note: This API was previously `navigation_request`, but has been updated to support video links as well.
|
21
|
+
|
20
22
|
### Parameters
|
21
23
|
|
22
|
-
| Parameter | Example | Description
|
23
|
-
| :------------------------------- | :-------------------------- |
|
24
|
-
| type | share_ext_content_raw | Must be `share_ext_content_raw`.
|
25
|
-
| locale | en-US | The locale for the navigation request.
|
26
|
-
| timestamp_ms | 1539465730 | The current UNIX timestamp.
|
27
|
-
| value[android.intent.extra.TEXT] | 123 Main St, City, ST 12345 | The address to set as the navigation destination. |
|
24
|
+
| Parameter | Example | Description |
|
25
|
+
| :------------------------------- | :-------------------------- | :------------------------------------------------------------- |
|
26
|
+
| type | share_ext_content_raw | Must be `share_ext_content_raw`. |
|
27
|
+
| locale | en-US | The locale for the navigation request. |
|
28
|
+
| timestamp_ms | 1539465730 | The current UNIX timestamp. |
|
29
|
+
| value[android.intent.extra.TEXT] | 123 Main St, City, ST 12345 | The address or video URL to set as the navigation destination. |
|
28
30
|
|
29
31
|
### Response
|
30
32
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Windows
|
2
|
+
|
3
|
+
## POST `/api/1/vehicles/{id}/command/window_control`
|
4
|
+
|
5
|
+
Controls the windows. Will vent or close all windows simultaneously.
|
6
|
+
|
7
|
+
### Parameters
|
8
|
+
|
9
|
+
| Parameter | Example | Description |
|
10
|
+
| :-------- | :------ | :-------------------------------------------------------------------------- |
|
11
|
+
| command | close | What action to take with the windows. Allows the values `vent` and `close`. |
|
12
|
+
| lat | 0 | Seems to not care what this is, 0 is the only value sent by the app. |
|
13
|
+
| lon | 0 | Seems to not care what this is, 0 is the only value sent by the app. |
|
14
|
+
|
15
|
+
### Response
|
16
|
+
|
17
|
+
```json
|
18
|
+
{
|
19
|
+
"reason": "",
|
20
|
+
"result": true
|
21
|
+
}
|
22
|
+
```
|
data/docs/vehicle/optioncodes.md
CHANGED
@@ -174,6 +174,7 @@ appreciated!_
|
|
174
174
|
| LT5C | LT5C | |
|
175
175
|
| LT5P | LT5P | |
|
176
176
|
| LT6P | LT6P | |
|
177
|
+
| LT6W | White Base Lower Trim | |
|
177
178
|
| LTPB | Lower Trim PUR Black | |
|
178
179
|
| ME01 | Memory Seats | |
|
179
180
|
| ME02 | Seat Memory | Seat Memory LHD Driver |
|
@@ -254,15 +255,18 @@ appreciated!_
|
|
254
255
|
| QVPP | Vegan Cream Seats | |
|
255
256
|
| QVSW | White Tesla Seats | |
|
256
257
|
| RCX0 | No Rear Console | |
|
258
|
+
| RCX1 | Rear Console | |
|
257
259
|
| RF3G | Model 3 Glass Roof | |
|
258
260
|
| RFBK | Black Roof | |
|
259
261
|
| RFBC | Body Color Roof | Roof |
|
260
262
|
| RFFG | Glass Roof | |
|
261
263
|
| RFP0 | All Glass Panoramic Roof | |
|
262
264
|
| RFP2 | Sunroof | |
|
263
|
-
| RFPX | Model X Roof | |
|
265
|
+
| RFPX | Model X Roof | |
|
266
|
+
| S01B | Black Textile Seats | |
|
264
267
|
| S02B | Seat | BLK Leather |
|
265
268
|
| S02P | S02P | |
|
269
|
+
| S07W | White Seats | |
|
266
270
|
| S31B | S31B | |
|
267
271
|
| S32C | S32C | |
|
268
272
|
| S32P | S32P | |
|
@@ -288,7 +292,10 @@ appreciated!_
|
|
288
292
|
| SU3C | Suspension | Coil spring suspension |
|
289
293
|
| T3MA | Tires M3 | 18 Michelin All Season, Square |
|
290
294
|
| TIC4 | Tires | All-Season Tires |
|
295
|
+
| TIG2 | Summer Tires | |
|
296
|
+
| TIM7 | Summer Tires | |
|
291
297
|
| TIMP | Tires | Michelin Primacy 19" Tire |
|
298
|
+
| TIP0 | All-season Tires | |
|
292
299
|
| TM00 | Model Trim | General Production Series Vehicle |
|
293
300
|
| TM02 | General Production Signature Trim | |
|
294
301
|
| TM0A | ALPHA PRE-PRODUCTION NON-SALEABLE | |
|
@@ -311,6 +318,7 @@ appreciated!_
|
|
311
318
|
| UTSB | Dark Headliner | |
|
312
319
|
| UTZW | Light Headliner | |
|
313
320
|
| USSB | Safety | Safety US Black |
|
321
|
+
| USSW | US Safety Kit White | |
|
314
322
|
| SLR1 | Carbon Fibre Spoiler | Model 3 |
|
315
323
|
| SPT31 | Performance Upgrade | Model 3 |
|
316
324
|
| SPTY1 | Performance Upgrade | Model Y |
|
@@ -377,6 +385,8 @@ appreciated!_
|
|
377
385
|
| X037 | Powerfolding Mirrors | |
|
378
386
|
| X039 | DAB Radio | |
|
379
387
|
| X040 | No DAB Radio | |
|
388
|
+
| X041 | No Auto Presenting Door | |
|
389
|
+
| X042 | Auto Presenting Door | |
|
380
390
|
| X043 | No Phone Dock Kit | |
|
381
391
|
| X044 | Phone Dock Kit | |
|
382
392
|
| YF00 | No Yacht Floor | |
|
data/lib/tesla_api/vehicle.rb
CHANGED
@@ -59,6 +59,10 @@ module TeslaApi
|
|
59
59
|
data_request('vehicle_state')['response']
|
60
60
|
end
|
61
61
|
|
62
|
+
def vehicle_config
|
63
|
+
data_request('vehicle_config')['response']
|
64
|
+
end
|
65
|
+
|
62
66
|
# Commands
|
63
67
|
|
64
68
|
def wake_up
|
@@ -121,6 +125,10 @@ module TeslaApi
|
|
121
125
|
command('set_temps', body: {driver_temp: driver_temp, passenger_temp: passenger_temp})['response']
|
122
126
|
end
|
123
127
|
|
128
|
+
def set_preconditioning_max(on)
|
129
|
+
command('set_preconditioning_max', body: {on: on})['response']
|
130
|
+
end
|
131
|
+
|
124
132
|
def auto_conditioning_start
|
125
133
|
command('auto_conditioning_start')['response']
|
126
134
|
end
|
@@ -137,6 +145,10 @@ module TeslaApi
|
|
137
145
|
command('sun_roof_control', body: {state: 'move', percent: percent})['response']
|
138
146
|
end
|
139
147
|
|
148
|
+
def window_control(command)
|
149
|
+
command('window_control', body: {command: command, lat: 0, lon: 0})['response']
|
150
|
+
end
|
151
|
+
|
140
152
|
def remote_start_drive(password)
|
141
153
|
command('remote_start_drive', body: {password: password})['response']
|
142
154
|
end
|
@@ -174,6 +186,10 @@ module TeslaApi
|
|
174
186
|
})['response']
|
175
187
|
end
|
176
188
|
|
189
|
+
def share(text)
|
190
|
+
navigation_request(text)
|
191
|
+
end
|
192
|
+
|
177
193
|
def schedule_software_update(offset_sec = 0)
|
178
194
|
command('schedule_software_update', body: {offset_sec: offset_sec})['response']
|
179
195
|
end
|
@@ -194,6 +210,38 @@ module TeslaApi
|
|
194
210
|
command('set_sentry_mode', body: {on: on})['response']
|
195
211
|
end
|
196
212
|
|
213
|
+
def trigger_homelink(lat, lon)
|
214
|
+
command('trigger_homelink', body: {lat: lat, lon: lon})['response']
|
215
|
+
end
|
216
|
+
|
217
|
+
def media_toggle_playback
|
218
|
+
command('media_toggle_playback')['response']
|
219
|
+
end
|
220
|
+
|
221
|
+
def media_next_track
|
222
|
+
command('media_next_track')['response']
|
223
|
+
end
|
224
|
+
|
225
|
+
def media_prev_track
|
226
|
+
command('media_prev_track')['response']
|
227
|
+
end
|
228
|
+
|
229
|
+
def media_next_fav
|
230
|
+
command('media_next_fav')['response']
|
231
|
+
end
|
232
|
+
|
233
|
+
def media_prev_fav
|
234
|
+
command('media_prev_fav')['response']
|
235
|
+
end
|
236
|
+
|
237
|
+
def media_volume_up
|
238
|
+
command('media_volume_up')['response']
|
239
|
+
end
|
240
|
+
|
241
|
+
def media_volume_down
|
242
|
+
command('media_volume_down')['response']
|
243
|
+
end
|
244
|
+
|
197
245
|
private
|
198
246
|
|
199
247
|
def data_request(name)
|
data/lib/tesla_api/version.rb
CHANGED