tesla_api 1.4.1 → 1.5.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 +1 -3
- data/README.md +5 -3
- data/docs/SUMMARY.md +2 -0
- data/docs/miscellaneous/endpoints.md +58 -1
- data/docs/vehicle/commands/README.md +4 -0
- data/docs/vehicle/commands/climate.md +53 -4
- data/docs/vehicle/commands/sentrymode.md +20 -0
- data/docs/vehicle/optioncodes.md +25 -6
- data/docs/vehicle/state/README.md +4 -0
- data/docs/vehicle/state/chargestate.md +1 -0
- data/docs/vehicle/state/climatestate.md +7 -5
- data/docs/vehicle/state/data.md +13 -7
- data/docs/vehicle/state/nearbychargingsites.md +94 -1
- data/docs/vehicle/state/vehicleconfig.md +38 -0
- data/docs/vehicle/state/vehiclestate.md +3 -1
- data/lib/tesla_api/client.rb +9 -4
- data/lib/tesla_api/stream.rb +2 -2
- data/lib/tesla_api/vehicle.rb +12 -0
- data/lib/tesla_api/version.rb +1 -1
- data/spec/cassettes/client-login.yml +2 -2
- data/spec/cassettes/vehicle-seat_heater_request.yml +100 -0
- data/spec/cassettes/vehicle-set_sentry_mode.yml +100 -0
- data/spec/cassettes/vehicle-steering_wheel_heater_request.yml +100 -0
- data/spec/lib/tesla_api/client_spec.rb +5 -0
- data/spec/lib/tesla_api/vehicle_spec.rb +18 -0
- data/tesla_api.gemspec +1 -1
- metadata +13 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73167fdd579379407c55193de889645ca9b1b7fb6341fcb8a3abed2b219212f4
|
4
|
+
data.tar.gz: 939adf5aa3e3bfdee0ac6cdb13827f9292c08b40441d8dfd72b9d872cb784f43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f760988232016af782fdb8f5877e18e7be89d4dd8d3efbe71f3942b7ff6a0194ae67c67a4c829135acc860066d3291bd3079f20f19c02a56fd34c3742d620c74
|
7
|
+
data.tar.gz: 6ee1fdaba380e976bfdffb76bbd09c3ea3af8c309c5de0c3c2bf11fec38e75b3ddfe1d1b998de2a61ea5749bddc3d45be9304d1151ef2bef5d0662624616ef47
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
-
Need a Tesla to
|
1
|
+
Referrals are back! Need a Tesla to test with? [Get one with 1,000 miles of free supercharging](http://ts.la/timothy8449)
|
2
|
+
|
3
|
+
Do you work at Tesla? Get in contact! I'd love to help with making this API official.
|
2
4
|
|
3
5
|
# Tesla JSON API
|
4
6
|
|
5
|
-
[View Documentation](
|
7
|
+
[View Documentation](https://tesla-api.timdorr.com/)
|
6
8
|
|
7
9
|
This is unofficial documentation of the Tesla JSON API used by the iOS and Android apps.
|
8
10
|
The API provides functionality to monitor and control the Model S (and future Tesla vehicles) remotely.
|
9
|
-
The project provides both a
|
11
|
+
The project provides both a documentation of the API and a Ruby library for accessing it.
|
10
12
|
|
11
13
|
> If any folks at Tesla are reading this, I'd love to help coordinate a developer program for your APIs. If there's any way I can be helpful, please feel free to get in contact. Also, I'd love to be in the beta firmware program :wink:
|
12
14
|
|
data/docs/SUMMARY.md
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
* [Drive State](vehicle/state/drivestate.md)
|
17
17
|
* [GUI Settings](vehicle/state/guisettings.md)
|
18
18
|
* [Vehicle State](vehicle/state/vehiclestate.md)
|
19
|
+
* [Vehicle Config](vehicle/state/vehicleconfig.md)
|
19
20
|
* [Mobile Enabled](vehicle/state/mobileenabled.md)
|
20
21
|
* [Nearby Charging Sites](vehicle/state/nearbychargingsites.md)
|
21
22
|
* [Commands](vehicle/commands/README.md)
|
@@ -24,6 +25,7 @@
|
|
24
25
|
* [Remote Start](vehicle/commands/remotestart.md)
|
25
26
|
* [Speed Limit](vehicle/commands/speedlimit.md)
|
26
27
|
* [Valet Mode](vehicle/commands/valet.md)
|
28
|
+
* [Sentry Mode](vehicle/commands/sentrymode.md)
|
27
29
|
* [Doors](vehicle/commands/doors.md)
|
28
30
|
* [Frunk/Trunk](vehicle/commands/trunk.md)
|
29
31
|
* [Sunroof](vehicle/commands/sunroof.md)
|
@@ -1,6 +1,6 @@
|
|
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.8.4 version of the app.
|
4
4
|
|
5
5
|
```json
|
6
6
|
{
|
@@ -39,6 +39,11 @@ This the latest contents of the ownerapi_endpoints.json file from the 3.7.0 vers
|
|
39
39
|
"URI": "api/1/vehicles/{vehicle_id}/vehicle_data",
|
40
40
|
"AUTH": true
|
41
41
|
},
|
42
|
+
"VEHICLE_SERVICE_DATA": {
|
43
|
+
"TYPE": "GET",
|
44
|
+
"URI": "api/1/vehicles/{vehicle_id}/service_data",
|
45
|
+
"AUTH": true
|
46
|
+
},
|
42
47
|
"NEARBY_CHARGING_SITES": {
|
43
48
|
"TYPE": "GET",
|
44
49
|
"URI": "api/1/vehicles/{vehicle_id}/nearby_charging_sites",
|
@@ -164,6 +169,11 @@ This the latest contents of the ownerapi_endpoints.json file from the 3.7.0 vers
|
|
164
169
|
"URI": "api/1/logs",
|
165
170
|
"AUTH": true
|
166
171
|
},
|
172
|
+
"SEND_REPORT": {
|
173
|
+
"TYPE": "POST",
|
174
|
+
"URI": "api/1/reports",
|
175
|
+
"AUTH": true
|
176
|
+
},
|
167
177
|
"RETRIEVE_NOTIFICATION_PREFERENCES": {
|
168
178
|
"TYPE": "GET",
|
169
179
|
"URI": "api/1/notification_preferences",
|
@@ -234,6 +244,11 @@ This the latest contents of the ownerapi_endpoints.json file from the 3.7.0 vers
|
|
234
244
|
"URI": "api/1/vehicles/{vehicle_id}/command/cancel_software_update",
|
235
245
|
"AUTH": true
|
236
246
|
},
|
247
|
+
"SET_SENTRY_MODE": {
|
248
|
+
"TYPE": "POST",
|
249
|
+
"URI": "api/1/vehicles/{vehicle_id}/command/set_sentry_mode",
|
250
|
+
"AUTH": true
|
251
|
+
},
|
237
252
|
"POWERWALL_ORDER_SESSION_DATA": {
|
238
253
|
"TYPE": "GET",
|
239
254
|
"URI": "api/1/users/powerwall_order_entry_data",
|
@@ -256,6 +271,17 @@ This the latest contents of the ownerapi_endpoints.json file from the 3.7.0 vers
|
|
256
271
|
"AUTH": true,
|
257
272
|
"CONTENT": "HTML"
|
258
273
|
},
|
274
|
+
"SERVICE_SELF_SCHEDULING_ELIGIBILITY": {
|
275
|
+
"TYPE": "GET",
|
276
|
+
"URI": "api/1/users/service_scheduling_data",
|
277
|
+
"AUTH": true
|
278
|
+
},
|
279
|
+
"SERVICE_SELF_SCHEDULING_PAGE": {
|
280
|
+
"TYPE": "GET",
|
281
|
+
"URI": "service_scheduling_page",
|
282
|
+
"AUTH": true,
|
283
|
+
"CONTENT": "HTML"
|
284
|
+
},
|
259
285
|
"REFERRAL_DATA": {
|
260
286
|
"TYPE": "GET",
|
261
287
|
"URI": "api/1/users/referral_data",
|
@@ -267,6 +293,27 @@ This the latest contents of the ownerapi_endpoints.json file from the 3.7.0 vers
|
|
267
293
|
"AUTH": true,
|
268
294
|
"CONTENT": "HTML"
|
269
295
|
},
|
296
|
+
"ROADSIDE_ASSISTANCE_DATA": {
|
297
|
+
"TYPE": "GET",
|
298
|
+
"URI": "api/1/users/roadside_assistance_data",
|
299
|
+
"AUTH": true
|
300
|
+
},
|
301
|
+
"ROADSIDE_ASSISTANCE_PAGE": {
|
302
|
+
"TYPE": "GET",
|
303
|
+
"URI": "roadside_assistance_page",
|
304
|
+
"AUTH": true,
|
305
|
+
"CONTENT": "HTML"
|
306
|
+
},
|
307
|
+
"UPGRADE_ELIGIBILITY": {
|
308
|
+
"TYPE": "GET",
|
309
|
+
"URI": "api/1/vehicles/{vehicle_id}/eligible_upgrades",
|
310
|
+
"AUTH": true
|
311
|
+
},
|
312
|
+
"AUTOPILOT_UPGRADE_URL": {
|
313
|
+
"TYPE": "GET",
|
314
|
+
"URI": "api/1/vehicles/{vehicle_id}/purchase_url",
|
315
|
+
"AUTH": true
|
316
|
+
},
|
270
317
|
"MESSAGE_CENTER_MESSAGE_LIST": {
|
271
318
|
"TYPE": "GET",
|
272
319
|
"URI": "api/1/messages",
|
@@ -402,6 +449,16 @@ This the latest contents of the ownerapi_endpoints.json file from the 3.7.0 vers
|
|
402
449
|
"TYPE": "POST",
|
403
450
|
"URI": "api/1/vehicles/{vehicle_id}/command/navigation_request",
|
404
451
|
"AUTH": true
|
452
|
+
},
|
453
|
+
"REMOTE_SEAT_HEATER_REQUEST": {
|
454
|
+
"TYPE": "POST",
|
455
|
+
"URI": "api/1/vehicles/{vehicle_id}/command/remote_seat_heater_request",
|
456
|
+
"AUTH": true
|
457
|
+
},
|
458
|
+
"REMOTE_STEERING_WHEEL_HEATER_REQUEST": {
|
459
|
+
"TYPE": "POST",
|
460
|
+
"URI": "api/1/vehicles/{vehicle_id}/command/remote_steering_wheel_heater_request",
|
461
|
+
"AUTH": true
|
405
462
|
}
|
406
463
|
}
|
407
464
|
```
|
@@ -28,16 +28,65 @@ Stop the climate control (HVAC) system.
|
|
28
28
|
|
29
29
|
## POST `/api/1/vehicles/{id}/command/set_temps`
|
30
30
|
|
31
|
-
Sets the target temperature for the climate control (HVAC) system.
|
31
|
+
Sets the target temperature for the climate control (HVAC) system.
|
32
32
|
|
33
|
-
Note: The parameters are always in
|
33
|
+
Note: The parameters are always in celsius, regardless of the region the car is in or the display settings of the car.
|
34
34
|
|
35
35
|
### Parameters
|
36
36
|
|
37
37
|
| Parameter | Example | Description |
|
38
38
|
| :------------- | :------ | :---------------------------------------------------------- |
|
39
|
-
| driver_temp | 23.4 | The desired temperature on the driver's side in
|
40
|
-
| passenger_temp | 23.4 | The desired temperature on the passenger's side in
|
39
|
+
| driver_temp | 23.4 | The desired temperature on the driver's side in celsius. |
|
40
|
+
| passenger_temp | 23.4 | The desired temperature on the passenger's side in celsius. |
|
41
|
+
|
42
|
+
### Response
|
43
|
+
|
44
|
+
```json
|
45
|
+
{
|
46
|
+
"reason": "",
|
47
|
+
"result": true
|
48
|
+
}
|
49
|
+
```
|
50
|
+
|
51
|
+
## POST `/api/1/vehicles/{id}/command/remote_seat_heater_request`
|
52
|
+
|
53
|
+
Sets the specified seat's heater level.
|
54
|
+
|
55
|
+
### Parameters
|
56
|
+
|
57
|
+
| Parameter | Example | Description |
|
58
|
+
| :-------- | :------ | :-------------------------------------- |
|
59
|
+
| heater | 0 | The desired seat to heat. (0-5) |
|
60
|
+
| level | 3 | The desired level for the heater. (0-3) |
|
61
|
+
|
62
|
+
The `heater` parameter maps to the following seats:
|
63
|
+
|
64
|
+
| Number | Seat |
|
65
|
+
| :----- | :---------- |
|
66
|
+
| 0 | Driver |
|
67
|
+
| 1 | Passenger |
|
68
|
+
| 2 | Rear left |
|
69
|
+
| 4 | Rear center |
|
70
|
+
| 5 | Rear right |
|
71
|
+
|
72
|
+
### Response
|
73
|
+
|
74
|
+
```json
|
75
|
+
{
|
76
|
+
"reason": "",
|
77
|
+
"result": true
|
78
|
+
}
|
79
|
+
```
|
80
|
+
|
81
|
+
## POST `/api/1/vehicles/{id}/command/remote_steering_wheel_heater_request`
|
82
|
+
|
83
|
+
Turn steering wheel heater on or off.
|
84
|
+
|
85
|
+
### Parameters
|
86
|
+
|
87
|
+
| Parameter | Example | Description |
|
88
|
+
| :-------- | :------ | :---------------------------------- |
|
89
|
+
| on | true | True to turn on, false to turn off. |
|
41
90
|
|
42
91
|
### Response
|
43
92
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Sentry Mode
|
2
|
+
|
3
|
+
## POST `/api/1/vehicles/{id}/command/set_sentry_mode`
|
4
|
+
|
5
|
+
Turns sentry mode on or off.
|
6
|
+
|
7
|
+
### Parameters
|
8
|
+
|
9
|
+
| Parameter | Example | Description |
|
10
|
+
| :-------- | :------ | :---------------------------------- |
|
11
|
+
| on | true | True to turn on, false to turn off. |
|
12
|
+
|
13
|
+
### Response
|
14
|
+
|
15
|
+
```json
|
16
|
+
{
|
17
|
+
"reason": "",
|
18
|
+
"result": true
|
19
|
+
}
|
20
|
+
```
|
data/docs/vehicle/optioncodes.md
CHANGED
@@ -13,6 +13,8 @@ appreciated!_
|
|
13
13
|
| Code | Title | Description |
|
14
14
|
| :--- | :--- | :--- |
|
15
15
|
| MDLS | Model S | This vehicle is a Model S |
|
16
|
+
| MS03 | Model S | This vehicle is a Model S |
|
17
|
+
| MS04 | Model S | This vehicle is a Model S |
|
16
18
|
| MDLX | Model X | This vehicle is a Model X |
|
17
19
|
| MDL3 | Model 3 | This vehicle is a Model 3 |
|
18
20
|
| RENA | Region: North America | |
|
@@ -23,6 +25,7 @@ appreciated!_
|
|
23
25
|
| AD05 | European 3-Phase, IT | |
|
24
26
|
| AD06 | Schuko (1 phase, 230V 13A) | |
|
25
27
|
| AD07 | Red IEC309 (3 phase, 400V 16A) | |
|
28
|
+
| AD15 | ? | |
|
26
29
|
| ADPX2 | Type 2 Public Charging Connector | |
|
27
30
|
| ADX8 | Blue IEC309 (1 phase, 230V 32A) | |
|
28
31
|
| AF00 | No HEPA Filter | |
|
@@ -34,11 +37,13 @@ appreciated!_
|
|
34
37
|
| APF2 | Full Self-Driving Capability | |
|
35
38
|
| APH0 | Autopilot 2.0 Hardware | |
|
36
39
|
| APH2 | Autopilot 2.0 Hardware | |
|
37
|
-
| APH3 | Autopilot 2.5 Hardware | |
|
40
|
+
| APH3 | Autopilot 2.5 Hardware | |
|
41
|
+
| APH4 | Autopilot 3.0 Hardware | Full Self-Driving Computer |
|
38
42
|
| APPA | Autopilot 1.0 Hardware | |
|
39
43
|
| APPB | Enhanced Autopilot | |
|
40
44
|
| AU00 | No Audio Package | |
|
41
45
|
| AU01 | Ultra High Fidelity Sound | |
|
46
|
+
| BC0B | Tesla Black Brake Calipers | |
|
42
47
|
| BC0R | Tesla Red Brake Calipers | |
|
43
48
|
| BCMB | Black Brake Calipers | |
|
44
49
|
| BP00 | No Ludicrous | |
|
@@ -70,6 +75,7 @@ appreciated!_
|
|
70
75
|
| COL2 | Metallic | |
|
71
76
|
| COL3 | Tesla Multi-Coat | |
|
72
77
|
| COUS | Country: United States | |
|
78
|
+
| CONL | Country: Netherlands | |
|
73
79
|
| CW00 | No Cold Weather Package | |
|
74
80
|
| CW02 | Subzero Weather Package | |
|
75
81
|
| DA00 | No Autopilot | |
|
@@ -80,6 +86,7 @@ appreciated!_
|
|
80
86
|
| DRRH | Right Hand Drive | |
|
81
87
|
| DSH5 | PUR Dash Pad | |
|
82
88
|
| DSH7 | Alcantara Dashboard Accents | |
|
89
|
+
| DSHG | PUR Dash Pad | |
|
83
90
|
| DU00 | Drive Unit - IR | |
|
84
91
|
| DU01 | Drive Unit - Infineon | |
|
85
92
|
| DV2W | Rear-Wheel Drive | |
|
@@ -95,6 +102,7 @@ appreciated!_
|
|
95
102
|
| HC01 | Home Charging Installation | |
|
96
103
|
| HP00 | No HPWC Ordered | |
|
97
104
|
| HP01 | HPWC Ordered | |
|
105
|
+
| ID3W | (Model 3) Wood Decor | |
|
98
106
|
| IDBA | Dark Ash Wood Decor | |
|
99
107
|
| IDBO | Figured Ash Wood Decor | |
|
100
108
|
| IDCF | Carbon Fiber Decor | |
|
@@ -102,11 +110,13 @@ appreciated!_
|
|
102
110
|
| IDOG | Gloss Obeche Wood Decor | |
|
103
111
|
| IDLW | Lacewood Decor | |
|
104
112
|
| IDPB | Piano Black Decor | |
|
113
|
+
| IN3BB | All Black Partial Premium Interior | |
|
105
114
|
| IN3PB | All Black Premium Interior | |
|
106
115
|
| INBBW | White | |
|
107
116
|
| INBFP | Classic Black | |
|
108
117
|
| INBPP | Black | |
|
109
118
|
| INBTB | Multi-Pattern Black | |
|
119
|
+
| INFBP | Black Premium | |
|
110
120
|
| INLPC | Cream | |
|
111
121
|
| INLPP | Black / Light Headliner | |
|
112
122
|
| INWPT | Tan Interior | |
|
@@ -117,6 +127,7 @@ appreciated!_
|
|
117
127
|
| IX00 | No Extended Nappa Leather Trim | |
|
118
128
|
| IX01 | Extended Nappa Leather Trim | |
|
119
129
|
| LLP1 | LLP1 | |
|
130
|
+
| LLP2 | LLP2 | |
|
120
131
|
| LP01 | Premium Interior Lighting | |
|
121
132
|
| LT00 | Vegan interior | |
|
122
133
|
| LT01 | Standard interior | |
|
@@ -127,14 +138,18 @@ appreciated!_
|
|
127
138
|
| LT4W | LT4W | |
|
128
139
|
| LT5C | LT5C | |
|
129
140
|
| LT5P | LT5P | |
|
141
|
+
| LT6P | LT6P | |
|
130
142
|
| ME02 | Memory Seats | |
|
131
143
|
| MI00 | 2015 Production Refresh | |
|
132
144
|
| MI01 | 2016 Production Refresh | |
|
133
145
|
| MI02 | 2017 Production Refresh | |
|
146
|
+
| MI03 | 201? Production Refresh (found on Model X ordered 11/2018 delivered 3/2019) | |
|
147
|
+
| MT301 | Standard Range Plus Rear-Wheel Drive | |
|
134
148
|
| MT305 | Mid Range Rear-Wheel Drive | |
|
149
|
+
| OSSB | OSSB | |
|
135
150
|
| PA00 | No Paint Armor | |
|
136
151
|
| PBCW | Catalina White | |
|
137
|
-
| PBSB | Sierra Black | |
|
152
|
+
| PBSB | Sierra Black | Translates to the Solid Black exterior color in design studio. Applicable to all variants of Model S, Model 3 and Model X. |
|
138
153
|
| PBT8 | Performance 85kWh | |
|
139
154
|
| PF00 | No Performance Legacy Package | |
|
140
155
|
| PF01 | Performance Legacy Package | |
|
@@ -145,15 +160,16 @@ appreciated!_
|
|
145
160
|
| PMBL | Obsidian Black Multi-Coat | |
|
146
161
|
| PMMB | Monterey Blue Metallic | |
|
147
162
|
| PMMR | Multi-Coat Red | |
|
148
|
-
| PMNG | Midnight Silver Metallic | |
|
163
|
+
| PMNG | Midnight Silver Metallic | Translates to the Midnight Silver Metallic exterior color in design studio. Applicable to all variants of Model S, Model 3 and Model X. |
|
149
164
|
| PMSG | Sequoia Green Metallic | |
|
150
165
|
| PMSS | San Simeon Silver Metallic | |
|
151
166
|
| PMTG | Dolphin Grey Metallic | |
|
152
|
-
| PPMR | Muir Red Multi-Coat | |
|
153
|
-
| PPSB | Deep Blue Metallic | |
|
167
|
+
| PPMR | Muir Red Multi-Coat | Translates to the Red Multi-Coat exterior color in design studio. Applicable to all variants of Model S, Model 3 and Model X. |
|
168
|
+
| PPSB | Deep Blue Metallic | Translates to the Deep Blue Metallic exterior color in design studio. Applicable to all variants of Model S, Model 3 and Model X. |
|
154
169
|
| PPSR | Signature Red | |
|
155
|
-
| PPSW | Shasta Pearl White Multi-Coat | |
|
170
|
+
| PPSW | Shasta Pearl White Multi-Coat | Translates to the Pearl White Multi-Coat exterior color in design studio. Applicable to all variants of Model S, Model 3 and Model X. |
|
156
171
|
| PPTI | Titanium Metallic | |
|
172
|
+
| PRM30 | Partial Premium Interior | |
|
157
173
|
| PRM31 | Premium Interior | |
|
158
174
|
| PS00 | No Parcel Shelf | |
|
159
175
|
| PS01 | Parcel Shelf | |
|
@@ -164,6 +180,7 @@ appreciated!_
|
|
164
180
|
| QNET | Tan NextGen | |
|
165
181
|
| QPMP | Black seats | |
|
166
182
|
| QTBW | White Premium Seats | |
|
183
|
+
| QTFP | Black Premium Seats | |
|
167
184
|
| QTPC | Cream Premium Seats | |
|
168
185
|
| QTPP | Black Premium Seats | |
|
169
186
|
| QTPT | Tan Premium Seats | |
|
@@ -215,11 +232,13 @@ appreciated!_
|
|
215
232
|
| UTAW | Light Headliner | |
|
216
233
|
| UTPB | Dark Headliner | |
|
217
234
|
| UTSB | Dark Headliner | |
|
235
|
+
| W38B | 18" Aero Wheels | For the Model 3 and Model Y |
|
218
236
|
| W39B | 19" Sport Wheels | |
|
219
237
|
| WT20 | 20" Silver Slipstream Wheels | |
|
220
238
|
| WTAS | 19" Silver Slipstream Wheels | |
|
221
239
|
| WTDS | 19" Grey Slipstream Wheels | |
|
222
240
|
| WTSG | 21" Turbine Wheels | |
|
241
|
+
| WTSP | 21" Turbine Wheels | |
|
223
242
|
| WTSS | 21" Turbine Wheels | |
|
224
243
|
| WTTB | 19" Cyclone Wheels | |
|
225
244
|
| WTW4 | 19" Winter Tire Set | |
|
@@ -28,6 +28,10 @@ Returns various information about the GUI settings of the car, such as unit form
|
|
28
28
|
|
29
29
|
Returns the vehicle's physical state, such as which doors are open.
|
30
30
|
|
31
|
+
{% page-ref page="vehicleconfig.md" %}
|
32
|
+
|
33
|
+
Returns the vehicle's configuration information including model, color, badging and wheels.
|
34
|
+
|
31
35
|
{% page-ref page="mobileenabled.md" %}
|
32
36
|
|
33
37
|
Lets you know if the Mobile Access setting is enabled in the car.
|
@@ -22,6 +22,7 @@ Information on the state of charge in the battery and its various settings.
|
|
22
22
|
"charge_limit_soc_std": 90,
|
23
23
|
"charge_miles_added_ideal": 50.0,
|
24
24
|
"charge_miles_added_rated": 40.0,
|
25
|
+
"charge_port_cold_weather_mode": false,
|
25
26
|
"charge_port_door_open": false,
|
26
27
|
"charge_port_latch": "Engaged",
|
27
28
|
"charge_rate": 0.0,
|
@@ -11,6 +11,7 @@ Information on the current internal temperature and climate control system.
|
|
11
11
|
"response": {
|
12
12
|
"battery_heater": false,
|
13
13
|
"battery_heater_no_power": false,
|
14
|
+
"climate_keeper_mode": "dog",
|
14
15
|
"driver_temp_setting": 21.6,
|
15
16
|
"fan_status": 0,
|
16
17
|
"inside_temp": null,
|
@@ -24,14 +25,15 @@ Information on the current internal temperature and climate control system.
|
|
24
25
|
"min_avail_temp": 15.0,
|
25
26
|
"outside_temp": null,
|
26
27
|
"passenger_temp_setting": 21.6,
|
28
|
+
"remote_heater_control_enabled": true,
|
27
29
|
"right_temp_direction": null,
|
28
|
-
"seat_heater_left":
|
29
|
-
"seat_heater_rear_center":
|
30
|
-
"seat_heater_rear_left":
|
30
|
+
"seat_heater_left": 3,
|
31
|
+
"seat_heater_rear_center": 0,
|
32
|
+
"seat_heater_rear_left": 1,
|
31
33
|
"seat_heater_rear_left_back": 0,
|
32
|
-
"seat_heater_rear_right":
|
34
|
+
"seat_heater_rear_right": 1,
|
33
35
|
"seat_heater_rear_right_back": 0,
|
34
|
-
"seat_heater_right":
|
36
|
+
"seat_heater_right": 2,
|
35
37
|
"side_mirror_heaters": false,
|
36
38
|
"smart_preconditioning": false,
|
37
39
|
"steering_wheel_heater": false,
|
data/docs/vehicle/state/data.md
CHANGED
@@ -21,7 +21,7 @@ A rollup of all the `data_request` endpoints plus vehicle configuration.
|
|
21
21
|
"in_service": false,
|
22
22
|
"id_s": "12345678901234567",
|
23
23
|
"calendar_enabled": true,
|
24
|
-
"api_version":
|
24
|
+
"api_version": 6,
|
25
25
|
"backseat_token": null,
|
26
26
|
"backseat_token_updated_at": null,
|
27
27
|
"drive_state": {
|
@@ -41,6 +41,7 @@ A rollup of all the `data_request` endpoints plus vehicle configuration.
|
|
41
41
|
"climate_state": {
|
42
42
|
"battery_heater": false,
|
43
43
|
"battery_heater_no_power": false,
|
44
|
+
"climate_keeper_mode": "dog",
|
44
45
|
"driver_temp_setting": 21.6,
|
45
46
|
"fan_status": 0,
|
46
47
|
"inside_temp": null,
|
@@ -54,14 +55,15 @@ A rollup of all the `data_request` endpoints plus vehicle configuration.
|
|
54
55
|
"min_avail_temp": 15.0,
|
55
56
|
"outside_temp": null,
|
56
57
|
"passenger_temp_setting": 21.6,
|
58
|
+
"remote_heater_control_enabled": true,
|
57
59
|
"right_temp_direction": null,
|
58
|
-
"seat_heater_left":
|
59
|
-
"seat_heater_rear_center":
|
60
|
-
"seat_heater_rear_left":
|
60
|
+
"seat_heater_left": 3,
|
61
|
+
"seat_heater_rear_center": 0,
|
62
|
+
"seat_heater_rear_left": 1,
|
61
63
|
"seat_heater_rear_left_back": 0,
|
62
|
-
"seat_heater_rear_right":
|
64
|
+
"seat_heater_rear_right": 1,
|
63
65
|
"seat_heater_rear_right_back": 0,
|
64
|
-
"seat_heater_right":
|
66
|
+
"seat_heater_right": 2,
|
65
67
|
"side_mirror_heaters": false,
|
66
68
|
"smart_preconditioning": false,
|
67
69
|
"steering_wheel_heater": false,
|
@@ -82,6 +84,7 @@ A rollup of all the `data_request` endpoints plus vehicle configuration.
|
|
82
84
|
"charge_limit_soc_std": 90,
|
83
85
|
"charge_miles_added_ideal": 50.0,
|
84
86
|
"charge_miles_added_rated": 40.0,
|
87
|
+
"charge_port_cold_weather_mode": false,
|
85
88
|
"charge_port_door_open": false,
|
86
89
|
"charge_port_latch": "Engaged",
|
87
90
|
"charge_rate": 0.0,
|
@@ -120,7 +123,7 @@ A rollup of all the `data_request` endpoints plus vehicle configuration.
|
|
120
123
|
"timestamp": 1543186971728
|
121
124
|
},
|
122
125
|
"vehicle_state": {
|
123
|
-
"api_version":
|
126
|
+
"api_version": 6,
|
124
127
|
"autopark_state_v2": "standby",
|
125
128
|
"autopark_style": "standard",
|
126
129
|
"calendar_supported": true,
|
@@ -140,8 +143,10 @@ A rollup of all the `data_request` endpoints plus vehicle configuration.
|
|
140
143
|
"pf": 0,
|
141
144
|
"pr": 0,
|
142
145
|
"remote_start": false,
|
146
|
+
"remote_start_enabled": true,
|
143
147
|
"remote_start_supported": true,
|
144
148
|
"rt": 0,
|
149
|
+
"sentry_mode": true,
|
145
150
|
"software_update": { "expected_duration_sec": 2700, "status": "" },
|
146
151
|
"speed_limit_mode": {
|
147
152
|
"active": false,
|
@@ -167,6 +172,7 @@ A rollup of all the `data_request` endpoints plus vehicle configuration.
|
|
167
172
|
"exterior_color": "White",
|
168
173
|
"has_air_suspension": true,
|
169
174
|
"has_ludicrous_mode": false,
|
175
|
+
"key_version": 1,
|
170
176
|
"motorized_charge_port": true,
|
171
177
|
"perf_config": "P2",
|
172
178
|
"plg": true,
|
@@ -7,6 +7,99 @@ Returns a list of nearby Tesla-operated charging stations. (Requires car softwar
|
|
7
7
|
### Response
|
8
8
|
|
9
9
|
```json
|
10
|
-
|
10
|
+
{
|
11
|
+
"response":{
|
12
|
+
"congestion_sync_time_utc_secs":1545091987,
|
13
|
+
"destination_charging":[
|
14
|
+
{
|
15
|
+
"location":{
|
16
|
+
"lat":33.811484,
|
17
|
+
"long":-118.138451
|
18
|
+
},
|
19
|
+
"name":"Long Beach Marriott",
|
20
|
+
"type":"destination",
|
21
|
+
"distance_miles":2.201606
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"location":{
|
25
|
+
"lat":33.767198,
|
26
|
+
"long":-118.191987
|
27
|
+
},
|
28
|
+
"name":"Renaissance Long Beach Hotel",
|
29
|
+
"type":"destination",
|
30
|
+
"distance_miles":4.071068
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"location":{
|
34
|
+
"lat":33.757146,
|
35
|
+
"long":-118.19861
|
36
|
+
},
|
37
|
+
"name":"Hotel Maya, a Doubletree by Hilton",
|
38
|
+
"type":"destination",
|
39
|
+
"distance_miles":4.843953
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"location":{
|
43
|
+
"lat":33.832254,
|
44
|
+
"long":-118.079218
|
45
|
+
},
|
46
|
+
"name":"The Gardens Casino",
|
47
|
+
"type":"destination",
|
48
|
+
"distance_miles":6.449794
|
49
|
+
}
|
50
|
+
],
|
51
|
+
"superchargers":[
|
52
|
+
{
|
53
|
+
"location":{
|
54
|
+
"lat":33.934471,
|
55
|
+
"long":-118.121217
|
56
|
+
},
|
57
|
+
"name":"Downey, CA - Stonewood Street",
|
58
|
+
"type":"supercharger",
|
59
|
+
"distance_miles":2.196721,
|
60
|
+
"available_stalls":5,
|
61
|
+
"total_stalls":12,
|
62
|
+
"site_closed":false
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"location":{
|
66
|
+
"lat":33.953385,
|
67
|
+
"long":-118.112905
|
68
|
+
},
|
69
|
+
"name":"Downey, CA - Lakewood Boulevard",
|
70
|
+
"type":"supercharger",
|
71
|
+
"distance_miles":9.587273,
|
72
|
+
"available_stalls":6,
|
73
|
+
"total_stalls":12,
|
74
|
+
"site_closed":false
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"location":{
|
78
|
+
"lat":33.921063,
|
79
|
+
"long":-118.330074
|
80
|
+
},
|
81
|
+
"name":"Hawthorne, CA",
|
82
|
+
"type":"supercharger",
|
83
|
+
"distance_miles":12.197322,
|
84
|
+
"available_stalls":3,
|
85
|
+
"total_stalls":6,
|
86
|
+
"site_closed":false
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"location":{
|
90
|
+
"lat":33.894227,
|
91
|
+
"long":-118.367407
|
92
|
+
},
|
93
|
+
"name":"Redondo Beach, CA",
|
94
|
+
"type":"supercharger",
|
95
|
+
"distance_miles":13.125912,
|
96
|
+
"available_stalls":3,
|
97
|
+
"total_stalls":8,
|
98
|
+
"site_closed":false
|
99
|
+
}
|
100
|
+
],
|
101
|
+
"timestamp":1545092157769
|
102
|
+
}
|
103
|
+
}
|
11
104
|
```
|
12
105
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Vehicle Config
|
2
|
+
|
3
|
+
## GET `/api/1/vehicles/{id}/data_request/vehicle_config`
|
4
|
+
|
5
|
+
Returns the vehicle's configuration information including model, color, badging and wheels.
|
6
|
+
|
7
|
+
### Response
|
8
|
+
|
9
|
+
```json
|
10
|
+
{
|
11
|
+
"response": {
|
12
|
+
"can_accept_navigation_requests": true,
|
13
|
+
"can_actuate_trunks": true,
|
14
|
+
"car_special_type": "base",
|
15
|
+
"car_type": "models2",
|
16
|
+
"charge_port_type": "US",
|
17
|
+
"eu_vehicle": false,
|
18
|
+
"exterior_color": "White",
|
19
|
+
"has_air_suspension": true,
|
20
|
+
"has_ludicrous_mode": false,
|
21
|
+
"key_version": 1,
|
22
|
+
"motorized_charge_port": true,
|
23
|
+
"perf_config": "P2",
|
24
|
+
"plg": true,
|
25
|
+
"rear_seat_heaters": 0,
|
26
|
+
"rear_seat_type": 0,
|
27
|
+
"rhd": false,
|
28
|
+
"roof_color": "None",
|
29
|
+
"seat_type": 2,
|
30
|
+
"spoiler_type": "None",
|
31
|
+
"sun_roof_installed": 2,
|
32
|
+
"third_row_seats": "None",
|
33
|
+
"timestamp": 1538364666096,
|
34
|
+
"trim_badging": "p90d",
|
35
|
+
"wheel_type": "AeroTurbine19"
|
36
|
+
}
|
37
|
+
}
|
38
|
+
```
|
@@ -9,7 +9,7 @@ Returns the vehicle's physical state, such as which doors are open.
|
|
9
9
|
```json
|
10
10
|
{
|
11
11
|
"response": {
|
12
|
-
"api_version":
|
12
|
+
"api_version": 6,
|
13
13
|
"autopark_state_v2": "ready",
|
14
14
|
"autopark_style": "standard",
|
15
15
|
"calendar_supported": true,
|
@@ -29,8 +29,10 @@ Returns the vehicle's physical state, such as which doors are open.
|
|
29
29
|
"pf": 0,
|
30
30
|
"pr": 0,
|
31
31
|
"remote_start": false,
|
32
|
+
"remote_start_enabled": true,
|
32
33
|
"remote_start_supported": true,
|
33
34
|
"rt": 0,
|
35
|
+
"sentry_mode": true,
|
34
36
|
"software_update": { "expected_duration_sec": 2700, "status": "" },
|
35
37
|
"speed_limit_mode": {
|
36
38
|
"active": false,
|
data/lib/tesla_api/client.rb
CHANGED
@@ -5,7 +5,7 @@ module TeslaApi
|
|
5
5
|
headers 'User-Agent' => "github.com/timdorr/tesla-api v:#{VERSION}"
|
6
6
|
format :json
|
7
7
|
|
8
|
-
attr_reader :email, :token, :client_id, :client_secret
|
8
|
+
attr_reader :email, :token, :refresh_token, :client_id, :client_secret
|
9
9
|
|
10
10
|
def initialize(email, client_id = ENV['TESLA_CLIENT_ID'], client_secret = ENV['TESLA_CLIENT_SECRET'])
|
11
11
|
@email = email
|
@@ -48,13 +48,18 @@ module TeslaApi
|
|
48
48
|
}
|
49
49
|
)
|
50
50
|
|
51
|
-
self.expires_in
|
52
|
-
self.created_at
|
53
|
-
self.token
|
51
|
+
self.expires_in = response['expires_in']
|
52
|
+
self.created_at = response['created_at']
|
53
|
+
self.token = response['access_token']
|
54
|
+
self.refresh_token = response['refresh_token']
|
54
55
|
end
|
55
56
|
|
56
57
|
def vehicles
|
57
58
|
self.class.get('/vehicles')['response'].map { |v| Vehicle.new(self.class, email, v['id'], v) }
|
58
59
|
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
attr_writer :refresh_token
|
59
64
|
end
|
60
65
|
end
|
data/lib/tesla_api/stream.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module TeslaApi
|
2
2
|
module Stream
|
3
|
-
def stream(&
|
3
|
+
def stream(&receiver)
|
4
4
|
EventMachine.run do
|
5
5
|
http.stream do |chunk|
|
6
6
|
attributes = chunk.split(",")
|
7
7
|
|
8
|
-
|
8
|
+
receiver.call({
|
9
9
|
time: DateTime.strptime((attributes[0].to_i/1000).to_s, '%s'),
|
10
10
|
speed: attributes[1].to_f,
|
11
11
|
odometer: attributes[2].to_f,
|
data/lib/tesla_api/vehicle.rb
CHANGED
@@ -182,6 +182,18 @@ module TeslaApi
|
|
182
182
|
command('cancel_software_update')['response']
|
183
183
|
end
|
184
184
|
|
185
|
+
def set_seat_heater(heater, level)
|
186
|
+
command('remote_seat_heater_request', body: {heater: heater, level: level})['response']
|
187
|
+
end
|
188
|
+
|
189
|
+
def set_steering_wheel_heater(on)
|
190
|
+
command('remote_steering_wheel_heater_request', body: {on: on})['response']
|
191
|
+
end
|
192
|
+
|
193
|
+
def set_sentry_mode(on)
|
194
|
+
command('set_sentry_mode', body: {on: on})['response']
|
195
|
+
end
|
196
|
+
|
185
197
|
private
|
186
198
|
|
187
199
|
def data_request(name)
|
data/lib/tesla_api/version.rb
CHANGED
@@ -42,7 +42,7 @@ http_interactions:
|
|
42
42
|
- '0.416152'
|
43
43
|
body:
|
44
44
|
encoding: UTF-8
|
45
|
-
string: '{"access_token":"1cba4845a8653d4b731440e9911d84304a179bd16a9ecbc9b649f2d8e0f6947e","token_type":"bearer","expires_in":7776000,"created_at":1475777133}'
|
46
|
-
http_version:
|
45
|
+
string: '{"access_token":"1cba4845a8653d4b731440e9911d84304a179bd16a9ecbc9b649f2d8e0f6947e","token_type":"bearer","expires_in":7776000,"refresh_token":"fea03b395fa4e72ebc399d9cda6163dcf438c248f744ebdd5bfcda571f5f317f","created_at":1475777133}'
|
46
|
+
http_version:
|
47
47
|
recorded_at: Mon, 15 Dec 2014 03:09:22 GMT
|
48
48
|
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,100 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://owner-api.teslamotors.com/api/1/vehicles
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- github.com/timdorr/tesla-api v:1.4.1
|
12
|
+
Authorization:
|
13
|
+
- Bearer <TESLA_API_TOKEN>
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Server:
|
20
|
+
- nginx
|
21
|
+
Date:
|
22
|
+
- Sun, 24 Feb 2019 01:43:45 GMT
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Content-Length:
|
26
|
+
- '560'
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
X-Frame-Options:
|
30
|
+
- SAMEORIGIN
|
31
|
+
- SAMEORIGIN
|
32
|
+
X-Xss-Protection:
|
33
|
+
- 1; mode=block
|
34
|
+
X-Content-Type-Options:
|
35
|
+
- nosniff
|
36
|
+
X-Txid:
|
37
|
+
- c4c935f820bb983ab39c3cb55cff40b9
|
38
|
+
Etag:
|
39
|
+
- W/"ab623a35dcb4358cb8efa907f4c48acb"
|
40
|
+
Cache-Control:
|
41
|
+
- max-age=0, private, must-revalidate
|
42
|
+
X-Request-Id:
|
43
|
+
- 3937089b-c69c-51a9-b30b-3c5cc32bab5a
|
44
|
+
X-Runtime:
|
45
|
+
- '0.031140'
|
46
|
+
body:
|
47
|
+
encoding: UTF-8
|
48
|
+
string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola
|
49
|
+
2.0","option_codes":"MDLS,RENA,AF02,APF1,APH2,APPB,AU01,BC0R,BP00,BR00,BS00,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR04,HP00,IDBA,IX01,LP01,ME02,MI01,PF01,PI01,PK00,PS01,PX00,PX4D,QTVB,RFP2,SC01,SP00,SR01,SU01,TM00,TP03,TR00,UTAB,WTAS,X001,X003,X007,X011,X013,X021,X024,X027,X028,X031,X037,X040,X044,YFFC,COUS","color":null,"tokens":["921c1c9a2f2b479a","08f5098517a10231"],"state":"online","in_service":false,"id_s":"19298251174317440","calendar_enabled":true,"api_version":4,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}'
|
50
|
+
http_version:
|
51
|
+
recorded_at: Sun, 24 Feb 2019 01:43:45 GMT
|
52
|
+
- request:
|
53
|
+
method: post
|
54
|
+
uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/command/remote_seat_heater_request
|
55
|
+
body:
|
56
|
+
encoding: UTF-8
|
57
|
+
string: heater=1&level=0
|
58
|
+
headers:
|
59
|
+
User-Agent:
|
60
|
+
- github.com/timdorr/tesla-api v:1.4.1
|
61
|
+
Authorization:
|
62
|
+
- Bearer <TESLA_API_TOKEN>
|
63
|
+
response:
|
64
|
+
status:
|
65
|
+
code: 200
|
66
|
+
message: OK
|
67
|
+
headers:
|
68
|
+
Server:
|
69
|
+
- nginx
|
70
|
+
Date:
|
71
|
+
- Sun, 24 Feb 2019 01:43:46 GMT
|
72
|
+
Content-Type:
|
73
|
+
- application/json; charset=utf-8
|
74
|
+
Content-Length:
|
75
|
+
- '40'
|
76
|
+
Connection:
|
77
|
+
- keep-alive
|
78
|
+
X-Frame-Options:
|
79
|
+
- SAMEORIGIN
|
80
|
+
- SAMEORIGIN
|
81
|
+
X-Xss-Protection:
|
82
|
+
- 1; mode=block
|
83
|
+
X-Content-Type-Options:
|
84
|
+
- nosniff
|
85
|
+
X-Txid:
|
86
|
+
- 285c2b1b42411a224af014a336d5a3c2
|
87
|
+
Etag:
|
88
|
+
- W/"17f1bc21c0a8289b664a341515a4815a"
|
89
|
+
Cache-Control:
|
90
|
+
- max-age=0, private, must-revalidate
|
91
|
+
X-Request-Id:
|
92
|
+
- 532f50af-01aa-34ca-81cf-441a43c1c4c1
|
93
|
+
X-Runtime:
|
94
|
+
- '0.296134'
|
95
|
+
body:
|
96
|
+
encoding: UTF-8
|
97
|
+
string: '{"response":{"reason":"","result":true}}'
|
98
|
+
http_version:
|
99
|
+
recorded_at: Sun, 24 Feb 2019 01:43:46 GMT
|
100
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,100 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://owner-api.teslamotors.com/api/1/vehicles
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- github.com/timdorr/tesla-api v:1.4.1
|
12
|
+
Authorization:
|
13
|
+
- Bearer <TESLA_API_TOKEN>
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Server:
|
20
|
+
- nginx
|
21
|
+
Date:
|
22
|
+
- Fri, 22 Mar 2019 22:23:24 GMT
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Content-Length:
|
26
|
+
- '560'
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
X-Frame-Options:
|
30
|
+
- SAMEORIGIN
|
31
|
+
- SAMEORIGIN
|
32
|
+
X-Xss-Protection:
|
33
|
+
- 1; mode=block
|
34
|
+
X-Content-Type-Options:
|
35
|
+
- nosniff
|
36
|
+
X-Txid:
|
37
|
+
- d02f4ff21a6e1b268a665750baffc710
|
38
|
+
Etag:
|
39
|
+
- W/"1be15a507d094a87368028f8dfaccd1a"
|
40
|
+
Cache-Control:
|
41
|
+
- max-age=0, private, must-revalidate
|
42
|
+
X-Request-Id:
|
43
|
+
- 4d46929a-f37f-b435-b780-76264949a802
|
44
|
+
X-Runtime:
|
45
|
+
- '0.021684'
|
46
|
+
body:
|
47
|
+
encoding: UTF-8
|
48
|
+
string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola
|
49
|
+
2.0","option_codes":"MDLS,RENA,AF02,APF1,APH2,APPB,AU01,BC0R,BP00,BR00,BS00,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR04,HP00,IDBA,IX01,LP01,ME02,MI01,PF01,PI01,PK00,PS01,PX00,PX4D,QTVB,RFP2,SC01,SP00,SR01,SU01,TM00,TP03,TR00,UTAB,WTAS,X001,X003,X007,X011,X013,X021,X024,X027,X028,X031,X037,X040,X044,YFFC,COUS","color":null,"tokens":["08f5098517a10231","8d219a2e09242e02"],"state":"online","in_service":false,"id_s":"19298251174317440","calendar_enabled":true,"api_version":4,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}'
|
50
|
+
http_version:
|
51
|
+
recorded_at: Fri, 22 Mar 2019 22:23:24 GMT
|
52
|
+
- request:
|
53
|
+
method: post
|
54
|
+
uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/command/set_sentry_mode
|
55
|
+
body:
|
56
|
+
encoding: UTF-8
|
57
|
+
string: on=false
|
58
|
+
headers:
|
59
|
+
User-Agent:
|
60
|
+
- github.com/timdorr/tesla-api v:1.4.1
|
61
|
+
Authorization:
|
62
|
+
- Bearer <TESLA_API_TOKEN>
|
63
|
+
response:
|
64
|
+
status:
|
65
|
+
code: 200
|
66
|
+
message: OK
|
67
|
+
headers:
|
68
|
+
Server:
|
69
|
+
- nginx
|
70
|
+
Date:
|
71
|
+
- Fri, 22 Mar 2019 22:23:24 GMT
|
72
|
+
Content-Type:
|
73
|
+
- application/json; charset=utf-8
|
74
|
+
Content-Length:
|
75
|
+
- '40'
|
76
|
+
Connection:
|
77
|
+
- keep-alive
|
78
|
+
X-Frame-Options:
|
79
|
+
- SAMEORIGIN
|
80
|
+
- SAMEORIGIN
|
81
|
+
X-Xss-Protection:
|
82
|
+
- 1; mode=block
|
83
|
+
X-Content-Type-Options:
|
84
|
+
- nosniff
|
85
|
+
X-Txid:
|
86
|
+
- 748a70910e1c191df6af18bb3f51a99f
|
87
|
+
Etag:
|
88
|
+
- W/"8b2ba34e0e680eb9a2f93ca92ef3cc49"
|
89
|
+
Cache-Control:
|
90
|
+
- max-age=0, private, must-revalidate
|
91
|
+
X-Request-Id:
|
92
|
+
- f6208b15-2060-b4d6-2484-408c50576015
|
93
|
+
X-Runtime:
|
94
|
+
- '0.195483'
|
95
|
+
body:
|
96
|
+
encoding: UTF-8
|
97
|
+
string: '{"response":{"reason":"","result":true}}'
|
98
|
+
http_version:
|
99
|
+
recorded_at: Fri, 22 Mar 2019 22:23:24 GMT
|
100
|
+
recorded_with: VCR 4.0.0
|
@@ -0,0 +1,100 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://owner-api.teslamotors.com/api/1/vehicles
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- github.com/timdorr/tesla-api v:1.4.1
|
12
|
+
Authorization:
|
13
|
+
- Bearer <TESLA_API_TOKEN>
|
14
|
+
response:
|
15
|
+
status:
|
16
|
+
code: 200
|
17
|
+
message: OK
|
18
|
+
headers:
|
19
|
+
Server:
|
20
|
+
- nginx
|
21
|
+
Date:
|
22
|
+
- Sun, 24 Feb 2019 01:45:31 GMT
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Content-Length:
|
26
|
+
- '560'
|
27
|
+
Connection:
|
28
|
+
- keep-alive
|
29
|
+
X-Frame-Options:
|
30
|
+
- SAMEORIGIN
|
31
|
+
- SAMEORIGIN
|
32
|
+
X-Xss-Protection:
|
33
|
+
- 1; mode=block
|
34
|
+
X-Content-Type-Options:
|
35
|
+
- nosniff
|
36
|
+
X-Txid:
|
37
|
+
- 6f71bbfe2f7d615dd53dd27a7d561083
|
38
|
+
Etag:
|
39
|
+
- W/"ac52d151f70236be8a2fd76cc3a7e215"
|
40
|
+
Cache-Control:
|
41
|
+
- max-age=0, private, must-revalidate
|
42
|
+
X-Request-Id:
|
43
|
+
- beacbab2-72a5-7a1b-ecba-c73c1cd249af
|
44
|
+
X-Runtime:
|
45
|
+
- '0.013103'
|
46
|
+
body:
|
47
|
+
encoding: UTF-8
|
48
|
+
string: '{"response":[{"id":19298251174317440,"vehicle_id":1817902171,"vin":"5YJSA1E41GF167745","display_name":"Nikola
|
49
|
+
2.0","option_codes":"MDLS,RENA,AF02,APF1,APH2,APPB,AU01,BC0R,BP00,BR00,BS00,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR04,HP00,IDBA,IX01,LP01,ME02,MI01,PF01,PI01,PK00,PS01,PX00,PX4D,QTVB,RFP2,SC01,SP00,SR01,SU01,TM00,TP03,TR00,UTAB,WTAS,X001,X003,X007,X011,X013,X021,X024,X027,X028,X031,X037,X040,X044,YFFC,COUS","color":null,"tokens":["08f5098517a10231","8d219a2e09242e02"],"state":"online","in_service":false,"id_s":"19298251174317440","calendar_enabled":true,"api_version":4,"backseat_token":null,"backseat_token_updated_at":null}],"count":1}'
|
50
|
+
http_version:
|
51
|
+
recorded_at: Sun, 24 Feb 2019 01:45:31 GMT
|
52
|
+
- request:
|
53
|
+
method: post
|
54
|
+
uri: https://owner-api.teslamotors.com/api/1/vehicles/19298251174317440/command/remote_steering_wheel_heater_request
|
55
|
+
body:
|
56
|
+
encoding: UTF-8
|
57
|
+
string: on=false
|
58
|
+
headers:
|
59
|
+
User-Agent:
|
60
|
+
- github.com/timdorr/tesla-api v:1.4.1
|
61
|
+
Authorization:
|
62
|
+
- Bearer <TESLA_API_TOKEN>
|
63
|
+
response:
|
64
|
+
status:
|
65
|
+
code: 200
|
66
|
+
message: OK
|
67
|
+
headers:
|
68
|
+
Server:
|
69
|
+
- nginx
|
70
|
+
Date:
|
71
|
+
- Sun, 24 Feb 2019 01:45:32 GMT
|
72
|
+
Content-Type:
|
73
|
+
- application/json; charset=utf-8
|
74
|
+
Content-Length:
|
75
|
+
- '40'
|
76
|
+
Connection:
|
77
|
+
- keep-alive
|
78
|
+
X-Frame-Options:
|
79
|
+
- SAMEORIGIN
|
80
|
+
- SAMEORIGIN
|
81
|
+
X-Xss-Protection:
|
82
|
+
- 1; mode=block
|
83
|
+
X-Content-Type-Options:
|
84
|
+
- nosniff
|
85
|
+
X-Txid:
|
86
|
+
- b0b529831abb830179558ade3f3b4622
|
87
|
+
Etag:
|
88
|
+
- W/"b834d18aa9a08081d6e257c5dc7af1f0"
|
89
|
+
Cache-Control:
|
90
|
+
- max-age=0, private, must-revalidate
|
91
|
+
X-Request-Id:
|
92
|
+
- 3f6c3479-8549-b5f3-32cc-39745e4b75aa
|
93
|
+
X-Runtime:
|
94
|
+
- '0.320113'
|
95
|
+
body:
|
96
|
+
encoding: UTF-8
|
97
|
+
string: '{"response":{"reason":"","result":true}}'
|
98
|
+
http_version:
|
99
|
+
recorded_at: Sun, 24 Feb 2019 01:45:32 GMT
|
100
|
+
recorded_with: VCR 4.0.0
|
@@ -54,6 +54,11 @@ RSpec.describe TeslaApi::Client do
|
|
54
54
|
tesla_api.login!(ENV['TESLA_PASS'])
|
55
55
|
expect(tesla_api.token).to match(/[a-z0-9]{32}/)
|
56
56
|
end
|
57
|
+
|
58
|
+
it 'obtains a refresh token' do
|
59
|
+
tesla_api.login!(ENV['TESLA_PASS'])
|
60
|
+
expect(tesla_api.refresh_token).to match(/[a-z0-9]{32}/)
|
61
|
+
end
|
57
62
|
end
|
58
63
|
|
59
64
|
describe '#vehicles', vcr: {cassette_name: 'client-vehicles'} do
|
@@ -317,4 +317,22 @@ RSpec.describe TeslaApi::Vehicle do
|
|
317
317
|
expect(vehicle.cancel_software_update['result']).to eq(true)
|
318
318
|
end
|
319
319
|
end
|
320
|
+
|
321
|
+
describe '#seat_heater_request', vcr: {cassette_name: 'vehicle-seat_heater_request'} do
|
322
|
+
it 'turns off the driver seat heater' do
|
323
|
+
expect(vehicle.set_seat_heater(1, 0)['result']).to eq(true)
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
describe '#steering_wheel_heater_request', vcr: {cassette_name: 'vehicle-steering_wheel_heater_request'} do
|
328
|
+
it 'turns off the steering wheel heater' do
|
329
|
+
expect(vehicle.set_steering_wheel_heater(false)['result']).to eq(true)
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
describe '#set_sentry_mode', vcr: {cassette_name: 'vehicle-set_sentry_mode'} do
|
334
|
+
it 'disables sentry mode' do
|
335
|
+
expect(vehicle.set_sentry_mode(false)['result']).to eq(true)
|
336
|
+
end
|
337
|
+
end
|
320
338
|
end
|
data/tesla_api.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.add_dependency 'faye-websocket'
|
19
19
|
spec.add_dependency 'em-http-request'
|
20
20
|
|
21
|
-
spec.add_development_dependency 'bundler', '~>
|
21
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
22
22
|
spec.add_development_dependency 'rake', '~> 12.0'
|
23
23
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
24
24
|
spec.add_development_dependency 'faker', '~> 1.4'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tesla_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Dorr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '2.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '2.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,6 +183,7 @@ files:
|
|
183
183
|
- docs/vehicle/commands/media.md
|
184
184
|
- docs/vehicle/commands/navigation.md
|
185
185
|
- docs/vehicle/commands/remotestart.md
|
186
|
+
- docs/vehicle/commands/sentrymode.md
|
186
187
|
- docs/vehicle/commands/softwareupdate.md
|
187
188
|
- docs/vehicle/commands/speedlimit.md
|
188
189
|
- docs/vehicle/commands/sunroof.md
|
@@ -198,6 +199,7 @@ files:
|
|
198
199
|
- docs/vehicle/state/guisettings.md
|
199
200
|
- docs/vehicle/state/mobileenabled.md
|
200
201
|
- docs/vehicle/state/nearbychargingsites.md
|
202
|
+
- docs/vehicle/state/vehicleconfig.md
|
201
203
|
- docs/vehicle/state/vehiclestate.md
|
202
204
|
- docs/vehicle/streaming.md
|
203
205
|
- lib/tesla_api.rb
|
@@ -239,14 +241,17 @@ files:
|
|
239
241
|
- spec/cassettes/vehicle-remote_start_drive.yml
|
240
242
|
- spec/cassettes/vehicle-reset_valet_pin.yml
|
241
243
|
- spec/cassettes/vehicle-schedule_software_update.yml
|
244
|
+
- spec/cassettes/vehicle-seat_heater_request.yml
|
242
245
|
- spec/cassettes/vehicle-set_charge_limit-1.yml
|
243
246
|
- spec/cassettes/vehicle-set_charge_limit-100.yml
|
244
247
|
- spec/cassettes/vehicle-set_charge_limit-50.yml
|
245
248
|
- spec/cassettes/vehicle-set_charge_limit-90.yml
|
249
|
+
- spec/cassettes/vehicle-set_sentry_mode.yml
|
246
250
|
- spec/cassettes/vehicle-set_speed_limit.yml
|
247
251
|
- spec/cassettes/vehicle-set_temps-70-70.yml
|
248
252
|
- spec/cassettes/vehicle-set_temps-75-65.yml
|
249
253
|
- spec/cassettes/vehicle-set_valet_mode.yml
|
254
|
+
- spec/cassettes/vehicle-steering_wheel_heater_request.yml
|
250
255
|
- spec/cassettes/vehicle-sun_roof_control-close.yml
|
251
256
|
- spec/cassettes/vehicle-sun_roof_control-vent.yml
|
252
257
|
- spec/cassettes/vehicle-vehicle_state.yml
|
@@ -275,8 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
280
|
- !ruby/object:Gem::Version
|
276
281
|
version: '0'
|
277
282
|
requirements: []
|
278
|
-
|
279
|
-
rubygems_version: 2.7.8
|
283
|
+
rubygems_version: 3.0.2
|
280
284
|
signing_key:
|
281
285
|
specification_version: 4
|
282
286
|
summary: A wrapper for the Tesla JSON API
|
@@ -314,14 +318,17 @@ test_files:
|
|
314
318
|
- spec/cassettes/vehicle-remote_start_drive.yml
|
315
319
|
- spec/cassettes/vehicle-reset_valet_pin.yml
|
316
320
|
- spec/cassettes/vehicle-schedule_software_update.yml
|
321
|
+
- spec/cassettes/vehicle-seat_heater_request.yml
|
317
322
|
- spec/cassettes/vehicle-set_charge_limit-1.yml
|
318
323
|
- spec/cassettes/vehicle-set_charge_limit-100.yml
|
319
324
|
- spec/cassettes/vehicle-set_charge_limit-50.yml
|
320
325
|
- spec/cassettes/vehicle-set_charge_limit-90.yml
|
326
|
+
- spec/cassettes/vehicle-set_sentry_mode.yml
|
321
327
|
- spec/cassettes/vehicle-set_speed_limit.yml
|
322
328
|
- spec/cassettes/vehicle-set_temps-70-70.yml
|
323
329
|
- spec/cassettes/vehicle-set_temps-75-65.yml
|
324
330
|
- spec/cassettes/vehicle-set_valet_mode.yml
|
331
|
+
- spec/cassettes/vehicle-steering_wheel_heater_request.yml
|
325
332
|
- spec/cassettes/vehicle-sun_roof_control-close.yml
|
326
333
|
- spec/cassettes/vehicle-sun_roof_control-vent.yml
|
327
334
|
- spec/cassettes/vehicle-vehicle_state.yml
|