tesla-fleet-api 0.3.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 (342) hide show
  1. package/README.md +284 -1
  2. package/dist/_virtual/_rolldown/runtime.cjs +32 -0
  3. package/dist/_virtual/_rolldown/runtime.mjs +12 -0
  4. package/dist/bluetooth/adapters/shared.cjs +38 -0
  5. package/dist/bluetooth/adapters/shared.mjs +36 -0
  6. package/dist/bluetooth/async.cjs +121 -0
  7. package/dist/bluetooth/async.d.cts +10 -0
  8. package/dist/bluetooth/async.d.mts +10 -0
  9. package/dist/bluetooth/async.mjs +116 -0
  10. package/dist/bluetooth/broadcast.cjs +153 -0
  11. package/dist/bluetooth/broadcast.d.cts +59 -0
  12. package/dist/bluetooth/broadcast.d.mts +59 -0
  13. package/dist/bluetooth/broadcast.mjs +151 -0
  14. package/dist/bluetooth/constants.cjs +99 -0
  15. package/dist/bluetooth/constants.d.cts +70 -0
  16. package/dist/bluetooth/constants.d.mts +70 -0
  17. package/dist/bluetooth/constants.mjs +72 -0
  18. package/dist/bluetooth/esphome.cjs +292 -0
  19. package/dist/bluetooth/esphome.d.cts +83 -0
  20. package/dist/bluetooth/esphome.d.mts +83 -0
  21. package/dist/bluetooth/esphome.mjs +291 -0
  22. package/dist/bluetooth/framing.cjs +125 -0
  23. package/dist/bluetooth/framing.d.cts +45 -0
  24. package/dist/bluetooth/framing.d.mts +45 -0
  25. package/dist/bluetooth/framing.mjs +122 -0
  26. package/dist/bluetooth/homey.cjs +155 -0
  27. package/dist/bluetooth/homey.d.cts +75 -0
  28. package/dist/bluetooth/homey.d.mts +75 -0
  29. package/dist/bluetooth/homey.mjs +150 -0
  30. package/dist/bluetooth/names.cjs +24 -0
  31. package/dist/bluetooth/names.d.cts +10 -0
  32. package/dist/bluetooth/names.d.mts +10 -0
  33. package/dist/bluetooth/names.mjs +20 -0
  34. package/dist/bluetooth/noble.cjs +178 -0
  35. package/dist/bluetooth/noble.d.cts +58 -0
  36. package/dist/bluetooth/noble.d.mts +58 -0
  37. package/dist/bluetooth/noble.mjs +177 -0
  38. package/dist/bluetooth/streamglue.cjs +157 -0
  39. package/dist/bluetooth/streamglue.d.cts +37 -0
  40. package/dist/bluetooth/streamglue.d.mts +37 -0
  41. package/dist/bluetooth/streamglue.mjs +154 -0
  42. package/dist/bluetooth/teslabluetooth.cjs +67 -0
  43. package/dist/bluetooth/teslabluetooth.d.cts +41 -0
  44. package/dist/bluetooth/teslabluetooth.d.mts +41 -0
  45. package/dist/bluetooth/teslabluetooth.mjs +66 -0
  46. package/dist/bluetooth/transport.cjs +10 -0
  47. package/dist/bluetooth/transport.d.cts +95 -0
  48. package/dist/bluetooth/transport.d.mts +95 -0
  49. package/dist/bluetooth/transport.mjs +10 -0
  50. package/dist/bluetooth/vehiclebluetooth.cjs +1272 -0
  51. package/dist/bluetooth/vehiclebluetooth.d.cts +495 -0
  52. package/dist/bluetooth/vehiclebluetooth.d.mts +495 -0
  53. package/dist/bluetooth/vehiclebluetooth.mjs +1270 -0
  54. package/dist/bluetooth/verify.cjs +93 -0
  55. package/dist/bluetooth/verify.d.cts +35 -0
  56. package/dist/bluetooth/verify.d.mts +35 -0
  57. package/dist/bluetooth/verify.mjs +91 -0
  58. package/dist/bluetooth.cjs +53 -0
  59. package/dist/bluetooth.d.cts +10 -0
  60. package/dist/bluetooth.d.mts +10 -0
  61. package/dist/bluetooth.mjs +9 -0
  62. package/dist/charging.cjs +53 -0
  63. package/dist/charging.d.cts +31 -0
  64. package/dist/charging.d.mts +30 -0
  65. package/dist/charging.mjs +53 -0
  66. package/dist/commands.cjs +1797 -0
  67. package/dist/commands.d.cts +881 -0
  68. package/dist/commands.d.mts +881 -0
  69. package/dist/commands.mjs +1791 -0
  70. package/dist/const.cjs +322 -0
  71. package/dist/const.d.cts +308 -0
  72. package/dist/const.d.mts +308 -0
  73. package/dist/const.mjs +282 -0
  74. package/dist/energy.cjs +142 -0
  75. package/dist/energy.d.cts +101 -0
  76. package/dist/energy.d.mts +100 -0
  77. package/dist/energy.mjs +142 -0
  78. package/dist/energyisland.cjs +38 -0
  79. package/dist/energyisland.mjs +37 -0
  80. package/dist/energyparsers.cjs +118 -0
  81. package/dist/energyparsers.d.cts +39 -0
  82. package/dist/energyparsers.d.mts +39 -0
  83. package/dist/energyparsers.mjs +116 -0
  84. package/dist/energyspecific.cjs +457 -0
  85. package/dist/energyspecific.d.cts +258 -0
  86. package/dist/energyspecific.d.mts +258 -0
  87. package/dist/energyspecific.mjs +451 -0
  88. package/dist/exceptions.cjs +1488 -0
  89. package/dist/exceptions.d.cts +1143 -0
  90. package/dist/exceptions.d.mts +1143 -0
  91. package/dist/exceptions.mjs +1325 -0
  92. package/dist/funnel.cjs +297 -0
  93. package/dist/funnel.d.cts +118 -0
  94. package/dist/funnel.d.mts +118 -0
  95. package/dist/funnel.mjs +292 -0
  96. package/dist/index.cjs +287 -0
  97. package/dist/index.d.cts +28 -0
  98. package/dist/index.d.mts +28 -0
  99. package/dist/index.mjs +27 -0
  100. package/dist/log.cjs +75 -0
  101. package/dist/log.d.cts +4 -0
  102. package/dist/log.d.mts +4 -0
  103. package/dist/log.mjs +71 -0
  104. package/dist/oauth.cjs +143 -0
  105. package/dist/oauth.d.cts +69 -0
  106. package/dist/oauth.d.mts +69 -0
  107. package/dist/oauth.mjs +143 -0
  108. package/dist/partner.cjs +32 -0
  109. package/dist/partner.d.cts +24 -0
  110. package/dist/partner.d.mts +23 -0
  111. package/dist/partner.mjs +32 -0
  112. package/dist/powerwall/client.cjs +818 -0
  113. package/dist/powerwall/client.d.cts +297 -0
  114. package/dist/powerwall/client.d.mts +297 -0
  115. package/dist/powerwall/client.mjs +807 -0
  116. package/dist/powerwall/components.cjs +188 -0
  117. package/dist/powerwall/components.d.cts +45 -0
  118. package/dist/powerwall/components.d.mts +45 -0
  119. package/dist/powerwall/components.mjs +182 -0
  120. package/dist/powerwall/energysite.cjs +216 -0
  121. package/dist/powerwall/energysite.d.cts +104 -0
  122. package/dist/powerwall/energysite.d.mts +104 -0
  123. package/dist/powerwall/energysite.mjs +214 -0
  124. package/dist/powerwall/exceptions.cjs +59 -0
  125. package/dist/powerwall/exceptions.d.cts +38 -0
  126. package/dist/powerwall/exceptions.d.mts +38 -0
  127. package/dist/powerwall/exceptions.mjs +51 -0
  128. package/dist/powerwall/gateway.cjs +102 -0
  129. package/dist/powerwall/gateway.d.cts +57 -0
  130. package/dist/powerwall/gateway.d.mts +57 -0
  131. package/dist/powerwall/gateway.mjs +101 -0
  132. package/dist/powerwall/merge.cjs +163 -0
  133. package/dist/powerwall/merge.d.cts +63 -0
  134. package/dist/powerwall/merge.d.mts +63 -0
  135. package/dist/powerwall/merge.mjs +159 -0
  136. package/dist/powerwall/models.d.cts +95 -0
  137. package/dist/powerwall/models.d.mts +95 -0
  138. package/dist/powerwall/queries.cjs +17 -0
  139. package/dist/powerwall/queries.mjs +10 -0
  140. package/dist/powerwall/transport.cjs +232 -0
  141. package/dist/powerwall/transport.mjs +227 -0
  142. package/dist/powerwall.cjs +47 -0
  143. package/dist/powerwall.d.cts +9 -0
  144. package/dist/powerwall.d.mts +9 -0
  145. package/dist/powerwall.mjs +8 -0
  146. package/dist/router/base.cjs +203 -0
  147. package/dist/router/base.d.cts +112 -0
  148. package/dist/router/base.d.mts +112 -0
  149. package/dist/router/base.mjs +200 -0
  150. package/dist/router/energysite.cjs +65 -0
  151. package/dist/router/energysite.d.cts +47 -0
  152. package/dist/router/energysite.d.mts +47 -0
  153. package/dist/router/energysite.mjs +60 -0
  154. package/dist/router.cjs +13 -0
  155. package/dist/router.d.cts +3 -0
  156. package/dist/router.d.mts +3 -0
  157. package/dist/router.mjs +3 -0
  158. package/dist/signing/crypto.cjs +59 -0
  159. package/dist/signing/crypto.mjs +52 -0
  160. package/dist/signing/energy.cjs +123 -0
  161. package/dist/signing/energy.d.cts +45 -0
  162. package/dist/signing/energy.d.mts +45 -0
  163. package/dist/signing/energy.mjs +120 -0
  164. package/dist/signing/jws.cjs +229 -0
  165. package/dist/signing/jws.d.cts +45 -0
  166. package/dist/signing/jws.d.mts +45 -0
  167. package/dist/signing/jws.mjs +211 -0
  168. package/dist/signing/keys.cjs +191 -0
  169. package/dist/signing/keys.d.cts +21 -0
  170. package/dist/signing/keys.d.mts +21 -0
  171. package/dist/signing/keys.mjs +182 -0
  172. package/dist/signing/session.cjs +186 -0
  173. package/dist/signing/session.d.cts +106 -0
  174. package/dist/signing/session.d.mts +106 -0
  175. package/dist/signing/session.mjs +184 -0
  176. package/dist/tariff.cjs +319 -0
  177. package/dist/tariff.d.cts +40 -0
  178. package/dist/tariff.d.mts +40 -0
  179. package/dist/tariff.mjs +317 -0
  180. package/dist/teslafleetapi.cjs +326 -0
  181. package/dist/teslafleetapi.d.cts +160 -0
  182. package/dist/teslafleetapi.d.mts +160 -0
  183. package/dist/teslafleetapi.mjs +326 -0
  184. package/dist/teslemetry.cjs +183 -0
  185. package/dist/teslemetry.d.cts +113 -0
  186. package/dist/teslemetry.d.mts +113 -0
  187. package/dist/teslemetry.mjs +181 -0
  188. package/dist/teslemetryenergy.cjs +287 -0
  189. package/dist/teslemetryenergy.d.cts +154 -0
  190. package/dist/teslemetryenergy.d.mts +154 -0
  191. package/dist/teslemetryenergy.mjs +282 -0
  192. package/dist/teslemetryvehicle.cjs +407 -0
  193. package/dist/teslemetryvehicle.d.cts +238 -0
  194. package/dist/teslemetryvehicle.d.mts +238 -0
  195. package/dist/teslemetryvehicle.mjs +405 -0
  196. package/dist/tessie.cjs +71 -0
  197. package/dist/tessie.d.cts +69 -0
  198. package/dist/tessie.d.mts +69 -0
  199. package/dist/tessie.mjs +71 -0
  200. package/dist/tessievehicle.cjs +514 -0
  201. package/dist/tessievehicle.d.cts +333 -0
  202. package/dist/tessievehicle.d.mts +333 -0
  203. package/dist/tessievehicle.mjs +513 -0
  204. package/dist/types/commands.d.cts +28 -0
  205. package/dist/types/commands.d.mts +28 -0
  206. package/dist/types/live_status.d.cts +30 -0
  207. package/dist/types/live_status.d.mts +30 -0
  208. package/dist/types/products.d.cts +58 -0
  209. package/dist/types/products.d.mts +58 -0
  210. package/dist/types/responses.d.cts +13 -0
  211. package/dist/types/responses.d.mts +13 -0
  212. package/dist/types/site_info.d.cts +154 -0
  213. package/dist/types/site_info.d.mts +154 -0
  214. package/dist/types/vehicle.d.cts +33 -0
  215. package/dist/types/vehicle.d.mts +33 -0
  216. package/dist/types/vehicle_data.d.cts +278 -0
  217. package/dist/types/vehicle_data.d.mts +278 -0
  218. package/dist/types.cjs +0 -0
  219. package/dist/types.d.cts +9 -0
  220. package/dist/types.d.mts +9 -0
  221. package/dist/types.mjs +1 -0
  222. package/dist/user.cjs +28 -0
  223. package/dist/user.d.cts +17 -0
  224. package/dist/user.d.mts +16 -0
  225. package/dist/user.mjs +28 -0
  226. package/dist/util.cjs +41 -0
  227. package/dist/util.d.cts +18 -0
  228. package/dist/util.d.mts +18 -0
  229. package/dist/util.mjs +40 -0
  230. package/dist/vehicle.cjs +847 -0
  231. package/dist/vehicle.d.cts +566 -0
  232. package/dist/vehicle.d.mts +565 -0
  233. package/dist/vehicle.mjs +847 -0
  234. package/dist/vehiclesigned.cjs +35 -0
  235. package/dist/vehiclesigned.d.cts +23 -0
  236. package/dist/vehiclesigned.d.mts +22 -0
  237. package/dist/vehiclesigned.mjs +35 -0
  238. package/dist/vehiclespecific.cjs +715 -0
  239. package/dist/vehiclespecific.d.cts +497 -0
  240. package/dist/vehiclespecific.d.mts +496 -0
  241. package/dist/vehiclespecific.mjs +715 -0
  242. package/package.json +178 -38
  243. package/dist/charging.d.ts +0 -30
  244. package/dist/charging.js +0 -51
  245. package/dist/charging.js.map +0 -1
  246. package/dist/commands.d.ts +0 -352
  247. package/dist/commands.js +0 -875
  248. package/dist/commands.js.map +0 -1
  249. package/dist/energy.d.ts +0 -94
  250. package/dist/energy.js +0 -125
  251. package/dist/energy.js.map +0 -1
  252. package/dist/energyspecific.d.ts +0 -77
  253. package/dist/energyspecific.js +0 -97
  254. package/dist/energyspecific.js.map +0 -1
  255. package/dist/helpers.d.ts +0 -2
  256. package/dist/helpers.js +0 -10
  257. package/dist/helpers.js.map +0 -1
  258. package/dist/index.d.ts +0 -15
  259. package/dist/index.js +0 -15
  260. package/dist/index.js.map +0 -1
  261. package/dist/partner.d.ts +0 -23
  262. package/dist/partner.js +0 -31
  263. package/dist/partner.js.map +0 -1
  264. package/dist/signing/crypto.d.ts +0 -10
  265. package/dist/signing/crypto.js +0 -26
  266. package/dist/signing/crypto.js.map +0 -1
  267. package/dist/signing/errors.d.ts +0 -29
  268. package/dist/signing/errors.js +0 -40
  269. package/dist/signing/errors.js.map +0 -1
  270. package/dist/signing/session.d.ts +0 -69
  271. package/dist/signing/session.js +0 -102
  272. package/dist/signing/session.js.map +0 -1
  273. package/dist/tariff.d.ts +0 -29
  274. package/dist/tariff.js +0 -302
  275. package/dist/tariff.js.map +0 -1
  276. package/dist/teslafleetapi.d.ts +0 -58
  277. package/dist/teslafleetapi.js +0 -120
  278. package/dist/teslafleetapi.js.map +0 -1
  279. package/dist/teslemetry.d.ts +0 -29
  280. package/dist/teslemetry.js +0 -39
  281. package/dist/teslemetry.js.map +0 -1
  282. package/dist/tessie.d.ts +0 -23
  283. package/dist/tessie.js +0 -28
  284. package/dist/tessie.js.map +0 -1
  285. package/dist/types/commands.d.ts +0 -44
  286. package/dist/types/commands.js +0 -11
  287. package/dist/types/commands.js.map +0 -1
  288. package/dist/types/live_status.d.ts +0 -26
  289. package/dist/types/live_status.js +0 -2
  290. package/dist/types/live_status.js.map +0 -1
  291. package/dist/types/products.d.ts +0 -54
  292. package/dist/types/products.js +0 -2
  293. package/dist/types/products.js.map +0 -1
  294. package/dist/types/responses.d.ts +0 -5
  295. package/dist/types/responses.js +0 -2
  296. package/dist/types/responses.js.map +0 -1
  297. package/dist/types/site_info.d.ts +0 -150
  298. package/dist/types/site_info.js +0 -2
  299. package/dist/types/site_info.js.map +0 -1
  300. package/dist/types/vehicle.d.ts +0 -23
  301. package/dist/types/vehicle.js +0 -10
  302. package/dist/types/vehicle.js.map +0 -1
  303. package/dist/types/vehicle_data.d.ts +0 -274
  304. package/dist/types/vehicle_data.js +0 -2
  305. package/dist/types/vehicle_data.js.map +0 -1
  306. package/dist/user.d.ts +0 -16
  307. package/dist/user.js +0 -26
  308. package/dist/user.js.map +0 -1
  309. package/dist/vehicle.d.ts +0 -548
  310. package/dist/vehicle.js +0 -774
  311. package/dist/vehicle.js.map +0 -1
  312. package/dist/vehiclesigned.d.ts +0 -13
  313. package/dist/vehiclesigned.js +0 -19
  314. package/dist/vehiclesigned.js.map +0 -1
  315. package/dist/vehiclespecific.d.ts +0 -432
  316. package/dist/vehiclespecific.js +0 -601
  317. package/dist/vehiclespecific.js.map +0 -1
  318. package/src/charging.ts +0 -66
  319. package/src/commands.ts +0 -1134
  320. package/src/energy.ts +0 -217
  321. package/src/energyspecific.ts +0 -116
  322. package/src/helpers.ts +0 -11
  323. package/src/index.ts +0 -21
  324. package/src/partner.ts +0 -37
  325. package/src/signing/crypto.ts +0 -29
  326. package/src/signing/errors.ts +0 -50
  327. package/src/signing/session.ts +0 -132
  328. package/src/tariff.ts +0 -375
  329. package/src/teslafleetapi.ts +0 -182
  330. package/src/teslemetry.ts +0 -54
  331. package/src/tessie.ts +0 -42
  332. package/src/types/commands.ts +0 -62
  333. package/src/types/live_status.ts +0 -27
  334. package/src/types/products.ts +0 -61
  335. package/src/types/responses.ts +0 -1
  336. package/src/types/site_info.ts +0 -159
  337. package/src/types/vehicle.ts +0 -33
  338. package/src/types/vehicle_data.ts +0 -286
  339. package/src/user.ts +0 -35
  340. package/src/vehicle.ts +0 -886
  341. package/src/vehiclesigned.ts +0 -20
  342. package/src/vehiclespecific.ts +0 -818
