tesla-fleet-api 0.4.0 → 0.5.0

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 (219) hide show
  1. package/README.md +284 -1
  2. package/dist/_virtual/_rolldown/runtime.cjs +10 -0
  3. package/dist/bluetooth/adapters/shared.cjs +38 -0
  4. package/dist/bluetooth/adapters/shared.mjs +36 -0
  5. package/dist/bluetooth/async.cjs +121 -0
  6. package/dist/bluetooth/async.d.cts +10 -0
  7. package/dist/bluetooth/async.d.mts +10 -0
  8. package/dist/bluetooth/async.mjs +116 -0
  9. package/dist/bluetooth/broadcast.cjs +153 -0
  10. package/dist/bluetooth/broadcast.d.cts +59 -0
  11. package/dist/bluetooth/broadcast.d.mts +59 -0
  12. package/dist/bluetooth/broadcast.mjs +151 -0
  13. package/dist/bluetooth/constants.cjs +99 -0
  14. package/dist/bluetooth/constants.d.cts +70 -0
  15. package/dist/bluetooth/constants.d.mts +70 -0
  16. package/dist/bluetooth/constants.mjs +72 -0
  17. package/dist/bluetooth/esphome.cjs +292 -0
  18. package/dist/bluetooth/esphome.d.cts +83 -0
  19. package/dist/bluetooth/esphome.d.mts +83 -0
  20. package/dist/bluetooth/esphome.mjs +291 -0
  21. package/dist/bluetooth/framing.cjs +125 -0
  22. package/dist/bluetooth/framing.d.cts +45 -0
  23. package/dist/bluetooth/framing.d.mts +45 -0
  24. package/dist/bluetooth/framing.mjs +122 -0
  25. package/dist/bluetooth/homey.cjs +155 -0
  26. package/dist/bluetooth/homey.d.cts +75 -0
  27. package/dist/bluetooth/homey.d.mts +75 -0
  28. package/dist/bluetooth/homey.mjs +150 -0
  29. package/dist/bluetooth/names.cjs +24 -0
  30. package/dist/bluetooth/names.d.cts +10 -0
  31. package/dist/bluetooth/names.d.mts +10 -0
  32. package/dist/bluetooth/names.mjs +20 -0
  33. package/dist/bluetooth/noble.cjs +178 -0
  34. package/dist/bluetooth/noble.d.cts +58 -0
  35. package/dist/bluetooth/noble.d.mts +58 -0
  36. package/dist/bluetooth/noble.mjs +177 -0
  37. package/dist/bluetooth/streamglue.cjs +157 -0
  38. package/dist/bluetooth/streamglue.d.cts +37 -0
  39. package/dist/bluetooth/streamglue.d.mts +37 -0
  40. package/dist/bluetooth/streamglue.mjs +154 -0
  41. package/dist/bluetooth/teslabluetooth.cjs +67 -0
  42. package/dist/bluetooth/teslabluetooth.d.cts +41 -0
  43. package/dist/bluetooth/teslabluetooth.d.mts +41 -0
  44. package/dist/bluetooth/teslabluetooth.mjs +66 -0
  45. package/dist/bluetooth/transport.cjs +10 -0
  46. package/dist/bluetooth/transport.d.cts +95 -0
  47. package/dist/bluetooth/transport.d.mts +95 -0
  48. package/dist/bluetooth/transport.mjs +10 -0
  49. package/dist/bluetooth/vehiclebluetooth.cjs +1272 -0
  50. package/dist/bluetooth/vehiclebluetooth.d.cts +495 -0
  51. package/dist/bluetooth/vehiclebluetooth.d.mts +495 -0
  52. package/dist/bluetooth/vehiclebluetooth.mjs +1270 -0
  53. package/dist/bluetooth/verify.cjs +93 -0
  54. package/dist/bluetooth/verify.d.cts +35 -0
  55. package/dist/bluetooth/verify.d.mts +35 -0
  56. package/dist/bluetooth/verify.mjs +91 -0
  57. package/dist/bluetooth.cjs +53 -0
  58. package/dist/bluetooth.d.cts +10 -0
  59. package/dist/bluetooth.d.mts +10 -0
  60. package/dist/bluetooth.mjs +9 -0
  61. package/dist/commands.cjs +1080 -85
  62. package/dist/commands.d.cts +585 -54
  63. package/dist/commands.d.mts +583 -51
  64. package/dist/commands.mjs +1084 -93
  65. package/dist/const.cjs +22 -0
  66. package/dist/const.d.cts +21 -0
  67. package/dist/const.d.mts +21 -0
  68. package/dist/const.mjs +20 -1
  69. package/dist/energy.cjs +24 -19
  70. package/dist/energy.d.cts +21 -15
  71. package/dist/energy.d.mts +21 -15
  72. package/dist/energy.mjs +24 -19
  73. package/dist/energyisland.cjs +38 -0
  74. package/dist/energyisland.mjs +37 -0
  75. package/dist/energyparsers.cjs +118 -0
  76. package/dist/energyparsers.d.cts +39 -0
  77. package/dist/energyparsers.d.mts +39 -0
  78. package/dist/energyparsers.mjs +116 -0
  79. package/dist/energyspecific.cjs +375 -17
  80. package/dist/energyspecific.d.cts +199 -19
  81. package/dist/energyspecific.d.mts +197 -16
  82. package/dist/energyspecific.mjs +370 -18
  83. package/dist/exceptions.cjs +3 -2
  84. package/dist/exceptions.d.cts +3 -2
  85. package/dist/exceptions.d.mts +3 -2
  86. package/dist/exceptions.mjs +3 -2
  87. package/dist/funnel.cjs +297 -0
  88. package/dist/funnel.d.cts +118 -0
  89. package/dist/funnel.d.mts +118 -0
  90. package/dist/funnel.mjs +292 -0
  91. package/dist/index.cjs +61 -0
  92. package/dist/index.d.cts +22 -8
  93. package/dist/index.d.mts +22 -8
  94. package/dist/index.mjs +19 -6
  95. package/dist/log.cjs +75 -0
  96. package/dist/log.d.cts +4 -0
  97. package/dist/log.d.mts +4 -0
  98. package/dist/log.mjs +71 -0
  99. package/dist/oauth.cjs +143 -0
  100. package/dist/oauth.d.cts +69 -0
  101. package/dist/oauth.d.mts +69 -0
  102. package/dist/oauth.mjs +143 -0
  103. package/dist/powerwall/client.cjs +818 -0
  104. package/dist/powerwall/client.d.cts +297 -0
  105. package/dist/powerwall/client.d.mts +297 -0
  106. package/dist/powerwall/client.mjs +807 -0
  107. package/dist/powerwall/components.cjs +188 -0
  108. package/dist/powerwall/components.d.cts +45 -0
  109. package/dist/powerwall/components.d.mts +45 -0
  110. package/dist/powerwall/components.mjs +182 -0
  111. package/dist/powerwall/energysite.cjs +216 -0
  112. package/dist/powerwall/energysite.d.cts +104 -0
  113. package/dist/powerwall/energysite.d.mts +104 -0
  114. package/dist/powerwall/energysite.mjs +214 -0
  115. package/dist/powerwall/exceptions.cjs +59 -0
  116. package/dist/powerwall/exceptions.d.cts +38 -0
  117. package/dist/powerwall/exceptions.d.mts +38 -0
  118. package/dist/powerwall/exceptions.mjs +51 -0
  119. package/dist/powerwall/gateway.cjs +102 -0
  120. package/dist/powerwall/gateway.d.cts +57 -0
  121. package/dist/powerwall/gateway.d.mts +57 -0
  122. package/dist/powerwall/gateway.mjs +101 -0
  123. package/dist/powerwall/merge.cjs +163 -0
  124. package/dist/powerwall/merge.d.cts +63 -0
  125. package/dist/powerwall/merge.d.mts +63 -0
  126. package/dist/powerwall/merge.mjs +159 -0
  127. package/dist/powerwall/models.d.cts +95 -0
  128. package/dist/powerwall/models.d.mts +95 -0
  129. package/dist/powerwall/queries.cjs +17 -0
  130. package/dist/powerwall/queries.mjs +10 -0
  131. package/dist/powerwall/transport.cjs +232 -0
  132. package/dist/powerwall/transport.mjs +227 -0
  133. package/dist/powerwall.cjs +47 -0
  134. package/dist/powerwall.d.cts +9 -0
  135. package/dist/powerwall.d.mts +9 -0
  136. package/dist/powerwall.mjs +8 -0
  137. package/dist/router/base.cjs +203 -0
  138. package/dist/router/base.d.cts +112 -0
  139. package/dist/router/base.d.mts +112 -0
  140. package/dist/router/base.mjs +200 -0
  141. package/dist/router/energysite.cjs +65 -0
  142. package/dist/router/energysite.d.cts +47 -0
  143. package/dist/router/energysite.d.mts +47 -0
  144. package/dist/router/energysite.mjs +60 -0
  145. package/dist/router.cjs +13 -0
  146. package/dist/router.d.cts +3 -1
  147. package/dist/router.d.mts +3 -1
  148. package/dist/router.mjs +3 -1
  149. package/dist/signing/crypto.cjs +28 -0
  150. package/dist/signing/crypto.mjs +26 -1
  151. package/dist/signing/energy.cjs +123 -0
  152. package/dist/signing/energy.d.cts +45 -0
  153. package/dist/signing/energy.d.mts +45 -0
  154. package/dist/signing/energy.mjs +120 -0
  155. package/dist/signing/jws.cjs +229 -0
  156. package/dist/signing/jws.d.cts +45 -0
  157. package/dist/signing/jws.d.mts +45 -0
  158. package/dist/signing/jws.mjs +211 -0
  159. package/dist/signing/keys.cjs +191 -0
  160. package/dist/signing/keys.d.cts +21 -0
  161. package/dist/signing/keys.d.mts +21 -0
  162. package/dist/signing/keys.mjs +182 -0
  163. package/dist/signing/session.cjs +104 -30
  164. package/dist/signing/session.d.cts +60 -23
  165. package/dist/signing/session.d.mts +60 -23
  166. package/dist/signing/session.mjs +105 -31
  167. package/dist/tariff.cjs +27 -0
  168. package/dist/tariff.d.cts +11 -0
  169. package/dist/tariff.d.mts +11 -0
  170. package/dist/tariff.mjs +27 -1
  171. package/dist/teslafleetapi.cjs +256 -55
  172. package/dist/teslafleetapi.d.cts +110 -14
  173. package/dist/teslafleetapi.d.mts +110 -14
  174. package/dist/teslafleetapi.mjs +258 -57
  175. package/dist/teslemetry.cjs +152 -5
  176. package/dist/teslemetry.d.cts +95 -5
  177. package/dist/teslemetry.d.mts +93 -3
  178. package/dist/teslemetry.mjs +151 -6
  179. package/dist/teslemetryenergy.cjs +287 -0
  180. package/dist/teslemetryenergy.d.cts +154 -0
  181. package/dist/teslemetryenergy.d.mts +154 -0
  182. package/dist/teslemetryenergy.mjs +282 -0
  183. package/dist/teslemetryvehicle.cjs +407 -0
  184. package/dist/teslemetryvehicle.d.cts +238 -0
  185. package/dist/teslemetryvehicle.d.mts +238 -0
  186. package/dist/teslemetryvehicle.mjs +405 -0
  187. package/dist/tessie.cjs +42 -5
  188. package/dist/tessie.d.cts +51 -5
  189. package/dist/tessie.d.mts +49 -3
  190. package/dist/tessie.mjs +42 -5
  191. package/dist/tessievehicle.cjs +514 -0
  192. package/dist/tessievehicle.d.cts +333 -0
  193. package/dist/tessievehicle.d.mts +333 -0
  194. package/dist/tessievehicle.mjs +513 -0
  195. package/dist/types/live_status.d.cts +16 -16
  196. package/dist/types/live_status.d.mts +16 -16
  197. package/dist/types/responses.d.cts +5 -1
  198. package/dist/types/responses.d.mts +5 -1
  199. package/dist/types/vehicle.d.cts +7 -1
  200. package/dist/types/vehicle.d.mts +7 -1
  201. package/dist/types.d.cts +3 -3
  202. package/dist/types.d.mts +3 -3
  203. package/dist/util.cjs +41 -0
  204. package/dist/util.d.cts +18 -0
  205. package/dist/util.d.mts +18 -0
  206. package/dist/util.mjs +40 -0
  207. package/dist/vehicle.cjs +79 -36
  208. package/dist/vehicle.d.cts +42 -26
  209. package/dist/vehicle.d.mts +42 -26
  210. package/dist/vehicle.mjs +80 -37
  211. package/dist/vehiclesigned.cjs +20 -5
  212. package/dist/vehiclesigned.d.cts +14 -5
  213. package/dist/vehiclesigned.d.mts +14 -5
  214. package/dist/vehiclesigned.mjs +20 -5
  215. package/dist/vehiclespecific.cjs +126 -15
  216. package/dist/vehiclespecific.d.cts +82 -18
  217. package/dist/vehiclespecific.d.mts +82 -18
  218. package/dist/vehiclespecific.mjs +126 -15
  219. package/package.json +70 -3
