tesla-fleet-api 0.0.5 → 0.0.7

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