tesla-fleet-api 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers.d.ts +2 -0
- package/dist/helpers.js +10 -0
- package/dist/helpers.js.map +1 -0
- package/dist/teslafleetapi.js.map +1 -1
- package/dist/teslemetry.js.map +1 -1
- package/dist/tessie.js.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.js.map +1 -1
- package/dist/user.d.ts +6 -5
- package/dist/user.js.map +1 -1
- package/dist/vehicle.d.ts +66 -64
- package/dist/vehicle.js +14 -0
- package/dist/vehicle.js.map +1 -1
- package/dist/vehiclespecific.d.ts +65 -63
- package/dist/vehiclespecific.js +6 -0
- package/dist/vehiclespecific.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers.ts +11 -0
- package/src/teslafleetapi.ts +8 -0
- package/src/teslemetry.ts +7 -2
- package/src/tessie.ts +3 -1
- package/src/types.ts +8 -0
- package/src/user.ts +6 -5
- package/src/vehicle.ts +91 -69
- package/src/vehiclespecific.ts +82 -63
package/src/vehiclespecific.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlertTypes, ClimateMode, ClimateModes, Level, Seat, Seats, Trunk, VehicleDataEndpoint } from "./types.js";
|
|
1
|
+
import { AlertTypes, ClimateMode, ClimateModes, CommandResponse, Level, Seat, Seats, Trunk, VehicleDataEndpoint } from "./types.js";
|
|
2
2
|
import Vehicle from "./vehicle.js";
|
|
3
3
|
|
|
4
4
|
interface FleetTelemetryConfig {
|
|
@@ -23,13 +23,32 @@ export default class VehicleSpecific {
|
|
|
23
23
|
this.vin = vin;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
// Metadata
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns the vehicle's model name.
|
|
30
|
+
* @returns
|
|
31
|
+
**/
|
|
32
|
+
model(): String {
|
|
33
|
+
return this.parent.model(this.vin);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Return if the vehicle was build before 2021 and cannot sleep without a break
|
|
38
|
+
* @param vin
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
pre2021(): Boolean {
|
|
42
|
+
return this.parent.pre2021(this.vin);
|
|
43
|
+
}
|
|
44
|
+
|
|
26
45
|
// Vehicle Commands
|
|
27
46
|
|
|
28
47
|
/**
|
|
29
48
|
* Controls the front (which_trunk: "front") or rear (which_trunk: "rear") trunk.
|
|
30
49
|
* @param which_trunk "front" or "rear"
|
|
31
50
|
*/
|
|
32
|
-
async actuate_truck(which_trunk: Trunk): Promise<
|
|
51
|
+
async actuate_truck(which_trunk: Trunk): Promise<CommandResponse> {
|
|
33
52
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/actuate_trunk`, null, { which_trunk });
|
|
34
53
|
}
|
|
35
54
|
|
|
@@ -37,105 +56,105 @@ export default class VehicleSpecific {
|
|
|
37
56
|
* Adjusts vehicle media playback volume.
|
|
38
57
|
* @param volume A floating point number from 0.0 to 11.0.
|
|
39
58
|
*/
|
|
40
|
-
async adjust_volume(volume: number): Promise<
|
|
59
|
+
async adjust_volume(volume: number): Promise<CommandResponse> {
|
|
41
60
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/adjust_volume`, null, { volume });
|
|
42
61
|
}
|
|
43
62
|
|
|
44
63
|
/**
|
|
45
64
|
* Starts climate preconditioning.
|
|
46
65
|
*/
|
|
47
|
-
async auto_conditioning_start(): Promise<
|
|
66
|
+
async auto_conditioning_start(): Promise<CommandResponse> {
|
|
48
67
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/auto_conditioning_start`);
|
|
49
68
|
}
|
|
50
69
|
|
|
51
70
|
/**
|
|
52
71
|
* Stops climate preconditioning.
|
|
53
72
|
*/
|
|
54
|
-
async auto_conditioning_stop(): Promise<
|
|
73
|
+
async auto_conditioning_stop(): Promise<CommandResponse> {
|
|
55
74
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/auto_conditioning_stop`);
|
|
56
75
|
}
|
|
57
76
|
|
|
58
77
|
/**
|
|
59
78
|
* Cancels the countdown to install the vehicle software update.
|
|
60
79
|
*/
|
|
61
|
-
async cancel_software_update(): Promise<
|
|
80
|
+
async cancel_software_update(): Promise<CommandResponse> {
|
|
62
81
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/cancel_software_update`);
|
|
63
82
|
}
|
|
64
83
|
|
|
65
84
|
/**
|
|
66
85
|
* Charges in max range mode -- we recommend limiting the use of this mode to long trips.
|
|
67
86
|
*/
|
|
68
|
-
async charge_max_range(): Promise<
|
|
87
|
+
async charge_max_range(): Promise<CommandResponse> {
|
|
69
88
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/charge_max_range`);
|
|
70
89
|
}
|
|
71
90
|
|
|
72
91
|
/**
|
|
73
92
|
* Closes the charge port door.
|
|
74
93
|
*/
|
|
75
|
-
async charge_port_door_close(): Promise<
|
|
94
|
+
async charge_port_door_close(): Promise<CommandResponse> {
|
|
76
95
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/charge_port_door_close`);
|
|
77
96
|
}
|
|
78
97
|
|
|
79
98
|
/**
|
|
80
99
|
* Opens the charge port door.
|
|
81
100
|
*/
|
|
82
|
-
async charge_port_door_open(): Promise<
|
|
101
|
+
async charge_port_door_open(): Promise<CommandResponse> {
|
|
83
102
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/charge_port_door_open`);
|
|
84
103
|
}
|
|
85
104
|
|
|
86
105
|
/**
|
|
87
106
|
* Charges in Standard mode.
|
|
88
107
|
*/
|
|
89
|
-
async charge_standard(): Promise<
|
|
108
|
+
async charge_standard(): Promise<CommandResponse> {
|
|
90
109
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/charge_standard`);
|
|
91
110
|
}
|
|
92
111
|
|
|
93
112
|
/**
|
|
94
113
|
* Starts charging the vehicle.
|
|
95
114
|
*/
|
|
96
|
-
async charge_start(): Promise<
|
|
115
|
+
async charge_start(): Promise<CommandResponse> {
|
|
97
116
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/charge_start`);
|
|
98
117
|
}
|
|
99
118
|
|
|
100
119
|
/**
|
|
101
120
|
* Stops charging the vehicle.
|
|
102
121
|
*/
|
|
103
|
-
async charge_stop(): Promise<
|
|
122
|
+
async charge_stop(): Promise<CommandResponse> {
|
|
104
123
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/charge_stop`);
|
|
105
124
|
}
|
|
106
125
|
|
|
107
126
|
/**
|
|
108
127
|
* Deactivates PIN to Drive and resets the associated PIN for vehicles running firmware versions 2023.44+. This command is only accessible to fleet managers or owners.
|
|
109
128
|
*/
|
|
110
|
-
async clear_pin_to_drive_admin(): Promise<
|
|
129
|
+
async clear_pin_to_drive_admin(): Promise<CommandResponse> {
|
|
111
130
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/clear_pin_to_drive_admin`);
|
|
112
131
|
}
|
|
113
132
|
|
|
114
133
|
/**
|
|
115
134
|
* Locks the vehicle.
|
|
116
135
|
*/
|
|
117
|
-
async door_lock(): Promise<
|
|
136
|
+
async door_lock(): Promise<CommandResponse> {
|
|
118
137
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/door_lock`);
|
|
119
138
|
}
|
|
120
139
|
|
|
121
140
|
/**
|
|
122
141
|
* Unlocks the vehicle.
|
|
123
142
|
*/
|
|
124
|
-
async door_unlock(): Promise<
|
|
143
|
+
async door_unlock(): Promise<CommandResponse> {
|
|
125
144
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/door_unlock`);
|
|
126
145
|
}
|
|
127
146
|
|
|
128
147
|
/**
|
|
129
148
|
* Erases user's data from the user interface. Requires the vehicle to be in park.
|
|
130
149
|
*/
|
|
131
|
-
async erase_user_data(): Promise<
|
|
150
|
+
async erase_user_data(): Promise<CommandResponse> {
|
|
132
151
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/erase_user_data`);
|
|
133
152
|
}
|
|
134
153
|
|
|
135
154
|
/**
|
|
136
155
|
* Briefly flashes the vehicle headlights. Requires the vehicle to be in park.
|
|
137
156
|
*/
|
|
138
|
-
async flash_lights(): Promise<
|
|
157
|
+
async flash_lights(): Promise<CommandResponse> {
|
|
139
158
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/flash_lights`);
|
|
140
159
|
}
|
|
141
160
|
|
|
@@ -143,56 +162,56 @@ export default class VehicleSpecific {
|
|
|
143
162
|
* Restricts certain vehicle UI functionality from guest users
|
|
144
163
|
* @param enable `true` or `false`
|
|
145
164
|
*/
|
|
146
|
-
async guest_mode(enable: boolean): Promise<
|
|
165
|
+
async guest_mode(enable: boolean): Promise<CommandResponse> {
|
|
147
166
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/guest_mode`, null, { enable });
|
|
148
167
|
}
|
|
149
168
|
|
|
150
169
|
/**
|
|
151
170
|
* Honks the vehicle horn. Requires the vehicle to be in park.
|
|
152
171
|
*/
|
|
153
|
-
async honk_horn(): Promise<
|
|
172
|
+
async honk_horn(): Promise<CommandResponse> {
|
|
154
173
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/honk_horn`);
|
|
155
174
|
}
|
|
156
175
|
|
|
157
176
|
/**
|
|
158
177
|
* Advances media player to next favorite track.
|
|
159
178
|
*/
|
|
160
|
-
async media_next_fav(): Promise<
|
|
179
|
+
async media_next_fav(): Promise<CommandResponse> {
|
|
161
180
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/media_next_fav`);
|
|
162
181
|
}
|
|
163
182
|
|
|
164
183
|
/**
|
|
165
184
|
* Advances media player to next track.
|
|
166
185
|
*/
|
|
167
|
-
async media_next_track(): Promise<
|
|
186
|
+
async media_next_track(): Promise<CommandResponse> {
|
|
168
187
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/media_next_track`);
|
|
169
188
|
}
|
|
170
189
|
|
|
171
190
|
/**
|
|
172
191
|
* Advances media player to previous favorite track.
|
|
173
192
|
*/
|
|
174
|
-
async media_prev_fav(): Promise<
|
|
193
|
+
async media_prev_fav(): Promise<CommandResponse> {
|
|
175
194
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/media_prev_fav`);
|
|
176
195
|
}
|
|
177
196
|
|
|
178
197
|
/**
|
|
179
198
|
* Advances media player to previous track.
|
|
180
199
|
*/
|
|
181
|
-
async media_prev_track(): Promise<
|
|
200
|
+
async media_prev_track(): Promise<CommandResponse> {
|
|
182
201
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/media_prev_track`);
|
|
183
202
|
}
|
|
184
203
|
|
|
185
204
|
/**
|
|
186
205
|
* Toggles current play/pause state.
|
|
187
206
|
*/
|
|
188
|
-
async media_toggle_playback(): Promise<
|
|
207
|
+
async media_toggle_playback(): Promise<CommandResponse> {
|
|
189
208
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/media_toggle_playback`);
|
|
190
209
|
}
|
|
191
210
|
|
|
192
211
|
/**
|
|
193
212
|
* Turns the volume down by one.
|
|
194
213
|
*/
|
|
195
|
-
async media_volume_down(): Promise<
|
|
214
|
+
async media_volume_down(): Promise<CommandResponse> {
|
|
196
215
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/media_volume_down`);
|
|
197
216
|
}
|
|
198
217
|
|
|
@@ -202,7 +221,7 @@ export default class VehicleSpecific {
|
|
|
202
221
|
* @param lon Longitude
|
|
203
222
|
* @param order Order of multiple stops
|
|
204
223
|
*/
|
|
205
|
-
async navigation_gps_request(lat: number, lon: number, order?: number): Promise<
|
|
224
|
+
async navigation_gps_request(lat: number, lon: number, order?: number): Promise<CommandResponse> {
|
|
206
225
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/navigation_gps_request`, null, { lat, lon, order });
|
|
207
226
|
}
|
|
208
227
|
|
|
@@ -212,7 +231,7 @@ export default class VehicleSpecific {
|
|
|
212
231
|
* @param locale ISO locale such as "en-US"
|
|
213
232
|
* @param timestamp_ms
|
|
214
233
|
*/
|
|
215
|
-
async navigation_request(value: string, locale: string, type: string = "share_ext_content_raw"): Promise<
|
|
234
|
+
async navigation_request(value: string, locale: string, type: string = "share_ext_content_raw"): Promise<CommandResponse> {
|
|
216
235
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/navigation_request`, null, {
|
|
217
236
|
type,
|
|
218
237
|
locale,
|
|
@@ -229,7 +248,7 @@ export default class VehicleSpecific {
|
|
|
229
248
|
* @param order Order of multiple stops
|
|
230
249
|
* @returns
|
|
231
250
|
*/
|
|
232
|
-
async navigation_sc_request(id: number, order?: number): Promise<
|
|
251
|
+
async navigation_sc_request(id: number, order?: number): Promise<CommandResponse> {
|
|
233
252
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/navigation_sc_request`, null, { id, order });
|
|
234
253
|
}
|
|
235
254
|
|
|
@@ -238,7 +257,7 @@ export default class VehicleSpecific {
|
|
|
238
257
|
* @param auto_seat_position Seat position
|
|
239
258
|
* @param auto_climate_on `true` or `false`
|
|
240
259
|
*/
|
|
241
|
-
async remote_auto_seat_climate_request(auto_seat_position: Seat | number, auto_climate_on: boolean): Promise<
|
|
260
|
+
async remote_auto_seat_climate_request(auto_seat_position: Seat | number, auto_climate_on: boolean): Promise<CommandResponse> {
|
|
242
261
|
if (typeof auto_seat_position === "string") {
|
|
243
262
|
auto_seat_position = Seats[auto_seat_position];
|
|
244
263
|
}
|
|
@@ -252,7 +271,7 @@ export default class VehicleSpecific {
|
|
|
252
271
|
* Sets automatic steering wheel heating on/off.
|
|
253
272
|
* @param on `true` or `false`
|
|
254
273
|
*/
|
|
255
|
-
async remote_auto_steering_wheel_heat_climate_request(on: boolean): Promise<
|
|
274
|
+
async remote_auto_steering_wheel_heat_climate_request(on: boolean): Promise<CommandResponse> {
|
|
256
275
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/remote_auto_steering_wheel_heat_climate_request`, null, { on });
|
|
257
276
|
}
|
|
258
277
|
|
|
@@ -260,7 +279,7 @@ export default class VehicleSpecific {
|
|
|
260
279
|
* Plays a sound through the vehicle external speaker.
|
|
261
280
|
* @param sound Fart is `0`, Locate ping is `2000`
|
|
262
281
|
*/
|
|
263
|
-
async remote_boombox(sound: number = 0): Promise<
|
|
282
|
+
async remote_boombox(sound: number = 0): Promise<CommandResponse> {
|
|
264
283
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/remote_boombox`, null, { sound });
|
|
265
284
|
}
|
|
266
285
|
|
|
@@ -269,7 +288,7 @@ export default class VehicleSpecific {
|
|
|
269
288
|
* @param seat_position Seat position
|
|
270
289
|
* @param seat_cooler_level Cooling level
|
|
271
290
|
*/
|
|
272
|
-
async remote_seat_cooler_request(seat_position: Seat | number, seat_cooler_level: Level): Promise<
|
|
291
|
+
async remote_seat_cooler_request(seat_position: Seat | number, seat_cooler_level: Level): Promise<CommandResponse> {
|
|
273
292
|
if (typeof seat_position === "string") {
|
|
274
293
|
seat_position = Seats[seat_position];
|
|
275
294
|
}
|
|
@@ -284,7 +303,7 @@ export default class VehicleSpecific {
|
|
|
284
303
|
* @param seat_position Seat position
|
|
285
304
|
* @param seat_heater_level Heating level
|
|
286
305
|
*/
|
|
287
|
-
async remote_seat_heater_request(seat_position: Seat | number, seat_heater_level: Level): Promise<
|
|
306
|
+
async remote_seat_heater_request(seat_position: Seat | number, seat_heater_level: Level): Promise<CommandResponse> {
|
|
288
307
|
if (typeof seat_position === "string") {
|
|
289
308
|
seat_position = Seats[seat_position];
|
|
290
309
|
}
|
|
@@ -297,7 +316,7 @@ export default class VehicleSpecific {
|
|
|
297
316
|
/**
|
|
298
317
|
* Starts the vehicle remotely. Requires keyless driving to be enabled.
|
|
299
318
|
*/
|
|
300
|
-
async remote_start_drive(): Promise<
|
|
319
|
+
async remote_start_drive(): Promise<CommandResponse> {
|
|
301
320
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/remote_start_drive`);
|
|
302
321
|
}
|
|
303
322
|
|
|
@@ -305,7 +324,7 @@ export default class VehicleSpecific {
|
|
|
305
324
|
* Sets steering wheel heat level.
|
|
306
325
|
* @param level Heating level
|
|
307
326
|
*/
|
|
308
|
-
async remote_steering_wheel_heat_level_request(level: Level): Promise<
|
|
327
|
+
async remote_steering_wheel_heat_level_request(level: Level): Promise<CommandResponse> {
|
|
309
328
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/remote_steering_wheel_heat_level_request`, null, { level });
|
|
310
329
|
}
|
|
311
330
|
|
|
@@ -313,21 +332,21 @@ export default class VehicleSpecific {
|
|
|
313
332
|
* Sets steering wheel heating on/off. For vehicles that do not support auto steering wheel heat.
|
|
314
333
|
* @param on `true` or `false`
|
|
315
334
|
*/
|
|
316
|
-
async remote_steering_wheel_heater_request(on: boolean): Promise<
|
|
335
|
+
async remote_steering_wheel_heater_request(on: boolean): Promise<CommandResponse> {
|
|
317
336
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/remote_steering_wheel_heater_request`, null, { on });
|
|
318
337
|
}
|
|
319
338
|
|
|
320
339
|
/**
|
|
321
340
|
* Removes PIN to Drive. Requires the car to be in Pin to Drive mode and not in Valet mode. Note that this only works if PIN to Drive is not active. This command also requires the Tesla Vehicle Command Protocol - for more information, please see refer to the documentation here.
|
|
322
341
|
*/
|
|
323
|
-
async reset_pin_to_drive_pin(): Promise<
|
|
342
|
+
async reset_pin_to_drive_pin(): Promise<CommandResponse> {
|
|
324
343
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/reset_pin_to_drive_pin`);
|
|
325
344
|
}
|
|
326
345
|
|
|
327
346
|
/**
|
|
328
347
|
* Removes PIN for Valet Mode.
|
|
329
348
|
*/
|
|
330
|
-
async reset_valet_pin(): Promise<
|
|
349
|
+
async reset_valet_pin(): Promise<CommandResponse> {
|
|
331
350
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/reset_valet_pin`);
|
|
332
351
|
}
|
|
333
352
|
|
|
@@ -335,7 +354,7 @@ export default class VehicleSpecific {
|
|
|
335
354
|
* Schedules a vehicle software update (over the air "OTA") to be installed in the future.
|
|
336
355
|
* @param offset_sec Offset in seconds
|
|
337
356
|
*/
|
|
338
|
-
async schedule_software_update(offset_sec: number): Promise<
|
|
357
|
+
async schedule_software_update(offset_sec: number): Promise<CommandResponse> {
|
|
339
358
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/schedule_software_update`, null, { offset_sec });
|
|
340
359
|
}
|
|
341
360
|
|
|
@@ -344,7 +363,7 @@ export default class VehicleSpecific {
|
|
|
344
363
|
* @param on `true` or `false`
|
|
345
364
|
* @param manual_override `true` or `false`
|
|
346
365
|
*/
|
|
347
|
-
async set_bioweapon_mode(on: boolean, manual_override: boolean): Promise<
|
|
366
|
+
async set_bioweapon_mode(on: boolean, manual_override: boolean): Promise<CommandResponse> {
|
|
348
367
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_bioweapon_mode`, null, { on, manual_override });
|
|
349
368
|
}
|
|
350
369
|
|
|
@@ -353,7 +372,7 @@ export default class VehicleSpecific {
|
|
|
353
372
|
* @param on `true` or `false`
|
|
354
373
|
* @param fan_only `true` or `false`
|
|
355
374
|
*/
|
|
356
|
-
async set_cabin_overheat_protection(on: boolean, fan_only: boolean): Promise<
|
|
375
|
+
async set_cabin_overheat_protection(on: boolean, fan_only: boolean): Promise<CommandResponse> {
|
|
357
376
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_cabin_overheat_protection`, null, { on, fan_only });
|
|
358
377
|
}
|
|
359
378
|
|
|
@@ -361,7 +380,7 @@ export default class VehicleSpecific {
|
|
|
361
380
|
* Sets the vehicle's charge limit to a custom percentage.
|
|
362
381
|
* @param percent Charge limit percentage typically between 50-100
|
|
363
382
|
*/
|
|
364
|
-
async set_charge_limit(percent: number): Promise<
|
|
383
|
+
async set_charge_limit(percent: number): Promise<CommandResponse> {
|
|
365
384
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_charge_limit`, null, { percent });
|
|
366
385
|
}
|
|
367
386
|
|
|
@@ -369,7 +388,7 @@ export default class VehicleSpecific {
|
|
|
369
388
|
* Sets the charge limit to the standard setting.
|
|
370
389
|
* @param percent Current limit in Amps typically between 5-32
|
|
371
390
|
*/
|
|
372
|
-
async set_charging_amps(charging_amps: number): Promise<
|
|
391
|
+
async set_charging_amps(charging_amps: number): Promise<CommandResponse> {
|
|
373
392
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_charging_amps`, null, { charging_amps });
|
|
374
393
|
}
|
|
375
394
|
|
|
@@ -377,7 +396,7 @@ export default class VehicleSpecific {
|
|
|
377
396
|
* Enables climate keeper mode.
|
|
378
397
|
* @param climate_keeper_mode `0` is Off, `1` is Keep, `2` is Dog, `3` is Camp
|
|
379
398
|
*/
|
|
380
|
-
async set_climate_keeper_mode(climate_keeper_mode: number | ClimateMode): Promise<
|
|
399
|
+
async set_climate_keeper_mode(climate_keeper_mode: number | ClimateMode): Promise<CommandResponse> {
|
|
381
400
|
if (typeof climate_keeper_mode === "string") {
|
|
382
401
|
climate_keeper_mode = ClimateModes[climate_keeper_mode];
|
|
383
402
|
}
|
|
@@ -388,7 +407,7 @@ export default class VehicleSpecific {
|
|
|
388
407
|
* Adjusts the Cabin Overheat Protection temperature (COP).
|
|
389
408
|
* @param cop_temp Integer representing Low (0/30C/90F), Medium (1/35C/95F), or High (2/40C/100F)
|
|
390
409
|
*/
|
|
391
|
-
async set_cop_temp(cop_temp: 0 | 1 | 2 | 30 | 35 | 40 | 90 | 95 | 100): Promise<
|
|
410
|
+
async set_cop_temp(cop_temp: 0 | 1 | 2 | 30 | 35 | 40 | 90 | 95 | 100): Promise<CommandResponse> {
|
|
392
411
|
if (cop_temp >= 90) {
|
|
393
412
|
cop_temp = (cop_temp - 90) / 5;
|
|
394
413
|
} else if (cop_temp >= 30) {
|
|
@@ -403,7 +422,7 @@ export default class VehicleSpecific {
|
|
|
403
422
|
* @param on `true` or `false`
|
|
404
423
|
* @param password Four-digit passcode
|
|
405
424
|
*/
|
|
406
|
-
async set_pin_to_drive(on: boolean, password: string | number): Promise<
|
|
425
|
+
async set_pin_to_drive(on: boolean, password: string | number): Promise<CommandResponse> {
|
|
407
426
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_pin_to_drive`, null, { on, password: String(password) });
|
|
408
427
|
}
|
|
409
428
|
|
|
@@ -413,7 +432,7 @@ export default class VehicleSpecific {
|
|
|
413
432
|
* @param on `true` or `false`
|
|
414
433
|
* @param manual_override `true` or `false`
|
|
415
434
|
*/
|
|
416
|
-
async set_preconditioning_max(on: boolean, manual_override: boolean): Promise<
|
|
435
|
+
async set_preconditioning_max(on: boolean, manual_override: boolean): Promise<CommandResponse> {
|
|
417
436
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_preconditioning_max`, null, { on, manual_override });
|
|
418
437
|
}
|
|
419
438
|
|
|
@@ -422,7 +441,7 @@ export default class VehicleSpecific {
|
|
|
422
441
|
* @param enable `true` or `false`
|
|
423
442
|
* @param time Minutes after midnight
|
|
424
443
|
*/
|
|
425
|
-
async set_scheduled_charging(enable: boolean, time: number): Promise<
|
|
444
|
+
async set_scheduled_charging(enable: boolean, time: number): Promise<CommandResponse> {
|
|
426
445
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_scheduled_charging`, null, { enable, time });
|
|
427
446
|
}
|
|
428
447
|
|
|
@@ -444,7 +463,7 @@ export default class VehicleSpecific {
|
|
|
444
463
|
off_peak_charging_enabled: boolean = false,
|
|
445
464
|
off_peak_charging_weekdays_only: boolean = false,
|
|
446
465
|
end_off_peak_time: number = 0
|
|
447
|
-
): Promise<
|
|
466
|
+
): Promise<CommandResponse> {
|
|
448
467
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_scheduled_departure`, null, {
|
|
449
468
|
enable,
|
|
450
469
|
preconditioning_enabled,
|
|
@@ -460,7 +479,7 @@ export default class VehicleSpecific {
|
|
|
460
479
|
* Enables and disables Sentry Mode. Sentry Mode allows customers to watch the vehicle cameras live from the mobile app, as well as record sentry events.
|
|
461
480
|
* @param on `true` or `false`
|
|
462
481
|
*/
|
|
463
|
-
async set_sentry_mode(on: boolean): Promise<
|
|
482
|
+
async set_sentry_mode(on: boolean): Promise<CommandResponse> {
|
|
464
483
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_sentry_mode`, null, { on });
|
|
465
484
|
}
|
|
466
485
|
|
|
@@ -469,7 +488,7 @@ export default class VehicleSpecific {
|
|
|
469
488
|
* @param driver_temp Driver temperature
|
|
470
489
|
* @param passenger_temp Passenger temperature
|
|
471
490
|
*/
|
|
472
|
-
async set_temps(driver_temp: number, passenger_temp: number): Promise<
|
|
491
|
+
async set_temps(driver_temp: number, passenger_temp: number): Promise<CommandResponse> {
|
|
473
492
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_temps`, null, { driver_temp, passenger_temp });
|
|
474
493
|
}
|
|
475
494
|
|
|
@@ -478,7 +497,7 @@ export default class VehicleSpecific {
|
|
|
478
497
|
* @param on `true` or `false`
|
|
479
498
|
* @param password Four-digit passcode
|
|
480
499
|
*/
|
|
481
|
-
async set_valet_mode(on: boolean, password: string | number): Promise<
|
|
500
|
+
async set_valet_mode(on: boolean, password: string | number): Promise<CommandResponse> {
|
|
482
501
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_valet_mode`, null, { on, password: String(password) });
|
|
483
502
|
}
|
|
484
503
|
|
|
@@ -486,7 +505,7 @@ export default class VehicleSpecific {
|
|
|
486
505
|
* Changes the name of a vehicle. This command also requires the Tesla Vehicle Command Protocol - for more information, please see refer to the documentation here.
|
|
487
506
|
* @param vehicle_name New name
|
|
488
507
|
*/
|
|
489
|
-
async set_vehicle_name(vehicle_name: string): Promise<
|
|
508
|
+
async set_vehicle_name(vehicle_name: string): Promise<CommandResponse> {
|
|
490
509
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/set_vehicle_name`, null, { vehicle_name });
|
|
491
510
|
}
|
|
492
511
|
|
|
@@ -494,7 +513,7 @@ export default class VehicleSpecific {
|
|
|
494
513
|
* Activates Speed Limit Mode with a four-digit PIN.
|
|
495
514
|
* @param pin Four-digit PIN
|
|
496
515
|
*/
|
|
497
|
-
async speed_limit_activate(pin: string | number): Promise<
|
|
516
|
+
async speed_limit_activate(pin: string | number): Promise<CommandResponse> {
|
|
498
517
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/speed_limit_activate`, null, { pin: String(pin) });
|
|
499
518
|
}
|
|
500
519
|
|
|
@@ -502,14 +521,14 @@ export default class VehicleSpecific {
|
|
|
502
521
|
* Deactivates Speed Limit Mode and resets the associated PIN.
|
|
503
522
|
* @param pin Four-digit PIN
|
|
504
523
|
*/
|
|
505
|
-
async speed_limit_clear_pin(pin: string | number): Promise<
|
|
524
|
+
async speed_limit_clear_pin(pin: string | number): Promise<CommandResponse> {
|
|
506
525
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/speed_limit_clear_pin`, null, { pin: String(pin) });
|
|
507
526
|
}
|
|
508
527
|
|
|
509
528
|
/**
|
|
510
529
|
* Deactivates Speed Limit Mode and resets the associated PIN for vehicles running firmware versions 2023.38+. This command is only accessible to fleet managers or owners.
|
|
511
530
|
*/
|
|
512
|
-
async speed_limit_clear_pin_admin(): Promise<
|
|
531
|
+
async speed_limit_clear_pin_admin(): Promise<CommandResponse> {
|
|
513
532
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/speed_limit_clear_pin_admin`);
|
|
514
533
|
}
|
|
515
534
|
|
|
@@ -517,7 +536,7 @@ export default class VehicleSpecific {
|
|
|
517
536
|
* Deactivates Speed Limit Mode.
|
|
518
537
|
* @param pin Four-digit PIN
|
|
519
538
|
*/
|
|
520
|
-
async speed_limit_deactivate(pin: string | number): Promise<
|
|
539
|
+
async speed_limit_deactivate(pin: string | number): Promise<CommandResponse> {
|
|
521
540
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/speed_limit_deactivate`, null, { pin: String(pin) });
|
|
522
541
|
}
|
|
523
542
|
|
|
@@ -525,7 +544,7 @@ export default class VehicleSpecific {
|
|
|
525
544
|
* Sets the maximum speed allowed when Speed Limit Mode is active.
|
|
526
545
|
* @param limit_mph Maximum speed in MPH
|
|
527
546
|
*/
|
|
528
|
-
async speed_limit_set_limit(limit_mph: number): Promise<
|
|
547
|
+
async speed_limit_set_limit(limit_mph: number): Promise<CommandResponse> {
|
|
529
548
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/speed_limit_set_limit`, null, { limit_mph });
|
|
530
549
|
}
|
|
531
550
|
|
|
@@ -533,7 +552,7 @@ export default class VehicleSpecific {
|
|
|
533
552
|
* Controls the panoramic sunroof on the Model S.
|
|
534
553
|
* @param state "stop", "close" or "vent"
|
|
535
554
|
*/
|
|
536
|
-
async sun_roof_control(state: "stop" | "close" | "vent"): Promise<
|
|
555
|
+
async sun_roof_control(state: "stop" | "close" | "vent"): Promise<CommandResponse> {
|
|
537
556
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/sun_roof_control`, null, { state });
|
|
538
557
|
}
|
|
539
558
|
|
|
@@ -541,7 +560,7 @@ export default class VehicleSpecific {
|
|
|
541
560
|
* Records a drive note. The note parameter is truncated to 80 characters in length.
|
|
542
561
|
* @param note Drive note
|
|
543
562
|
*/
|
|
544
|
-
async take_drivenote(note: string): Promise<
|
|
563
|
+
async take_drivenote(note: string): Promise<CommandResponse> {
|
|
545
564
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/take_drivenote`, null, { note });
|
|
546
565
|
}
|
|
547
566
|
|
|
@@ -551,7 +570,7 @@ export default class VehicleSpecific {
|
|
|
551
570
|
* @param lat Latitude
|
|
552
571
|
* @param lon Longitude
|
|
553
572
|
*/
|
|
554
|
-
async trigger_homelink(lat: number, lon: number, token?: string): Promise<
|
|
573
|
+
async trigger_homelink(lat: number, lon: number, token?: string): Promise<CommandResponse> {
|
|
555
574
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/trigger_homelink`, null, { token, lat, lon });
|
|
556
575
|
}
|
|
557
576
|
|
|
@@ -559,7 +578,7 @@ export default class VehicleSpecific {
|
|
|
559
578
|
* Upcoming calendar entries stored on the vehicle.
|
|
560
579
|
* @param calendar_data Calendar data
|
|
561
580
|
*/
|
|
562
|
-
async upcoming_calendar_entries(calendar_data: string): Promise<
|
|
581
|
+
async upcoming_calendar_entries(calendar_data: string): Promise<CommandResponse> {
|
|
563
582
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/upcoming_calendar_entries`, null, { calendar_data });
|
|
564
583
|
}
|
|
565
584
|
|
|
@@ -569,7 +588,7 @@ export default class VehicleSpecific {
|
|
|
569
588
|
* @param lat Latitude
|
|
570
589
|
* @param lon Longitude
|
|
571
590
|
*/
|
|
572
|
-
async window_control(command: "vent" | "close", lat: number, lon: number): Promise<
|
|
591
|
+
async window_control(command: "vent" | "close", lat: number, lon: number): Promise<CommandResponse> {
|
|
573
592
|
return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/window_control`, null, { command, lat, lon });
|
|
574
593
|
}
|
|
575
594
|
|