@@ -14,8 +14,8 @@ var VehicleSpecific = class {
14
14
  * Controls the front (which_trunk: "front") or rear (which_trunk: "rear") trunk.
15
15
  * @param which_trunk "front" or "rear"
16
16
  */
17
- async actuate_truck(which_trunk) {
18
- return this.parent.actuate_truck(this.vin, which_trunk);
17
+ async actuate_trunk(which_trunk) {
18
+ return this.parent.actuate_trunk(this.vin, which_trunk);
19
19
  }
20
20
  /**
21
21
  * Adjusts vehicle media playback volume.
@@ -80,9 +80,10 @@ var VehicleSpecific = class {
80
80
  }
81
81
  /**
82
82
  * 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.
83
+ * @param pin Optional four-digit PIN
83
84
  */
84
- async clear_pin_to_drive_admin() {
85
- return this.parent.clear_pin_to_drive_admin(this.vin);
85
+ async clear_pin_to_drive_admin(pin) {
86
+ return this.parent.clear_pin_to_drive_admin(this.vin, pin);
86
87
  }
87
88
  /**
88
89
  * Locks the vehicle.
@@ -168,12 +169,13 @@ var VehicleSpecific = class {
168
169
  }
169
170
  /**
170
171
  * Sends a location to the in-vehicle navigation system.
172
+ * @param value Destination text
171
173
  * @param type "share_ext_content_raw"
172
- * @param locale ISO locale such as "en-US"
173
- * @param timestamp_ms
174
+ * @param locale ISO locale such as "en-US". Defaults to `DEFAULT_LOCALE`.
175
+ * @param timestamp_ms Defaults to now
174
176
  */
175
- async navigation_request(value, locale, type = "share_ext_content_raw") {
176
- return this.parent.navigation_request(this.vin, value, locale, type);
177
+ async navigation_request(value, type = "share_ext_content_raw", locale, timestamp_ms) {
178
+ return this.parent.navigation_request(this.vin, value, type, locale, timestamp_ms);
177
179
  }
178
180
  /**
179
181
  * Start navigation to a supercharger.
@@ -185,6 +187,13 @@ var VehicleSpecific = class {
185
187
  return this.parent.navigation_sc_request(this.vin, id, order);
186
188
  }
187
189
  /**
190
+ * Sends a list of waypoints to the vehicle's navigation system.
191
+ * @param waypoints Comma-separated Google Maps place IDs, e.g. `"refId:ChIJ...,refId:ChIJ..."`
192
+ */
193
+ async navigation_waypoints_request(waypoints) {
194
+ return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/navigation_waypoints_request`, null, { waypoints });
195
+ }
196
+ /**
188
197
  * Sets automatic seat heating and cooling.
189
198
  * @param auto_seat_position `AutoSeat` position (1-indexed: front left is 1, front right is 2)
190
199
  * @param auto_climate_on `true` or `false`
@@ -208,7 +217,7 @@ var VehicleSpecific = class {
208
217
  }
209
218
  /**
210
219
  * Sets seat cooling.
211
- * @param seat_position Seat position
220
+ * @param seat_position `AutoSeat` position (1-indexed: front left is 1, front right is 2), unlike seat heating
212
221
  * @param seat_cooler_level Cooling level
213
222
  */
214
223
  async remote_seat_cooler_request(seat_position, seat_cooler_level) {
@@ -344,6 +353,95 @@ var VehicleSpecific = class {
344
353
  return this.parent.set_scheduled_departure(this.vin, enable, preconditioning_enabled, preconditioning_weekdays_only, departure_time, off_peak_charging_enabled, off_peak_charging_weekdays_only, end_off_peak_time);
345
354
  }
346
355
  /**
356
+ * Add or modify a charging schedule. At least one of `start_time` or `end_time` is required.
357
+ * @param days_of_week Comma-joined day names (e.g. `"Mon,Wed"`, `"All"`, `"Weekdays"`) or a day bitmask
358
+ * @param enabled `true` or `false`
359
+ * @param lat Latitude of the schedule's location
360
+ * @param lon Longitude of the schedule's location
361
+ * @param start_time Minutes after midnight to start charging
362
+ * @param end_time Minutes after midnight to stop charging
363
+ * @param one_time Run the schedule only once
364
+ * @param id Schedule ID to modify an existing schedule
365
+ * @param _name Only the signed path carries a schedule name; REST accepts it for parity and does not send it
366
+ */
367
+ async add_charge_schedule(days_of_week, enabled, lat, lon, start_time, end_time, one_time, id, _name) {
368
+ if (start_time == null && end_time == null) throw new Error("Either start_time or end_time or both must be provided");
369
+ return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/add_charge_schedule`, null, {
370
+ days_of_week,
371
+ enabled,
372
+ end_enabled: end_time != null,
373
+ lat,
374
+ lon,
375
+ start_enabled: start_time != null,
376
+ start_time,
377
+ end_time,
378
+ id,
379
+ one_time
380
+ });
381
+ }
382
+ /**
383
+ * Add or modify a preconditioning schedule.
384
+ * @param days_of_week Comma-joined day names (e.g. `"Mon,Wed"`, `"All"`, `"Weekdays"`) or a day bitmask
385
+ * @param enabled `true` or `false`
386
+ * @param lat Latitude of the schedule's location
387
+ * @param lon Longitude of the schedule's location
388
+ * @param precondition_time Minutes after midnight to be preconditioned by
389
+ * @param id Schedule ID to modify an existing schedule
390
+ * @param one_time Run the schedule only once
391
+ * @param _name Only the signed path carries a schedule name; REST accepts it for parity and does not send it
392
+ */
393
+ async add_precondition_schedule(days_of_week, enabled, lat, lon, precondition_time, id, one_time, _name) {
394
+ return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/add_precondition_schedule`, null, {
395
+ days_of_week,
396
+ enabled,
397
+ lat,
398
+ lon,
399
+ precondition_time,
400
+ id,
401
+ one_time
402
+ });
403
+ }
404
+ /**
405
+ * Removes a charging schedule.
406
+ * @param id Schedule ID
407
+ */
408
+ async remove_charge_schedule(id) {
409
+ return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/remove_charge_schedule`, null, { id });
410
+ }
411
+ /**
412
+ * Removes a preconditioning schedule.
413
+ * @param id Schedule ID
414
+ */
415
+ async remove_precondition_schedule(id) {
416
+ return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/remove_precondition_schedule`, null, { id });
417
+ }
418
+ /**
419
+ * Removes charging schedules by location type.
420
+ * @param home Remove schedules at home
421
+ * @param work Remove schedules at work
422
+ * @param other Remove schedules at other locations
423
+ */
424
+ async batch_remove_charge_schedules(home, work, other) {
425
+ return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/batch_remove_charge_schedules`, null, {
426
+ home,
427
+ work,
428
+ other
429
+ });
430
+ }
431
+ /**
432
+ * Removes preconditioning schedules by location type.
433
+ * @param home Remove schedules at home
434
+ * @param work Remove schedules at work
435
+ * @param other Remove schedules at other locations
436
+ */
437
+ async batch_remove_precondition_schedules(home, work, other) {
438
+ return this.parent.parent._request("POST", `api/1/vehicles/${this.vin}/command/batch_remove_precondition_schedules`, null, {
439
+ home,
440
+ work,
441
+ other
442
+ });
443
+ }
444
+ /**
347
445
  * 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.
348
446
  * @param on `true` or `false`
349
447
  */
@@ -427,8 +525,8 @@ var VehicleSpecific = class {
427
525
  * @param lat Latitude
428
526
  * @param lon Longitude
429
527
  */
430
- async trigger_homelink(lat, lon, token) {
431
- return this.parent.trigger_homelink(this.vin, lat, lon, token);
528
+ async trigger_homelink(token, lat, lon) {
529
+ return this.parent.trigger_homelink(this.vin, token, lat, lon);
432
530
  }
433
531
  /**
434
532
  * Upcoming calendar entries stored on the vehicle.
@@ -486,13 +584,24 @@ var VehicleSpecific = class {
486
584
  * @param config A dictionary description the fleet telemetry configuration
487
585
  * @returns
488
586
  */
489
- async fleet_telemetry_config(config) {
490
- return this.parent.fleet_telemetry_config({
587
+ async fleet_telemetry_config_create(config) {
588
+ return this.parent.fleet_telemetry_config_create({
491
589
  vins: [this.vin],
492
590
  config
493
591
  });
494
592
  }
495
593
  /**
594
+ * Configures fleet telemetry with a Tesla.SS256-signed JWS token, signed by the partner's registered command key.
595
+ * @param vins Vehicle Identification Numbers to configure
596
+ * @param token JWS token wrapping the fleet telemetry configuration
597
+ */
598
+ async fleet_telemetry_config_jws(vins, token) {
599
+ return this.parent.parent._request("POST", "api/1/vehicles/fleet_telemetry_config_jws", null, {
600
+ vins,
601
+ token
602
+ });
603
+ }
604
+ /**
496
605
  * Disconnects vehicles to stream telemetry data to self hosted fleet-telemetry server.
497
606
  * @returns
498
607
  */
@@ -589,9 +698,11 @@ var VehicleSpecific = class {
589
698
  }
590
699
  /**
591
700
  * Wakes the vehicle from sleep, which is a state to minimize idle energy consumption.
701
+ * @param options.wait Poll `vehicle()` until the vehicle reports `online`, raising `VehicleOffline` at the deadline
702
+ * @param options.timeoutMs Deadline for `wait`, in milliseconds (default 60000)
592
703
  */
593
- async wake_up() {
594
- return this.parent.wake_up(this.vin);
704
+ async wake_up(options) {
705
+ return this.parent.wake_up(this.vin, options);
595
706
  }
596
707
  /**
597
708
  * Returns warranty details.
@@ -1,7 +1,7 @@
1
1
  import { CommandResponse, FleetTelemetryConfig } from "./types/commands.cjs";
2
2
  import { AutoSeat, ClimateMode, Level, Seat, Trunk, VehicleDataEndpoint } from "./const.cjs";
3
- import { OptionsResponse } from "./types/responses.cjs";
4
- import { VehicleResponse } from "./types/vehicle.cjs";
3
+ import { OptionsResponse, ResponseEnvelope } from "./types/responses.cjs";
4
+ import { VehicleResponse, WakeUpOptions } from "./types/vehicle.cjs";
5
5
  import { VehicleDataResponse } from "./types/vehicle_data.cjs";
6
6
  import Vehicle from "./vehicle.cjs";
7
7
  declare class VehicleSpecific {
@@ -14,7 +14,7 @@ declare class VehicleSpecific {
14
14
  * Controls the front (which_trunk: "front") or rear (which_trunk: "rear") trunk.
15
15
  * @param which_trunk "front" or "rear"
16
16
  */
17
- actuate_truck(which_trunk: Trunk): Promise<CommandResponse>;
17
+ actuate_trunk(which_trunk: Trunk): Promise<CommandResponse>;
18
18
  /**
19
19
  * Adjusts vehicle media playback volume.
20
20
  * @param volume A floating point number from 0.0 to 11.0.
@@ -58,8 +58,9 @@ declare class VehicleSpecific {
58
58
  charge_stop(): Promise<CommandResponse>;
59
59
  /**
60
60
  * 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.
61
+ * @param pin Optional four-digit PIN
61
62
  */
62
- clear_pin_to_drive_admin(): Promise<CommandResponse>;
63
+ clear_pin_to_drive_admin(pin?: string | number): Promise<CommandResponse>;
63
64
  /**
64
65
  * Locks the vehicle.
65
66
  */
@@ -118,11 +119,12 @@ declare class VehicleSpecific {
118
119
  navigation_gps_request(lat: number, lon: number, order?: number): Promise<CommandResponse>;
119
120
  /**
120
121
  * Sends a location to the in-vehicle navigation system.
122
+ * @param value Destination text
121
123
  * @param type "share_ext_content_raw"
122
- * @param locale ISO locale such as "en-US"
123
- * @param timestamp_ms
124
+ * @param locale ISO locale such as "en-US". Defaults to `DEFAULT_LOCALE`.
125
+ * @param timestamp_ms Defaults to now
124
126
  */
125
- navigation_request(value: string, locale: string, type?: string): Promise<CommandResponse>;
127
+ navigation_request(value: string, type?: string, locale?: string | null, timestamp_ms?: number | null): Promise<CommandResponse>;
126
128
  /**
127
129
  * Start navigation to a supercharger.
128
130
  * @param id Supercharger ID
@@ -130,6 +132,11 @@ declare class VehicleSpecific {
130
132
  * @returns
131
133
  */
132
134
  navigation_sc_request(id: number, order?: number): Promise<CommandResponse>;
135
+ /**
136
+ * Sends a list of waypoints to the vehicle's navigation system.
137
+ * @param waypoints Comma-separated Google Maps place IDs, e.g. `"refId:ChIJ...,refId:ChIJ..."`
138
+ */
139
+ navigation_waypoints_request(waypoints: string): Promise<CommandResponse>;
133
140
  /**
134
141
  * Sets automatic seat heating and cooling.
135
142
  * @param auto_seat_position `AutoSeat` position (1-indexed: front left is 1, front right is 2)
@@ -148,10 +155,10 @@ declare class VehicleSpecific {
148
155
  remote_boombox(sound?: number): Promise<CommandResponse>;
149
156
  /**
150
157
  * Sets seat cooling.
151
- * @param seat_position Seat position
158
+ * @param seat_position `AutoSeat` position (1-indexed: front left is 1, front right is 2), unlike seat heating
152
159
  * @param seat_cooler_level Cooling level
153
160
  */
154
- remote_seat_cooler_request(seat_position: Seat | number, seat_cooler_level: Level): Promise<CommandResponse>;
161
+ remote_seat_cooler_request(seat_position: keyof typeof AutoSeat | number, seat_cooler_level: Level): Promise<CommandResponse>;
155
162
  /**
156
163
  * Sets seat heating.
157
164
  * @param seat_position Seat position
@@ -247,6 +254,55 @@ declare class VehicleSpecific {
247
254
  * @param end_off_peak_time Minutes after midnight
248
255
  */
249
256
  set_scheduled_departure(enable?: boolean, preconditioning_enabled?: boolean, preconditioning_weekdays_only?: boolean, departure_time?: number, off_peak_charging_enabled?: boolean, off_peak_charging_weekdays_only?: boolean, end_off_peak_time?: number): Promise<CommandResponse>;
257
+ /**
258
+ * Add or modify a charging schedule. At least one of `start_time` or `end_time` is required.
259
+ * @param days_of_week Comma-joined day names (e.g. `"Mon,Wed"`, `"All"`, `"Weekdays"`) or a day bitmask
260
+ * @param enabled `true` or `false`
261
+ * @param lat Latitude of the schedule's location
262
+ * @param lon Longitude of the schedule's location
263
+ * @param start_time Minutes after midnight to start charging
264
+ * @param end_time Minutes after midnight to stop charging
265
+ * @param one_time Run the schedule only once
266
+ * @param id Schedule ID to modify an existing schedule
267
+ * @param _name Only the signed path carries a schedule name; REST accepts it for parity and does not send it
268
+ */
269
+ add_charge_schedule(days_of_week: string | number, enabled: boolean, lat: number, lon: number, start_time?: number, end_time?: number, one_time?: boolean, id?: number, _name?: string): Promise<CommandResponse>;
270
+ /**
271
+ * Add or modify a preconditioning schedule.
272
+ * @param days_of_week Comma-joined day names (e.g. `"Mon,Wed"`, `"All"`, `"Weekdays"`) or a day bitmask
273
+ * @param enabled `true` or `false`
274
+ * @param lat Latitude of the schedule's location
275
+ * @param lon Longitude of the schedule's location
276
+ * @param precondition_time Minutes after midnight to be preconditioned by
277
+ * @param id Schedule ID to modify an existing schedule
278
+ * @param one_time Run the schedule only once
279
+ * @param _name Only the signed path carries a schedule name; REST accepts it for parity and does not send it
280
+ */
281
+ add_precondition_schedule(days_of_week: string | number, enabled: boolean, lat: number, lon: number, precondition_time: number, id?: number, one_time?: boolean, _name?: string): Promise<CommandResponse>;
282
+ /**
283
+ * Removes a charging schedule.
284
+ * @param id Schedule ID
285
+ */
286
+ remove_charge_schedule(id: number): Promise<CommandResponse>;
287
+ /**
288
+ * Removes a preconditioning schedule.
289
+ * @param id Schedule ID
290
+ */
291
+ remove_precondition_schedule(id: number): Promise<CommandResponse>;
292
+ /**
293
+ * Removes charging schedules by location type.
294
+ * @param home Remove schedules at home
295
+ * @param work Remove schedules at work
296
+ * @param other Remove schedules at other locations
297
+ */
298
+ batch_remove_charge_schedules(home: boolean, work: boolean, other: boolean): Promise<CommandResponse>;
299
+ /**
300
+ * Removes preconditioning schedules by location type.
301
+ * @param home Remove schedules at home
302
+ * @param work Remove schedules at work
303
+ * @param other Remove schedules at other locations
304
+ */
305
+ batch_remove_precondition_schedules(home: boolean, work: boolean, other: boolean): Promise<CommandResponse>;
250
306
  /**
251
307
  * 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.
252
308
  * @param on `true` or `false`
@@ -263,7 +319,7 @@ declare class VehicleSpecific {
263
319
  * @param on `true` or `false`
264
320
  * @param password Four-digit passcode
265
321
  */
266
- set_valet_mode(on: boolean, password: string | number): Promise<CommandResponse>;
322
+ set_valet_mode(on: boolean, password?: string | number): Promise<CommandResponse>;
267
323
  /**
268
324
  * 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.
269
325
  * @param vehicle_name New name
@@ -309,7 +365,7 @@ declare class VehicleSpecific {
309
365
  * @param lat Latitude
310
366
  * @param lon Longitude
311
367
  */
312
- trigger_homelink(lat: number, lon: number, token?: string): Promise<CommandResponse>;
368
+ trigger_homelink(token?: string, lat?: number, lon?: number): Promise<CommandResponse>;
313
369
  /**
314
370
  * Upcoming calendar entries stored on the vehicle.
315
371
  * @param calendar_data Calendar data
@@ -321,16 +377,16 @@ declare class VehicleSpecific {
321
377
  * @param lat Latitude
322
378
  * @param lon Longitude
323
379
  */
324
- window_control(command: "vent" | "close", lat: number, lon: number): Promise<CommandResponse>;
380
+ window_control(command: "vent" | "close", lat?: number, lon?: number): Promise<CommandResponse>;
325
381
  /**
326
382
  * Returns all allowed drivers for a vehicle. This endpoint is only available for the vehicle owner.
327
383
  */
328
- drivers(): Promise<Record<string, any>>;
384
+ drivers(): Promise<ResponseEnvelope<Record<string, any>[]>>;
329
385
  /**
330
386
  * Removes driver access from a vehicle. Share users can only remove their own access. Owners can remove share access or their own.
331
387
  * @param share_user_id
332
388
  */
333
- drivers_remove(share_user_id?: number): Promise<Record<string, any>>;
389
+ drivers_remove(share_user_id?: string | number): Promise<Record<string, any>>;
334
390
  /**
335
391
  * Returns eligible vehicle subscriptions.
336
392
  * @param vin Vehicle Identification Number
@@ -352,7 +408,13 @@ declare class VehicleSpecific {
352
408
  * @param config A dictionary description the fleet telemetry configuration
353
409
  * @returns
354
410
  */
355
- fleet_telemetry_config(config: FleetTelemetryConfig["config"]): Promise<Record<string, any>>;
411
+ fleet_telemetry_config_create(config: FleetTelemetryConfig["config"]): Promise<Record<string, any>>;
412
+ /**
413
+ * Configures fleet telemetry with a Tesla.SS256-signed JWS token, signed by the partner's registered command key.
414
+ * @param vins Vehicle Identification Numbers to configure
415
+ * @param token JWS token wrapping the fleet telemetry configuration
416
+ */
417
+ fleet_telemetry_config_jws(vins: string[], token: string): Promise<Record<string, any>>;
356
418
  /**
357
419
  * Disconnects vehicles to stream telemetry data to self hosted fleet-telemetry server.
358
420
  * @returns
@@ -414,16 +476,18 @@ declare class VehicleSpecific {
414
476
  /**
415
477
  * Returns information about a vehicle.
416
478
  */
417
- vehicle(): Promise<VehicleResponse>;
479
+ vehicle(): Promise<ResponseEnvelope<VehicleResponse>>;
418
480
  /**
419
481
  * Makes a live call to the vehicle. This may return cached data if the vehicle is offline. For vehicles running firmware versions 2023.38+, location_data is required to fetch vehicle location. This will result in a location sharing icon to show on the vehicle UI.
420
482
  * @param endpoints
421
483
  */
422
- vehicle_data(endpoints?: VehicleDataEndpoint[] | string): Promise<VehicleDataResponse>;
484
+ vehicle_data(endpoints?: VehicleDataEndpoint[] | string): Promise<ResponseEnvelope<VehicleDataResponse>>;
423
485
  /**
424
486
  * Wakes the vehicle from sleep, which is a state to minimize idle energy consumption.
487
+ * @param options.wait Poll `vehicle()` until the vehicle reports `online`, raising `VehicleOffline` at the deadline
488
+ * @param options.timeoutMs Deadline for `wait`, in milliseconds (default 60000)
425
489
  */
426
- wake_up(): Promise<Record<string, any>>;
490
+ wake_up(options?: WakeUpOptions): Promise<ResponseEnvelope<VehicleResponse>>;
427
491
  /**
428
492
  * Returns warranty details.
429
493
  * @param vin
@@ -1,7 +1,7 @@
1
1
  import { CommandResponse, FleetTelemetryConfig } from "./types/commands.mjs";
2
2
  import { AutoSeat, ClimateMode, Level, Seat, Trunk, VehicleDataEndpoint } from "./const.mjs";
3
- import { OptionsResponse } from "./types/responses.mjs";
4
- import { VehicleResponse } from "./types/vehicle.mjs";
3
+ import { OptionsResponse, ResponseEnvelope } from "./types/responses.mjs";
4
+ import { VehicleResponse, WakeUpOptions } from "./types/vehicle.mjs";
5
5
  import { VehicleDataResponse } from "./types/vehicle_data.mjs";
6
6
  import Vehicle from "./vehicle.mjs";
7
7
  export default class VehicleSpecific {
@@ -14,7 +14,7 @@ export default class VehicleSpecific {
14
14
  * Controls the front (which_trunk: "front") or rear (which_trunk: "rear") trunk.
15
15
  * @param which_trunk "front" or "rear"
16
16
  */
17
- actuate_truck(which_trunk: Trunk): Promise<CommandResponse>;
17
+ actuate_trunk(which_trunk: Trunk): Promise<CommandResponse>;
18
18
  /**
19
19
  * Adjusts vehicle media playback volume.
20
20
  * @param volume A floating point number from 0.0 to 11.0.
@@ -58,8 +58,9 @@ export default class VehicleSpecific {
58
58
  charge_stop(): Promise<CommandResponse>;
59
59
  /**
60
60
  * 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.
61
+ * @param pin Optional four-digit PIN
61
62
  */
62
- clear_pin_to_drive_admin(): Promise<CommandResponse>;
63
+ clear_pin_to_drive_admin(pin?: string | number): Promise<CommandResponse>;
63
64
  /**
64
65
  * Locks the vehicle.
65
66
  */
@@ -118,11 +119,12 @@ export default class VehicleSpecific {
118
119
  navigation_gps_request(lat: number, lon: number, order?: number): Promise<CommandResponse>;
119
120
  /**
120
121
  * Sends a location to the in-vehicle navigation system.
122
+ * @param value Destination text
121
123
  * @param type "share_ext_content_raw"
122
- * @param locale ISO locale such as "en-US"
123
- * @param timestamp_ms
124
+ * @param locale ISO locale such as "en-US". Defaults to `DEFAULT_LOCALE`.
125
+ * @param timestamp_ms Defaults to now
124
126
  */
125
- navigation_request(value: string, locale: string, type?: string): Promise<CommandResponse>;
127
+ navigation_request(value: string, type?: string, locale?: string | null, timestamp_ms?: number | null): Promise<CommandResponse>;
126
128
  /**
127
129
  * Start navigation to a supercharger.
128
130
  * @param id Supercharger ID
@@ -130,6 +132,11 @@ export default class VehicleSpecific {
130
132
  * @returns
131
133
  */
132
134
  navigation_sc_request(id: number, order?: number): Promise<CommandResponse>;
135
+ /**
136
+ * Sends a list of waypoints to the vehicle's navigation system.
137
+ * @param waypoints Comma-separated Google Maps place IDs, e.g. `"refId:ChIJ...,refId:ChIJ..."`
138
+ */
139
+ navigation_waypoints_request(waypoints: string): Promise<CommandResponse>;
133
140
  /**
134
141
  * Sets automatic seat heating and cooling.
135
142
  * @param auto_seat_position `AutoSeat` position (1-indexed: front left is 1, front right is 2)
@@ -148,10 +155,10 @@ export default class VehicleSpecific {
148
155
  remote_boombox(sound?: number): Promise<CommandResponse>;
149
156
  /**
150
157
  * Sets seat cooling.
151
- * @param seat_position Seat position
158
+ * @param seat_position `AutoSeat` position (1-indexed: front left is 1, front right is 2), unlike seat heating
152
159
  * @param seat_cooler_level Cooling level
153
160
  */
154
- remote_seat_cooler_request(seat_position: Seat | number, seat_cooler_level: Level): Promise<CommandResponse>;
161
+ remote_seat_cooler_request(seat_position: keyof typeof AutoSeat | number, seat_cooler_level: Level): Promise<CommandResponse>;
155
162
  /**
156
163
  * Sets seat heating.
157
164
  * @param seat_position Seat position
@@ -247,6 +254,55 @@ export default class VehicleSpecific {
247
254
  * @param end_off_peak_time Minutes after midnight
248
255
  */
249
256
  set_scheduled_departure(enable?: boolean, preconditioning_enabled?: boolean, preconditioning_weekdays_only?: boolean, departure_time?: number, off_peak_charging_enabled?: boolean, off_peak_charging_weekdays_only?: boolean, end_off_peak_time?: number): Promise<CommandResponse>;
257
+ /**
258
+ * Add or modify a charging schedule. At least one of `start_time` or `end_time` is required.
259
+ * @param days_of_week Comma-joined day names (e.g. `"Mon,Wed"`, `"All"`, `"Weekdays"`) or a day bitmask
260
+ * @param enabled `true` or `false`
261
+ * @param lat Latitude of the schedule's location
262
+ * @param lon Longitude of the schedule's location
263
+ * @param start_time Minutes after midnight to start charging
264
+ * @param end_time Minutes after midnight to stop charging
265
+ * @param one_time Run the schedule only once
266
+ * @param id Schedule ID to modify an existing schedule
267
+ * @param _name Only the signed path carries a schedule name; REST accepts it for parity and does not send it
268
+ */
269
+ add_charge_schedule(days_of_week: string | number, enabled: boolean, lat: number, lon: number, start_time?: number, end_time?: number, one_time?: boolean, id?: number, _name?: string): Promise<CommandResponse>;
270
+ /**
271
+ * Add or modify a preconditioning schedule.
272
+ * @param days_of_week Comma-joined day names (e.g. `"Mon,Wed"`, `"All"`, `"Weekdays"`) or a day bitmask
273
+ * @param enabled `true` or `false`
274
+ * @param lat Latitude of the schedule's location
275
+ * @param lon Longitude of the schedule's location
276
+ * @param precondition_time Minutes after midnight to be preconditioned by
277
+ * @param id Schedule ID to modify an existing schedule
278
+ * @param one_time Run the schedule only once
279
+ * @param _name Only the signed path carries a schedule name; REST accepts it for parity and does not send it
280
+ */
281
+ add_precondition_schedule(days_of_week: string | number, enabled: boolean, lat: number, lon: number, precondition_time: number, id?: number, one_time?: boolean, _name?: string): Promise<CommandResponse>;
282
+ /**
283
+ * Removes a charging schedule.
284
+ * @param id Schedule ID
285
+ */
286
+ remove_charge_schedule(id: number): Promise<CommandResponse>;
287
+ /**
288
+ * Removes a preconditioning schedule.
289
+ * @param id Schedule ID
290
+ */
291
+ remove_precondition_schedule(id: number): Promise<CommandResponse>;
292
+ /**
293
+ * Removes charging schedules by location type.
294
+ * @param home Remove schedules at home
295
+ * @param work Remove schedules at work
296
+ * @param other Remove schedules at other locations
297
+ */
298
+ batch_remove_charge_schedules(home: boolean, work: boolean, other: boolean): Promise<CommandResponse>;
299
+ /**
300
+ * Removes preconditioning schedules by location type.
301
+ * @param home Remove schedules at home
302
+ * @param work Remove schedules at work
303
+ * @param other Remove schedules at other locations
304
+ */
305
+ batch_remove_precondition_schedules(home: boolean, work: boolean, other: boolean): Promise<CommandResponse>;
250
306
  /**
251
307
  * 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.
252
308
  * @param on `true` or `false`
@@ -263,7 +319,7 @@ export default class VehicleSpecific {
263
319
  * @param on `true` or `false`
264
320
  * @param password Four-digit passcode
265
321
  */
266
- set_valet_mode(on: boolean, password: string | number): Promise<CommandResponse>;
322
+ set_valet_mode(on: boolean, password?: string | number): Promise<CommandResponse>;
267
323
  /**
268
324
  * 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.
269
325
  * @param vehicle_name New name
@@ -309,7 +365,7 @@ export default class VehicleSpecific {
309
365
  * @param lat Latitude
310
366
  * @param lon Longitude
311
367
  */
312
- trigger_homelink(lat: number, lon: number, token?: string): Promise<CommandResponse>;
368
+ trigger_homelink(token?: string, lat?: number, lon?: number): Promise<CommandResponse>;
313
369
  /**
314
370
  * Upcoming calendar entries stored on the vehicle.
315
371
  * @param calendar_data Calendar data
@@ -321,16 +377,16 @@ export default class VehicleSpecific {
321
377
  * @param lat Latitude
322
378
  * @param lon Longitude
323
379
  */
324
- window_control(command: "vent" | "close", lat: number, lon: number): Promise<CommandResponse>;
380
+ window_control(command: "vent" | "close", lat?: number, lon?: number): Promise<CommandResponse>;
325
381
  /**
326
382
  * Returns all allowed drivers for a vehicle. This endpoint is only available for the vehicle owner.
327
383
  */
328
- drivers(): Promise<Record<string, any>>;
384
+ drivers(): Promise<ResponseEnvelope<Record<string, any>[]>>;
329
385
  /**
330
386
  * Removes driver access from a vehicle. Share users can only remove their own access. Owners can remove share access or their own.
331
387
  * @param share_user_id
332
388
  */
333
- drivers_remove(share_user_id?: number): Promise<Record<string, any>>;
389
+ drivers_remove(share_user_id?: string | number): Promise<Record<string, any>>;
334
390
  /**
335
391
  * Returns eligible vehicle subscriptions.
336
392
  * @param vin Vehicle Identification Number
@@ -352,7 +408,13 @@ export default class VehicleSpecific {
352
408
  * @param config A dictionary description the fleet telemetry configuration
353
409
  * @returns
354
410
  */
355
- fleet_telemetry_config(config: FleetTelemetryConfig["config"]): Promise<Record<string, any>>;
411
+ fleet_telemetry_config_create(config: FleetTelemetryConfig["config"]): Promise<Record<string, any>>;
412
+ /**
413
+ * Configures fleet telemetry with a Tesla.SS256-signed JWS token, signed by the partner's registered command key.
414
+ * @param vins Vehicle Identification Numbers to configure
415
+ * @param token JWS token wrapping the fleet telemetry configuration
416
+ */
417
+ fleet_telemetry_config_jws(vins: string[], token: string): Promise<Record<string, any>>;
356
418
  /**
357
419
  * Disconnects vehicles to stream telemetry data to self hosted fleet-telemetry server.
358
420
  * @returns
@@ -414,16 +476,18 @@ export default class VehicleSpecific {
414
476
  /**
415
477
  * Returns information about a vehicle.
416
478
  */
417
- vehicle(): Promise<VehicleResponse>;
479
+ vehicle(): Promise<ResponseEnvelope<VehicleResponse>>;
418
480
  /**
419
481
  * Makes a live call to the vehicle. This may return cached data if the vehicle is offline. For vehicles running firmware versions 2023.38+, location_data is required to fetch vehicle location. This will result in a location sharing icon to show on the vehicle UI.
420
482
  * @param endpoints
421
483
  */
422
- vehicle_data(endpoints?: VehicleDataEndpoint[] | string): Promise<VehicleDataResponse>;
484
+ vehicle_data(endpoints?: VehicleDataEndpoint[] | string): Promise<ResponseEnvelope<VehicleDataResponse>>;
423
485
  /**
424
486
  * Wakes the vehicle from sleep, which is a state to minimize idle energy consumption.
487
+ * @param options.wait Poll `vehicle()` until the vehicle reports `online`, raising `VehicleOffline` at the deadline
488
+ * @param options.timeoutMs Deadline for `wait`, in milliseconds (default 60000)
425
489
  */
426
- wake_up(): Promise<Record<string, any>>;
490
+ wake_up(options?: WakeUpOptions): Promise<ResponseEnvelope<VehicleResponse>>;
427
491
  /**
428
492
  * Returns warranty details.
429
493
  * @param vin