package/dist/vehicle.js DELETED
@@ -1,774 +0,0 @@
1
- import { ClimateModes, Seats } from "./types/commands.js";
2
- import { Models } from "./types/vehicle.js";
3
- import VehicleSpecific from "./vehiclespecific.js";
4
- import VehicleSigned from "./vehiclesigned.js";
5
- export default class Vehicle {
6
- constructor(parent) {
7
- this.parent = parent;
8
- }
9
- /**
10
- * Returns a class for a single vehicle.
11
- * @param vin
12
- * @returns
13
- */
14
- specific(vin) {
15
- return new VehicleSpecific(this, vin);
16
- }
17
- /**
18
- * Returns a class for a single vehicle that signs commands with the
19
- * Tesla Vehicle Command Protocol and dispatches them through the Fleet
20
- * API `/signed_command` endpoint, instead of the plaintext REST commands.
21
- * @param vin
22
- * @param private_key Raw 32-byte P-256 private key scalar. Falls back to `this.private_key`.
23
- * @param public_key Uncompressed P-256 public key point. Derived from `private_key` if omitted.
24
- */
25
- signed(vin, private_key, public_key) {
26
- return new VehicleSigned(this, vin, private_key, public_key);
27
- }
28
- /**
29
- * Return the vehicle model name
30
- * @param vin
31
- * @returns
32
- */
33
- model(vin) {
34
- return Models?.[vin[3]] || "Unknown";
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(vin) {
42
- return (vin[3] === "S" || vin[3] === "X") && vin[9] < "L";
43
- }
44
- // Vehicle Commands
45
- /**
46
- * Controls the front (which_trunk: "front") or rear (which_trunk: "rear") trunk.
47
- * @param vehicle_tag VIN or id field of a vehicle
48
- * @param which_trunk "front" or "rear"
49
- */
50
- async actuate_truck(vehicle_tag, which_trunk) {
51
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/actuate_trunk`, null, { which_trunk });
52
- }
53
- /**
54
- * Adjusts vehicle media playback volume.
55
- * @param vehicle_tag VIN or id field of a vehicle
56
- * @param volume A floating point number from 0.0 to 11.0.
57
- */
58
- async adjust_volume(vehicle_tag, volume) {
59
- if (volume < 0 || volume > 11) {
60
- throw new Error("Volume must a number from 0.0 to 11.0");
61
- }
62
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/adjust_volume`, null, { volume });
63
- }
64
- /**
65
- * Starts climate preconditioning.
66
- * @param vehicle_tag VIN or id field of a vehicle
67
- */
68
- async auto_conditioning_start(vehicle_tag) {
69
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/auto_conditioning_start`);
70
- }
71
- /**
72
- * Stops climate preconditioning.
73
- * @param vehicle_tag VIN or id field of a vehicle
74
- */
75
- async auto_conditioning_stop(vehicle_tag) {
76
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/auto_conditioning_stop`);
77
- }
78
- /**
79
- * Cancels the countdown to install the vehicle software update.
80
- * @param vehicle_tag VIN or id field of a vehicle
81
- */
82
- async cancel_software_update(vehicle_tag) {
83
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/cancel_software_update`);
84
- }
85
- /**
86
- * Charges in max range mode -- we recommend limiting the use of this mode to long trips.
87
- * @param vehicle_tag VIN or id field of a vehicle
88
- */
89
- async charge_max_range(vehicle_tag) {
90
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/charge_max_range`);
91
- }
92
- /**
93
- * Closes the charge port door.
94
- * @param vehicle_tag VIN or id field of a vehicle
95
- */
96
- async charge_port_door_close(vehicle_tag) {
97
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/charge_port_door_close`);
98
- }
99
- /**
100
- * Opens the charge port door.
101
- * @param vehicle_tag VIN or id field of a vehicle
102
- */
103
- async charge_port_door_open(vehicle_tag) {
104
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/charge_port_door_open`);
105
- }
106
- /**
107
- * Charges in Standard mode.
108
- * @param vehicle_tag VIN or id field of a vehicle
109
- */
110
- async charge_standard(vehicle_tag) {
111
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/charge_standard`);
112
- }
113
- /**
114
- * Starts charging the vehicle.
115
- * @param vehicle_tag VIN or id field of a vehicle
116
- */
117
- async charge_start(vehicle_tag) {
118
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/charge_start`);
119
- }
120
- /**
121
- * Stops charging the vehicle.
122
- * @param vehicle_tag VIN or id field of a vehicle
123
- */
124
- async charge_stop(vehicle_tag) {
125
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/charge_stop`);
126
- }
127
- /**
128
- * 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.
129
- * @param vehicle_tag VIN or id field of a vehicle
130
- */
131
- async clear_pin_to_drive_admin(vehicle_tag) {
132
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/clear_pin_to_drive_admin`);
133
- }
134
- /**
135
- * Locks the vehicle.
136
- * @param vehicle_tag VIN or id field of a vehicle
137
- */
138
- async door_lock(vehicle_tag) {
139
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/door_lock`);
140
- }
141
- /**
142
- * Unlocks the vehicle.
143
- * @param vehicle_tag VIN or id field of a vehicle
144
- */
145
- async door_unlock(vehicle_tag) {
146
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/door_unlock`);
147
- }
148
- /**
149
- * Erases user's data from the user interface. Requires the vehicle to be in park.
150
- * @param vehicle_tag VIN or id field of a vehicle
151
- */
152
- async erase_user_data(vehicle_tag) {
153
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/erase_user_data`);
154
- }
155
- /**
156
- * Briefly flashes the vehicle headlights. Requires the vehicle to be in park.
157
- * @param vehicle_tag VIN or id field of a vehicle
158
- */
159
- async flash_lights(vehicle_tag) {
160
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/flash_lights`);
161
- }
162
- /**
163
- * Restricts certain vehicle UI functionality from guest users
164
- * @param vehicle_tag VIN or id field of a vehicle
165
- * @param enable `true` or `false`
166
- */
167
- async guest_mode(vehicle_tag, enable) {
168
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/guest_mode`, null, { enable });
169
- }
170
- /**
171
- * Honks the vehicle horn. Requires the vehicle to be in park.
172
- * @param vehicle_tag VIN or id field of a vehicle
173
- */
174
- async honk_horn(vehicle_tag) {
175
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/honk_horn`);
176
- }
177
- /**
178
- * Advances media player to next favorite track.
179
- * @param vehicle_tag VIN or id field of a vehicle
180
- */
181
- async media_next_fav(vehicle_tag) {
182
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/media_next_fav`);
183
- }
184
- /**
185
- * Advances media player to next track.
186
- * @param vehicle_tag VIN or id field of a vehicle
187
- */
188
- async media_next_track(vehicle_tag) {
189
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/media_next_track`);
190
- }
191
- /**
192
- * Advances media player to previous favorite track.
193
- * @param vehicle_tag VIN or id field of a vehicle
194
- */
195
- async media_prev_fav(vehicle_tag) {
196
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/media_prev_fav`);
197
- }
198
- /**
199
- * Advances media player to previous track.
200
- * @param vehicle_tag VIN or id field of a vehicle
201
- */
202
- async media_prev_track(vehicle_tag) {
203
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/media_prev_track`);
204
- }
205
- /**
206
- * Toggles current play/pause state.
207
- * @param vehicle_tag VIN or id field of a vehicle
208
- */
209
- async media_toggle_playback(vehicle_tag) {
210
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/media_toggle_playback`);
211
- }
212
- /**
213
- * Turns the volume down by one.
214
- * @param vehicle_tag VIN or id field of a vehicle
215
- */
216
- async media_volume_down(vehicle_tag) {
217
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/media_volume_down`);
218
- }
219
- /**
220
- * Start navigation to given coordinates. Order can be used to specify order of multiple stops.
221
- * @param vehicle_tag VIN or id field of a vehicle
222
- * @param lat Latitude
223
- * @param lon Longitude
224
- * @param order Order of multiple stops
225
- */
226
- async navigation_gps_request(vehicle_tag, lat, lon, order) {
227
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/navigation_gps_request`, null, { lat, lon, order });
228
- }
229
- /**
230
- * Sends a location to the in-vehicle navigation system.
231
- * @param vehicle_tag VIN or id field of a vehicle
232
- * @param type "share_ext_content_raw"
233
- * @param locale ISO locale such as "en-US"
234
- * @param timestamp_ms
235
- */
236
- async navigation_request(vehicle_tag, value, locale, type = "share_ext_content_raw") {
237
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/navigation_request`, null, {
238
- type,
239
- locale,
240
- timestamp_ms: String(Date.now()),
241
- value: {
242
- "android.intent.extra.TEXT": value,
243
- },
244
- });
245
- }
246
- /**
247
- * Start navigation to a supercharger.
248
- * @param vehicle_tag VIN or id field of a vehicle
249
- * @param id Supercharger ID
250
- * @param order Order of multiple stops
251
- * @returns
252
- */
253
- async navigation_sc_request(vehicle_tag, id, order) {
254
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/navigation_sc_request`, null, { id, order });
255
- }
256
- /**
257
- * Sets automatic seat heating and cooling.
258
- * @param vehicle_tag VIN or id field of a vehicle
259
- * @param auto_seat_position Seat position
260
- * @param auto_climate_on `true` or `false`
261
- */
262
- async remote_auto_seat_climate_request(vehicle_tag, auto_seat_position, auto_climate_on) {
263
- if (typeof auto_seat_position === "string") {
264
- auto_seat_position = Seats[auto_seat_position];
265
- }
266
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_auto_seat_climate_request`, null, {
267
- auto_seat_position,
268
- auto_climate_on,
269
- });
270
- }
271
- /**
272
- * Sets automatic steering wheel heating on/off.
273
- * @param vehicle_tag VIN or id field of a vehicle
274
- * @param on `true` or `false`
275
- */
276
- async remote_auto_steering_wheel_heat_climate_request(vehicle_tag, on) {
277
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_auto_steering_wheel_heat_climate_request`, null, { on });
278
- }
279
- /**
280
- * Plays a sound through the vehicle external speaker.
281
- * @param vehicle_tag VIN or id field of a vehicle
282
- * @param sound Fart is `0`, Locate ping is `2000`
283
- */
284
- async remote_boombox(vehicle_tag, sound = 0) {
285
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_boombox`, null, { sound });
286
- }
287
- /**
288
- * Sets seat cooling.
289
- * @param vehicle_tag VIN or id field of a vehicle
290
- * @param seat_position Seat position
291
- * @param seat_cooler_level Cooling level
292
- */
293
- async remote_seat_cooler_request(vehicle_tag, seat_position, seat_cooler_level) {
294
- if (typeof seat_position === "string") {
295
- seat_position = Seats[seat_position];
296
- }
297
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_seat_cooler_request`, null, {
298
- seat_position,
299
- seat_cooler_level,
300
- });
301
- }
302
- /**
303
- * Sets seat heating.
304
- * @param vehicle_tag VIN or id field of a vehicle
305
- * @param seat_position Seat position
306
- * @param seat_heater_level Heating level
307
- */
308
- async remote_seat_heater_request(vehicle_tag, seat_position, seat_heater_level) {
309
- if (typeof seat_position === "string") {
310
- seat_position = Seats[seat_position];
311
- }
312
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_seat_heater_request`, null, {
313
- seat_position,
314
- seat_heater_level,
315
- });
316
- }
317
- /**
318
- * Starts the vehicle remotely. Requires keyless driving to be enabled.
319
- * @param vehicle_tag VIN or id field of a vehicle
320
- */
321
- async remote_start_drive(vehicle_tag) {
322
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_start_drive`);
323
- }
324
- /**
325
- * Sets steering wheel heat level.
326
- * @param vehicle_tag VIN or id field of a vehicle
327
- * @param level Heating level
328
- */
329
- async remote_steering_wheel_heat_level_request(vehicle_tag, level) {
330
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_steering_wheel_heat_level_request`, null, { level });
331
- }
332
- /**
333
- * Sets steering wheel heating on/off. For vehicles that do not support auto steering wheel heat.
334
- * @param vehicle_tag VIN or id field of a vehicle
335
- * @param on `true` or `false`
336
- */
337
- async remote_steering_wheel_heater_request(vehicle_tag, on) {
338
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/remote_steering_wheel_heater_request`, null, { on });
339
- }
340
- /**
341
- * 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.
342
- * @param vehicle_tag VIN or id field of a vehicle
343
- */
344
- async reset_pin_to_drive_pin(vehicle_tag) {
345
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/reset_pin_to_drive_pin`);
346
- }
347
- /**
348
- * Removes PIN for Valet Mode.
349
- * @param vehicle_tag VIN or id field of a vehicle
350
- */
351
- async reset_valet_pin(vehicle_tag) {
352
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/reset_valet_pin`);
353
- }
354
- /**
355
- * Schedules a vehicle software update (over the air "OTA") to be installed in the future.
356
- * @param vehicle_tag VIN or id field of a vehicle
357
- * @param offset_sec Offset in seconds
358
- */
359
- async schedule_software_update(vehicle_tag, offset_sec) {
360
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/schedule_software_update`, null, { offset_sec });
361
- }
362
- /**
363
- * Turns Bioweapon Defense Mode on and off.
364
- * @param vehicle_tag VIN or id field of a vehicle
365
- * @param on `true` or `false`
366
- * @param manual_override `true` or `false`
367
- */
368
- async set_bioweapon_mode(vehicle_tag, on, manual_override) {
369
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_bioweapon_mode`, null, { on, manual_override });
370
- }
371
- /**
372
- * Sets the vehicle overheat protection.
373
- * @param vehicle_tag VIN or id field of a vehicle
374
- * @param on `true` or `false`
375
- * @param fan_only `true` or `false`
376
- */
377
- async set_cabin_overheat_protection(vehicle_tag, on, fan_only) {
378
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_cabin_overheat_protection`, null, { on, fan_only });
379
- }
380
- /**
381
- * Sets the vehicle's charge limit to a custom percentage.
382
- * @param vehicle_tag VIN or id field of a vehicle
383
- * @param percent Charge limit percentage typically between 50-100
384
- */
385
- async set_charge_limit(vehicle_tag, percent) {
386
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_charge_limit`, null, { percent });
387
- }
388
- /**
389
- * Sets the charge limit to the standard setting.
390
- * @param vehicle_tag VIN or id field of a vehicle
391
- * @param percent Current limit in Amps typically between 5-32
392
- */
393
- async set_charging_amps(vehicle_tag, charging_amps) {
394
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_charging_amps`, null, { charging_amps });
395
- }
396
- /**
397
- * Enables climate keeper mode.
398
- * @param vehicle_tag VIN or id field of a vehicle
399
- * @param climate_keeper_mode `0` is Off, `1` is Keep, `2` is Dog, `3` is Camp
400
- */
401
- async set_climate_keeper_mode(vehicle_tag, climate_keeper_mode) {
402
- if (typeof climate_keeper_mode === "string") {
403
- climate_keeper_mode = ClimateModes[climate_keeper_mode];
404
- }
405
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_climate_keeper_mode`, null, { climate_keeper_mode });
406
- }
407
- /**
408
- * Adjusts the Cabin Overheat Protection temperature (COP).
409
- * @param vehicle_tag VIN or id field of a vehicle
410
- * @param cop_temp Integer representing Low (0/30C/90F), Medium (1/35C/95F), or High (2/40C/100F)
411
- */
412
- async set_cop_temp(vehicle_tag, cop_temp) {
413
- if (cop_temp >= 90) {
414
- cop_temp = (cop_temp - 90) / 5;
415
- }
416
- else if (cop_temp >= 30) {
417
- cop_temp = (cop_temp - 30) / 5;
418
- }
419
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_cop_temp`, null, { cop_temp });
420
- }
421
- /**
422
- * Sets a four-digit passcode for PIN to Drive. This PIN must then be entered before the vehicle can be driven.
423
- * @param vehicle_tag VIN or id field of a vehicle
424
- * @param on `true` or `false`
425
- * @param password Four-digit passcode
426
- */
427
- async set_pin_to_drive(vehicle_tag, on, password) {
428
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_pin_to_drive`, null, { on, password: String(password) });
429
- }
430
- /**
431
- * Sets an override for preconditioning — it should default to empty if no override is used.
432
- * Also known as "Defrost Mode"
433
- * @param vehicle_tag VIN or id field of a vehicle
434
- * @param on `true` or `false`
435
- * @param manual_override `true` or `false`
436
- */
437
- async set_preconditioning_max(vehicle_tag, on, manual_override) {
438
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_preconditioning_max`, null, { on, manual_override });
439
- }
440
- /**
441
- * Sets a time at which charging should be completed. The time parameter is minutes after midnight (e.g: time=120 schedules charging for 2:00am vehicle local time).
442
- * @param vehicle_tag VIN or id field of a vehicle
443
- * @param enable `true` or `false`
444
- * @param time Minutes after midnight
445
- */
446
- async set_scheduled_charging(vehicle_tag, enable, time) {
447
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_scheduled_charging`, null, { enable, time });
448
- }
449
- /**
450
- * Sets a time at which departure should be completed. The time parameter is minutes after midnight (e.g: time=120 schedules departure for 2:00am vehicle local time).
451
- * @param vehicle_tag VIN or id field of a vehicle
452
- * @param enable `true` or `false`
453
- * @param preconditioning_enabled `true` or `false`
454
- * @param preconditioning_weekdays_only `true` or `false`
455
- * @param departure_time Minutes after midnight
456
- * @param off_peak_charging_enabled `true` or `false`
457
- * @param off_peak_charging_weekdays_only `true` or `false`
458
- * @param end_off_peak_time Minutes after midnight
459
- */
460
- async set_scheduled_departure(vehicle_tag, enable = true, preconditioning_enabled = false, preconditioning_weekdays_only = false, departure_time = 0, off_peak_charging_enabled = false, off_peak_charging_weekdays_only = false, end_off_peak_time = 0) {
461
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_scheduled_departure`, null, {
462
- enable,
463
- preconditioning_enabled,
464
- preconditioning_weekdays_only,
465
- departure_time,
466
- off_peak_charging_enabled,
467
- off_peak_charging_weekdays_only,
468
- end_off_peak_time,
469
- });
470
- }
471
- /**
472
- * 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.
473
- * @param vehicle_tag VIN or id field of a vehicle
474
- * @param on `true` or `false`
475
- */
476
- async set_sentry_mode(vehicle_tag, on) {
477
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_sentry_mode`, null, { on });
478
- }
479
- /**
480
- * Sets the driver and/or passenger-side cabin temperature (and other zones if sync is enabled).
481
- * @param vehicle_tag VIN or id field of a vehicle
482
- * @param driver_temp Driver temperature
483
- * @param passenger_temp Passenger temperature
484
- */
485
- async set_temps(vehicle_tag, driver_temp, passenger_temp) {
486
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_temps`, null, { driver_temp, passenger_temp });
487
- }
488
- /**
489
- * Turns on Valet Mode and sets a four-digit passcode that must then be entered to disable Valet Mode.
490
- * @param vehicle_tag VIN or id field of a vehicle
491
- * @param on `true` or `false`
492
- * @param password Four-digit passcode
493
- */
494
- async set_valet_mode(vehicle_tag, on, password) {
495
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_valet_mode`, null, { on, password: String(password) });
496
- }
497
- /**
498
- * 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.
499
- * @param vehicle_tag VIN or id field of a vehicle
500
- * @param vehicle_name New name
501
- */
502
- async set_vehicle_name(vehicle_tag, vehicle_name) {
503
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/set_vehicle_name`, null, { vehicle_name });
504
- }
505
- /**
506
- * Activates Speed Limit Mode with a four-digit PIN.
507
- * @param vehicle_tag VIN or id field of a vehicle
508
- * @param pin Four-digit PIN
509
- */
510
- async speed_limit_activate(vehicle_tag, pin) {
511
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/speed_limit_activate`, null, { pin: String(pin) });
512
- }
513
- /**
514
- * Deactivates Speed Limit Mode and resets the associated PIN.
515
- * @param vehicle_tag VIN or id field of a vehicle
516
- * @param pin Four-digit PIN
517
- */
518
- async speed_limit_clear_pin(vehicle_tag, pin) {
519
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/speed_limit_clear_pin`, null, { pin: String(pin) });
520
- }
521
- /**
522
- * 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.
523
- * @param vehicle_tag VIN or id field of a vehicle
524
- */
525
- async speed_limit_clear_pin_admin(vehicle_tag) {
526
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/speed_limit_clear_pin_admin`);
527
- }
528
- /**
529
- * Deactivates Speed Limit Mode.
530
- * @param vehicle_tag VIN or id field of a vehicle
531
- * @param pin Four-digit PIN
532
- */
533
- async speed_limit_deactivate(vehicle_tag, pin) {
534
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/speed_limit_deactivate`, null, { pin: String(pin) });
535
- }
536
- /**
537
- * Sets the maximum speed allowed when Speed Limit Mode is active.
538
- * @param vehicle_tag VIN or id field of a vehicle
539
- * @param limit_mph Maximum speed in MPH
540
- */
541
- async speed_limit_set_limit(vehicle_tag, limit_mph) {
542
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/speed_limit_set_limit`, null, { limit_mph });
543
- }
544
- /**
545
- * Controls the panoramic sunroof on the Model S.
546
- * @param vehicle_tag VIN or id field of a vehicle
547
- * @param state "stop", "close" or "vent"
548
- */
549
- async sun_roof_control(vehicle_tag, state) {
550
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/sun_roof_control`, null, { state });
551
- }
552
- /**
553
- * Records a drive note. The note parameter is truncated to 80 characters in length.
554
- * @param vehicle_tag VIN or id field of a vehicle
555
- * @param note Drive note
556
- */
557
- async take_drivenote(vehicle_tag, note) {
558
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/take_drivenote`, null, { note });
559
- }
560
- /**
561
- * Turns on HomeLink (used to open and close garage doors).
562
- * @param vehicle_tag VIN or id field of a vehicle
563
- * @param token
564
- * @param lat Latitude
565
- * @param lon Longitude
566
- */
567
- async trigger_homelink(vehicle_tag, lat, lon, token) {
568
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/trigger_homelink`, null, { token, lat, lon });
569
- }
570
- /**
571
- * Upcoming calendar entries stored on the vehicle.
572
- * @param vehicle_tag VIN or id field of a vehicle
573
- * @param calendar_data Calendar data
574
- */
575
- async upcoming_calendar_entries(vehicle_tag, calendar_data) {
576
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/upcoming_calendar_entries`, null, { calendar_data });
577
- }
578
- /**
579
- * Control the windows of a parked vehicle. Supported commands: vent and close. When closing, specify lat and lon of user to ensure they are within range of vehicle (unless this is an M3 platform vehicle).
580
- * @param vehicle_tag VIN or id field of a vehicle
581
- * @param command "vent" or "close"
582
- * @param lat Latitude
583
- * @param lon Longitude
584
- */
585
- async window_control(vehicle_tag, command, lat, lon) {
586
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/command/window_control`, null, { command, lat, lon });
587
- }
588
- // Vehicle Endpoints
589
- /**
590
- * Returns all allowed drivers for a vehicle. This endpoint is only available for the vehicle owner.
591
- * @param vehicle_tag VIN or id field of a vehicle
592
- */
593
- async drivers(vehicle_tag) {
594
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/drivers`).then(({ response }) => response);
595
- }
596
- /**
597
- * Removes driver access from a vehicle. Share users can only remove their own access. Owners can remove share access or their own.
598
- * @param vehicle_tag VIN or id field of a vehicle
599
- * @param share_user_id
600
- */
601
- async drivers_remove(vehicle_tag, share_user_id) {
602
- return this.parent._request("DELETE", `api/1/vehicles/${vehicle_tag}/drivers`, null, { share_user_id });
603
- }
604
- /**
605
- * Returns eligible vehicle subscriptions.
606
- * @param vin Vehicle Identification Number
607
- */
608
- async eligible_subscriptions(vin) {
609
- return this.parent._request("GET", "/api/1/dx/vehicles/subscriptions/eligibility", { vin });
610
- }
611
- /**
612
- * Returns eligibile vehicle upgrades.
613
- * @param vin Vehicle Identification Number
614
- */
615
- async eligible_upgrades(vin) {
616
- return this.parent._request("GET", "/api/1/dx/vehicles/upgrades/eligibility", { vin });
617
- }
618
- /**
619
- * Checks whether vehicles can accept Tesla commands protocol for the partner's public key
620
- * @param vins list of Vehicle Identification Number
621
- * @returns
622
- */
623
- async fleet_status(vins) {
624
- return this.parent._request("POST", "api/1/vehicles/fleet_status", null, { vins });
625
- }
626
- /**
627
- * Configures vehicles to connect to self-hosted fleet-telemetry server. This endpoint has concurrency 1 (status 429 will be returned if many calls are made at the same time). Multiple vehicles can be configured with a single call.
628
- * @param config A dictionary description the fleet telemetry configuration
629
- * @returns
630
- */
631
- async fleet_telemetry_config(config) {
632
- return this.parent._request("POST", "api/1/vehicles/fleet_telemetry_config", null, config);
633
- }
634
- /**
635
- * Disconnects vehicles to stream telemetry data to self hosted fleet-telemetry server.
636
- * @param vehicle_tag VIN or id field of a vehicle
637
- * @returns
638
- */
639
- async fleet_telemetry_config_delete(vehicle_tag) {
640
- return this.parent._request("DELETE", `api/1/vehicles/${vehicle_tag}/fleet_telemetry_config`);
641
- }
642
- /**
643
- * Fetches a vehicle's fleet telemetry config. synced set to true means the vehicle has adopted the target config. synced set to false means the vehicle will attempt to adopt the target config when it next establishes a backend connection.
644
- * @param vehicle_tag VIN or id field of a vehicle
645
- * @returns
646
- */
647
- async fleet_telemetry_config_get(vehicle_tag) {
648
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/fleet_telemetry_config`);
649
- }
650
- /**
651
- * Returns vehicles belonging to the account.
652
- * @param page Page number
653
- * @param per_page Number of items per page
654
- */
655
- async list(page, per_page) {
656
- return this.parent._request("GET", "api/1/vehicles", { page, per_page });
657
- }
658
- /**
659
- * Returns whether or not mobile access is enabled for the vehicle.
660
- * @param vehicle_tag VIN or id field of a vehicle
661
- */
662
- async mobile_enabled(vehicle_tag) {
663
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/mobile_enabled`);
664
- }
665
- /**
666
- * Returns the charging sites near the current location of the vehicle.
667
- * @param vehicle_tag VIN or id field of a vehicle
668
- * @param count
669
- * @param radius
670
- * @param detail
671
- */
672
- async nearby_charging_sites(vehicle_tag, count, radius, detail) {
673
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/nearby_charging_sites`, { count, radius, detail });
674
- }
675
- /**
676
- * Returns vehicle option details.
677
- * @param vin Vehicle Identification Number
678
- */
679
- async options(vin) {
680
- return this.parent._request("GET", "api/1/dx/vehicles/options", { vin }).then(({ codes }) => codes);
681
- }
682
- /**
683
- * List of recent alerts
684
- * @param vehicle_tag VIN or id field of a vehicle
685
- */
686
- async recent_alerts(vehicle_tag) {
687
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/recent_alerts`);
688
- }
689
- /**
690
- * Returns firmware release notes.
691
- * @param vehicle_tag VIN or id field of a vehicle
692
- * @param staged
693
- * @param language
694
- */
695
- async release_notes(vehicle_tag, staged, language) {
696
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/release_notes`, { staged, language });
697
- }
698
- /**
699
- * Returns service data.
700
- * @param vehicle_tag VIN or id field of a vehicle
701
- */
702
- async service_data(vehicle_tag) {
703
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/service_data`);
704
- }
705
- /**
706
- * Returns the share invites for a vehicle.
707
- * @param vehicle_tag VIN or id field of a vehicle
708
- */
709
- async share_invites(vehicle_tag) {
710
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/invitations`);
711
- }
712
- /**
713
- * Creates a share invite for a vehicle.
714
- * @param vehicle_tag VIN or id field of a vehicle
715
- */
716
- async share_invites_create(vehicle_tag) {
717
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/invitations`);
718
- }
719
- /**
720
- * Redeems a share invite.
721
- * @param code
722
- */
723
- async share_invites_redeem(code) {
724
- return this.parent._request("POST", "api/1/invitations/redeem", { code });
725
- }
726
- /**
727
- * Revokes a share invite.
728
- * @param vehicle_tag VIN or id field of a vehicle
729
- * @param id
730
- */
731
- async share_invites_revoke(vehicle_tag, id) {
732
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/invitations/${id}/revoke`);
733
- }
734
- /**
735
- * Signed Commands is a generic endpoint replacing legacy commands.
736
- * @param vehicle_tag VIN or id field of a vehicle
737
- * @param routable_message
738
- */
739
- async signed_command(vehicle_tag, routable_message) {
740
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/signed_command`, null, { routable_message });
741
- }
742
- /**
743
- * Returns information about a vehicle.
744
- * @param vehicle_tag VIN or id field of a vehicle
745
- */
746
- async vehicle(vehicle_tag) {
747
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}`).then(({ response }) => response);
748
- }
749
- /**
750
- * 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.
751
- * @param vehicle_tag VIN or id field of a vehicle
752
- * @param endpoints
753
- */
754
- async vehicle_data(vehicle_tag, endpoints) {
755
- if (typeof endpoints === "object")
756
- endpoints = endpoints.join(";");
757
- return this.parent._request("GET", `api/1/vehicles/${vehicle_tag}/vehicle_data`, { endpoints }).then(({ response }) => response);
758
- }
759
- /**
760
- * Wakes the vehicle from sleep, which is a state to minimize idle energy consumption.
761
- * @param vehicle_tag VIN or id field of a vehicle
762
- */
763
- async wake_up(vehicle_tag) {
764
- return this.parent._request("POST", `api/1/vehicles/${vehicle_tag}/wake_up`);
765
- }
766
- /**
767
- * Returns warranty details.
768
- * @param vin
769
- */
770
- async warranty_details(vin) {
771
- return this.parent._request("GET", "api/1/dx/warranty/details", { vin });
772
- }
773
- }
774
- //# sourceMappingURL=vehicle.js.map