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
@@ -0,0 +1,881 @@
1
+ import { CommandResponse } from "./types/commands.cjs";
2
+ import { AutoSeat, ClimateMode, DistanceUnit, EnergyDisplayFormat, Level, PhoneFontSize, Seat, TemperatureUnit, TimeDisplayFormat, TirePressureUnit, Trunk, VehicleImageType } from "./const.cjs";
3
+ import Vehicle from "./vehicle.cjs";
4
+ import VehicleSpecific from "./vehiclespecific.cjs";
5
+ import { Session } from "./signing/session.cjs";
6
+ import { Domain, RoutableMessage } from "@teslemetry/tesla-protocol/command/universal_message";
7
+ import { UnsignedMessage, VehicleStatus, WhitelistOperationInformationE } from "@teslemetry/tesla-protocol/command/vcsec";
8
+ import { Action, Response, SetRateTariffRequest_Seasons, SetRateTariffRequest_Tariff, VehicleAction } from "@teslemetry/tesla-protocol/command/car_server";
9
+ import { VehicleData } from "@teslemetry/tesla-protocol/command/vehicle";
10
+ /** A signed command's outcome, with any other `Response` payload under its field name. */
11
+ export interface SignedCommandResponse extends CommandResponse {
12
+ response: CommandResponse["response"] & Partial<Omit<Response, "actionStatus" | "vehicleData" | "ping">>;
13
+ }
14
+ /** Which field of a reply `_send` waits for: a command's payload, or a handshake's session info. */
15
+ export type SendRequires = "protobuf_message_as_bytes" | "session_info";
16
+ /**
17
+ * How `_send` waits for a reply. Each option only applies to a transport that
18
+ * frames its own replies: `VehicleSigned` ignores them all.
19
+ */
20
+ export interface SendOptions {
21
+ /** `false` for a VCSEC actuation, whose reply is one terminal ack with no data after it. Defaults to `true`. */
22
+ expectsData?: boolean;
23
+ /** The whole reply wait. Defaults to the transport's own timeout. */
24
+ timeoutMs?: number;
25
+ /** Return as soon as the message is written, without a reply. */
26
+ optimistic?: boolean;
27
+ /** Lets an unsolicited state broadcast confirm the command alongside the addressed ack. `undefined` means the status says nothing either way. */
28
+ confirmBroadcast?: (status: VehicleStatus) => boolean | undefined;
29
+ /**
30
+ * Called each time a frame may have reached the vehicle: its write completed,
31
+ * or failed after entering the backend. A failure before any such call sent nothing.
32
+ */
33
+ onSubmitted?: () => void;
34
+ /** Once aborted, nothing more is written: the send rejects with the signal's reason instead. */
35
+ signal?: AbortSignal;
36
+ }
37
+ /** What one signed dispatch resolves to: a command outcome, or the data a read asked for. */
38
+ export type SignedReply = SignedCommandResponse | {
39
+ response: VehicleData;
40
+ } | {
41
+ response: VehicleStatus;
42
+ };
43
+ /** A short debug-log name for a VCSEC command: the RKE action name, or the populated field. */
44
+ export declare function vcsec_command_name(command: UnsignedMessage): string;
45
+ /** A short debug-log name for an infotainment command: the populated `VehicleAction` field. */
46
+ export declare function infotainment_command_name(command: Action): string;
47
+ /**
48
+ * Day names Tesla's vehicle-command proxy accepts for `days_of_week`, which the
49
+ * REST route takes as a comma-joined string rather than the proto bitmask.
50
+ */
51
+ export declare const DAY_OF_WEEK_BITS: Readonly<Record<string, number>>;
52
+ /**
53
+ * Convert a bitmask or comma-joined day names (e.g. `"Mon,Wed"`, `"All"`) to the proto bitmask.
54
+ * @throws Error for an unknown day name.
55
+ */
56
+ export declare function days_of_week_mask(days_of_week: string | number): number;
57
+ /**
58
+ * Transport-agnostic signed-command builder for the Tesla Vehicle Command
59
+ * Protocol: mirrors `python-tesla-fleet-api`'s `Commands` ABC. Every method
60
+ * here builds a `RoutableMessage`, signs it by `authMethod`, and dispatches
61
+ * it through the single abstract seam `_send`. A concrete subclass fills that
62
+ * seam for one transport: the cloud `/signed_command` HTTP endpoint
63
+ * (`VehicleSigned`) today, a BLE GATT link next. The protected members are
64
+ * what such a transport builds on.
65
+ *
66
+ * `"hmac"` signs a plaintext command. `"aes"` encrypts it with AES-GCM and asks
67
+ * the vehicle to encrypt its reply, which firmware before 2024.38 ignores.
68
+ */
69
+ export default abstract class Commands extends VehicleSpecific {
70
+ #private;
71
+ /** Delay between WAIT-retries; overridable so tests don't have to wait for real timers. */
72
+ protected retryDelayMs: number;
73
+ /** Session-info requests sent before a handshake gives up on replies that fail authentication. */
74
+ protected handshakeAttempts: number;
75
+ /** Delay between those requests. */
76
+ protected handshakeRetryDelayMs: number;
77
+ /** How `buildMessage` signs a command. */
78
+ protected authMethod: "hmac" | "aes";
79
+ /** One random routing address per instance: replies addressed to it are ours. */
80
+ protected readonly fromDestination: Buffer;
81
+ private readonly sessions;
82
+ /** Transport identity for debug logging; set per concrete subclass. */
83
+ abstract readonly _transport_name: string;
84
+ /**
85
+ * @param parent
86
+ * @param vin
87
+ * @param privateKey Raw 32-byte P-256 scalar. `undefined` falls back to the parent's key, and throws if there is none. `false` disables signing, for a passive listener that never sends a command: any handshake then raises `SigningDisabled`.
88
+ * @param publicKey Uncompressed P-256 point. Derived from `privateKey` if omitted.
89
+ */
90
+ constructor(parent: Vehicle, vin: string, privateKey?: Buffer | false, publicKey?: Buffer);
91
+ /** The uncompressed public key this instance signs with. Empty when signing is disabled. */
92
+ protected get publicKey(): Buffer;
93
+ /** Derive the 16-byte shared key used for signed-command session encryption. */
94
+ shared_key(vehicleKey: Buffer): Buffer;
95
+ /** A Tesla.SS256 JWS over a Fleet Telemetry config, signed here so the key never leaves this class. */
96
+ protected signFleetTelemetryConfig(config: Readonly<Record<string, unknown>>): string;
97
+ /**
98
+ * Transmit a signed (or session-handshake) `RoutableMessage` to the
99
+ * vehicle and return its reply. Implementations must call
100
+ * `validate_msg(resp, msg.uuid, msg.toDestination?.domain)` on the reply before returning it, and
101
+ * must not take `Session.withLock`: `dispatch` already holds that lock
102
+ * across `_send` for VCSEC, and it is not reentrant.
103
+ */
104
+ protected abstract _send(msg: RoutableMessage, requires: SendRequires, options?: SendOptions): Promise<RoutableMessage>;
105
+ protected sessionFor(domain: Domain): Session;
106
+ /**
107
+ * Absorb session info piggy-backed on any signed-command reply and raise
108
+ * on a whitelist rejection or a terminal message fault. Every concrete
109
+ * `_send` must call this on the reply - passing the `uuid` and destination
110
+ * domain of the request it just sent - before returning it. The session comes
111
+ * from that request: a reply's own `fromDestination` is unauthenticated, so it
112
+ * can only be checked against the request, never select a session.
113
+ *
114
+ * A `SessionInfo` is untrusted wire data until its `session_info_tag` is
115
+ * verified: the tag is an HMAC over the exact bytes received, bound to this
116
+ * request's `uuid` as a challenge (so a captured older reply can't be
117
+ * replayed against a newer request). It is keyed by the session's stored
118
+ * key. Only at first contact, when there is none, is that key derived from
119
+ * the public key in the reply, which is trust on first use; see `Session`.
120
+ * Only once that tag checks out do we act on anything the message claims -
121
+ * including its own whitelist-status field - and even then `Session.commit`
122
+ * still refuses a clock time that regresses within the same epoch.
123
+ *
124
+ * The one exception is an empty public key: no shared key can be derived
125
+ * from it to verify a tag. An unpaired key has no session, so
126
+ * key-not-on-whitelist is the only real reply that omits the key, and that
127
+ * one status is accepted unauthenticated. Any other status with no key is
128
+ * malformed.
129
+ */
130
+ validate_msg(resp: RoutableMessage, requestUuid: Buffer, requestDomain: Domain | undefined): void;
131
+ /** The unsigned session-info request that opens a domain session. */
132
+ protected sessionInfoRequest(domain: Domain): RoutableMessage;
133
+ /**
134
+ * Open or refresh a domain session. A reply that fails authentication is
135
+ * discarded and the unsigned, idempotent request sent again, rather than
136
+ * failing the handshake on one bad reply. Never trusted either way.
137
+ *
138
+ * For VCSEC the caller must hold the session lock; `ensureHandshake` and
139
+ * `handshakeVehicleSecurity` do.
140
+ * @returns Whether the session can now sign.
141
+ * @throws SigningDisabled before anything is sent, when this instance has no key.
142
+ */
143
+ protected handshake(domain: Domain, options?: SendOptions): Promise<boolean>;
144
+ /**
145
+ * Open a domain session unless one is ready, for a subclass that must know
146
+ * it can sign before it dispatches. Do not call this from inside the VCSEC
147
+ * session lock, which it takes.
148
+ */
149
+ protected ensureHandshake(domain: Domain): Promise<void>;
150
+ /** Perform a handshake with the vehicle security domain, even if a session is already established. */
151
+ handshakeVehicleSecurity(): Promise<void>;
152
+ /** Perform a handshake with the infotainment domain, even if a session is already established. */
153
+ handshakeInfotainment(): Promise<void>;
154
+ /** Sign `command` for `session` by `authMethod`. Assigns a counter, so run it under the session lock. */
155
+ protected buildMessage(session: Session, command: Buffer): RoutableMessage;
156
+ private buildHmacMessage;
157
+ private buildAesMessage;
158
+ /** The authentication method of `request` followed by its tag, which a response's metadata binds to. */
159
+ private requestHash;
160
+ /**
161
+ * Open an encrypted reply to `request`. A reply with no `AESGCMResponseData`
162
+ * is plaintext and comes back as it is.
163
+ *
164
+ * A reply that fails to open cannot be trusted, and says nothing about
165
+ * whether the command ran.
166
+ * @returns The reply with its payload in the clear.
167
+ * @throws Error when the reply fails to open.
168
+ * @throws SignedCommandResponseReplayed when this request already saw this response counter.
169
+ */
170
+ protected decryptResponse(session: Session, request: RoutableMessage, resp: RoutableMessage): RoutableMessage;
171
+ /**
172
+ * Build, sign, dispatch (with WAIT/epoch-fault retry), and interpret one
173
+ * domain command.
174
+ *
175
+ * VCSEC requires messages to arrive in strict counter order and warns
176
+ * clients to avoid simultaneous requests to it at all (unlike
177
+ * Infotainment, which tolerates a sliding window) - so for
178
+ * `DOMAIN_VEHICLE_SECURITY` the *entire* dispatch (handshake, build,
179
+ * send, and any retry) runs under the domain's lock, guaranteeing at
180
+ * most one VCSEC message is ever in flight. Infotainment keeps the
181
+ * narrower build-only lock, serializing only counter assignment.
182
+ */
183
+ protected dispatch(domain: Domain, command: Buffer, options?: Omit<SendOptions, "optimistic">): Promise<SignedReply>;
184
+ private interpretResponse;
185
+ private interpretVcsecResponse;
186
+ protected raiseWhitelistFault(information: WhitelistOperationInformationE | undefined): void;
187
+ private interpretInfotainmentResponse;
188
+ /** Dispatch one signed command, logging its name, transport and outcome. */
189
+ private dispatchLogged;
190
+ /** The data a read asked for. A reply that only reports an outcome carries none. */
191
+ private readData;
192
+ /** One `getVehicleImageState` read, with the single image its reply must carry. */
193
+ private readVehicleImage;
194
+ /**
195
+ * Fetches a rendered vehicle image and returns its assembled bytes. Unlike
196
+ * any other read it is paged: an `ID` request reports the total size, then
197
+ * `DATA` requests advance by `chunk_size` until the whole range has arrived.
198
+ * @param image_type `VehicleImageType`
199
+ * @param chunk_size Bytes per request. A transport with a small frame needs a smaller value than the default.
200
+ * @throws Error when `chunk_size` is invalid, before anything is sent, or when the chunks do not add up to the reported size.
201
+ * @throws InvalidResponse when a reply carries no image.
202
+ */
203
+ vehicle_image_state(image_type: VehicleImageType | number, chunk_size?: number): Promise<Buffer>;
204
+ /** Sign and send an actuation: its reply is a bare terminal ack, so `expectsData` is false. */
205
+ protected sendVehicleSecurity(command: UnsignedMessage, options?: Pick<SendOptions, "confirmBroadcast" | "onSubmitted">): Promise<CommandResponse>;
206
+ /**
207
+ * Sign and send a read to the Vehicle Security computer.
208
+ * @throws InvalidResponse when the reply carries no `VehicleStatus`.
209
+ */
210
+ protected _getVehicleSecurity(command: UnsignedMessage): Promise<VehicleStatus>;
211
+ /**
212
+ * Sign and send a command to the Infotainment computer. Reads go through
213
+ * `_getInfotainment`. `mutating` is false for a command that cannot change
214
+ * the vehicle, so a transport can give up on it rather than ask whether it
215
+ * ran; `ping` is the only one. The cloud transport has no use for it.
216
+ */
217
+ protected sendInfotainment(action: Action, { onSubmitted }?: {
218
+ mutating?: boolean;
219
+ } & Pick<SendOptions, "onSubmitted">): Promise<SignedCommandResponse>;
220
+ /**
221
+ * Sign and send a read to the Infotainment computer.
222
+ * @throws InvalidResponse when the reply carries no `VehicleData`.
223
+ */
224
+ protected _getInfotainment(action: Action): Promise<VehicleData>;
225
+ protected vehicleAction(action: VehicleAction, options?: {
226
+ mutating?: boolean;
227
+ }): Promise<SignedCommandResponse>;
228
+ private moveTonneau;
229
+ private resolveSeat;
230
+ /** Pings the vehicle. On success, `reason` is the vehicle's timestamp in ISO 8601. */
231
+ ping(): Promise<CommandResponse>;
232
+ /**
233
+ * Add or modify a charging schedule. At least one of `start_time` or `end_time` is required.
234
+ * @param days_of_week Comma-joined day names (e.g. `"Mon,Wed"`, `"All"`, `"Weekdays"`) or a day bitmask
235
+ * @param enabled `true` or `false`
236
+ * @param lat Latitude of the schedule's location
237
+ * @param lon Longitude of the schedule's location
238
+ * @param start_time Minutes after midnight to start charging
239
+ * @param end_time Minutes after midnight to stop charging
240
+ * @param one_time Run the schedule only once
241
+ * @param id Schedule ID to modify an existing schedule
242
+ * @param name Schedule name
243
+ */
244
+ 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>;
245
+ /**
246
+ * Registers a managed charging site, for a utility managed-charging program, on this vehicle.
247
+ * @param public_key The raw EC point string the vehicle expects, not the DER a gateway's `get_signed_commands_public_key` returns
248
+ * @param din The gateway's DIN, which the vehicle matches to the site controller
249
+ * @param lat Latitude
250
+ * @param lon Longitude
251
+ */
252
+ add_managed_charging_site(public_key: string, din: string, lat: number, lon: number): Promise<SignedCommandResponse>;
253
+ /**
254
+ * Add or modify a preconditioning schedule.
255
+ * @param days_of_week Comma-joined day names (e.g. `"Mon,Wed"`, `"All"`, `"Weekdays"`) or a day bitmask
256
+ * @param enabled `true` or `false`
257
+ * @param lat Latitude of the schedule's location
258
+ * @param lon Longitude of the schedule's location
259
+ * @param precondition_time Minutes after midnight to be preconditioned by
260
+ * @param id Schedule ID to modify an existing schedule
261
+ * @param one_time Run the schedule only once
262
+ * @param name Schedule name
263
+ */
264
+ 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>;
265
+ /**
266
+ * Controls the front (which_trunk: "front") or rear (which_trunk: "rear") trunk.
267
+ * @param which_trunk "front" or "rear"
268
+ */
269
+ actuate_trunk(which_trunk: Trunk): Promise<CommandResponse>;
270
+ /**
271
+ * Adjusts vehicle media playback volume.
272
+ * @param volume A floating point number from 0.0 to 11.0.
273
+ */
274
+ adjust_volume(volume: number): Promise<CommandResponse>;
275
+ /** Starts climate preconditioning. */
276
+ auto_conditioning_start(): Promise<CommandResponse>;
277
+ /** Stops climate preconditioning. */
278
+ auto_conditioning_stop(): Promise<CommandResponse>;
279
+ /** Auto secures the vehicle: locks it and closes what it can. */
280
+ auto_secure_vehicle(): Promise<CommandResponse>;
281
+ /**
282
+ * Removes charging schedules by location type.
283
+ * @param home Remove schedules at home
284
+ * @param work Remove schedules at work
285
+ * @param other Remove schedules at other locations
286
+ */
287
+ batch_remove_charge_schedules(home: boolean, work: boolean, other: boolean): Promise<CommandResponse>;
288
+ /**
289
+ * Removes preconditioning schedules by location type.
290
+ * @param home Remove schedules at home
291
+ * @param work Remove schedules at work
292
+ * @param other Remove schedules at other locations
293
+ */
294
+ batch_remove_precondition_schedules(home: boolean, work: boolean, other: boolean): Promise<CommandResponse>;
295
+ /** Cancels the countdown to install the vehicle software update. */
296
+ cancel_software_update(): Promise<CommandResponse>;
297
+ /** Cancels a State of Health test. */
298
+ cancel_soh_test(): Promise<CommandResponse>;
299
+ /** Charges in max range mode -- we recommend limiting the use of this mode to long trips. */
300
+ charge_max_range(): Promise<CommandResponse>;
301
+ /** Closes the charge port door. */
302
+ charge_port_door_close(): Promise<CommandResponse>;
303
+ /** Opens the charge port door. */
304
+ charge_port_door_open(): Promise<CommandResponse>;
305
+ /** Charges in Standard mode. */
306
+ charge_standard(): Promise<CommandResponse>;
307
+ /** Starts charging the vehicle. */
308
+ charge_start(): Promise<CommandResponse>;
309
+ /** Stops charging the vehicle. */
310
+ charge_stop(): Promise<CommandResponse>;
311
+ /**
312
+ * 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.
313
+ * @param _pin Accepted for parity with the REST command; the signed action carries no PIN.
314
+ */
315
+ clear_pin_to_drive_admin(_pin?: string | number): Promise<CommandResponse>;
316
+ /** Closes the Cybertruck tonneau cover. */
317
+ close_tonneau(): Promise<CommandResponse>;
318
+ /** Saves a dashcam clip. */
319
+ dashcam_save_clip(): Promise<CommandResponse>;
320
+ /** Locks the vehicle. */
321
+ door_lock(): Promise<CommandResponse>;
322
+ /** Unlocks the vehicle. */
323
+ door_unlock(): Promise<CommandResponse>;
324
+ /** Erases user's data from the user interface. Requires the vehicle to be in park. */
325
+ erase_user_data(): Promise<CommandResponse>;
326
+ /** Briefly flashes the vehicle headlights. Requires the vehicle to be in park. */
327
+ flash_lights(): Promise<CommandResponse>;
328
+ /** Gets the charge on solar settings, under `response.getChargeOnSolarFeatureResponse`. */
329
+ get_charge_on_solar(): Promise<SignedCommandResponse>;
330
+ /** Gets the registered managed charging sites, under `response.getManagedChargingSitesResponse`. */
331
+ get_managed_charging_sites(): Promise<SignedCommandResponse>;
332
+ /** Gets vehicle in-car messages. The reply carries the vehicle's response under `getMessagesResponse`, if it sends one. */
333
+ get_messages(): Promise<SignedCommandResponse>;
334
+ /** Gets the current time-of-use rate tariff schedule, under `response.getRateTariffResponse`. */
335
+ get_rate_tariff(): Promise<SignedCommandResponse>;
336
+ /**
337
+ * Restricts certain vehicle UI functionality from guest users
338
+ * @param enable `true` or `false`
339
+ */
340
+ guest_mode(enable: boolean): Promise<CommandResponse>;
341
+ /** Honks the vehicle horn. Requires the vehicle to be in park. */
342
+ honk_horn(): Promise<CommandResponse>;
343
+ /** Advances media player to next favorite track. */
344
+ media_next_fav(): Promise<CommandResponse>;
345
+ /** Advances media player to next track. */
346
+ media_next_track(): Promise<CommandResponse>;
347
+ /** Advances media player to previous favorite track. */
348
+ media_prev_fav(): Promise<CommandResponse>;
349
+ /** Advances media player to previous track. */
350
+ media_prev_track(): Promise<CommandResponse>;
351
+ /** Toggles current play/pause state. */
352
+ media_toggle_playback(): Promise<CommandResponse>;
353
+ /** Turns the volume down by one. */
354
+ media_volume_down(): Promise<CommandResponse>;
355
+ /** Turns the volume up by one. */
356
+ media_volume_up(): Promise<CommandResponse>;
357
+ /**
358
+ * Start navigation to coordinates with a named destination.
359
+ * @param lat Latitude
360
+ * @param lon Longitude
361
+ * @param destination Destination name
362
+ * @param order Trip order: `0` replaces the current trip (default), `1` prepends it as the next stop, `2` appends it as the last stop
363
+ */
364
+ navigation_gps_destination_request(lat: number, lon: number, destination: string, order?: number): Promise<CommandResponse>;
365
+ /**
366
+ * Start navigation to given coordinates.
367
+ * @param lat Latitude
368
+ * @param lon Longitude
369
+ * @param order Trip order: `0` replaces the current trip (default), `1` prepends it as the next stop, `2` appends it as the last stop
370
+ */
371
+ navigation_gps_request(lat: number, lon: number, order?: number): Promise<CommandResponse>;
372
+ /**
373
+ * Sends a location to the in-vehicle navigation system.
374
+ *
375
+ * `type`, `locale` and `timestamp_ms` are REST-only fields with no equivalent
376
+ * in the signed-command protocol, which only carries a destination string
377
+ * and a multi-stop order. They keep REST's positions, so the router's types
378
+ * agree, and are not sent.
379
+ * @param value Destination text
380
+ */
381
+ navigation_request(value: string, _type?: string, _locale?: string | null, _timestamp_ms?: number | null): Promise<CommandResponse>;
382
+ /**
383
+ * Start navigation to a supercharger.
384
+ * @param id Supercharger ID
385
+ * @param order Trip order: `0` replaces the current trip (default), `1` prepends it as the next stop, `2` appends it as the last stop
386
+ */
387
+ navigation_sc_request(id: number, order?: number): Promise<CommandResponse>;
388
+ /** Triggers vehicle route navigation. */
389
+ navigation_route(): Promise<CommandResponse>;
390
+ /**
391
+ * Sends a list of waypoints to the vehicle's navigation system.
392
+ * @param waypoints Comma-separated Google Maps place IDs, e.g. `"refId:ChIJ...,refId:ChIJ..."`
393
+ */
394
+ navigation_waypoints_request(waypoints: string): Promise<CommandResponse>;
395
+ /** Opens the Cybertruck tonneau cover. */
396
+ open_tonneau(): Promise<CommandResponse>;
397
+ /**
398
+ * Returns the charging sites near the current location of the vehicle.
399
+ * The sites are under `response.getNearbyChargingSites`.
400
+ * @param count Number of sites to return
401
+ * @param radius Search radius
402
+ * @param detail Whether to include site metadata
403
+ */
404
+ nearby_charging_sites(count?: number, radius?: number, detail?: boolean): Promise<SignedCommandResponse>;
405
+ /**
406
+ * Sets automatic seat heating and cooling. Only the front seats support this action.
407
+ * @param auto_seat_position `AutoSeat` position (1-indexed: front left is 1, front right is 2)
408
+ * @param auto_climate_on `true` or `false`
409
+ */
410
+ remote_auto_seat_climate_request(auto_seat_position: keyof typeof AutoSeat | number, auto_climate_on: boolean): Promise<CommandResponse>;
411
+ /**
412
+ * Sets automatic steering wheel heating on/off.
413
+ * @param on `true` or `false`
414
+ */
415
+ remote_auto_steering_wheel_heat_climate_request(on: boolean): Promise<CommandResponse>;
416
+ /**
417
+ * Removes a charging schedule.
418
+ * @param id Schedule ID
419
+ */
420
+ remove_charge_schedule(id: number): Promise<CommandResponse>;
421
+ /**
422
+ * Removes a registered managed charging site.
423
+ * @param public_key The public key it was registered with
424
+ */
425
+ remove_managed_charging_site(public_key: string): Promise<SignedCommandResponse>;
426
+ /**
427
+ * Removes a preconditioning schedule.
428
+ * @param id Schedule ID
429
+ */
430
+ remove_precondition_schedule(id: number): Promise<CommandResponse>;
431
+ /**
432
+ * Plays a sound through the vehicle external speaker.
433
+ * @param sound Fart is `0`, Locate ping is `2000`
434
+ */
435
+ remote_boombox(sound?: number): Promise<CommandResponse>;
436
+ /**
437
+ * Sets seat cooling. Only the front seats support this action.
438
+ * @param seat_position `AutoSeat` position (1-indexed: front left is 1, front right is 2), unlike seat heating
439
+ * @param seat_cooler_level Cooling level
440
+ */
441
+ remote_seat_cooler_request(seat_position: keyof typeof AutoSeat | number, seat_cooler_level: Level): Promise<CommandResponse>;
442
+ /**
443
+ * Sets seat heating.
444
+ * @param seat_position Seat position
445
+ * @param seat_heater_level Heating level
446
+ */
447
+ remote_seat_heater_request(seat_position: Seat | number, seat_heater_level: Level): Promise<CommandResponse>;
448
+ /** Starts the vehicle remotely. Requires keyless driving to be enabled. */
449
+ remote_start_drive(): Promise<CommandResponse>;
450
+ /**
451
+ * Sets steering wheel heat level.
452
+ * @param level `Level` OFF, LOW or HIGH (0, 1, 3). There is no medium level.
453
+ */
454
+ remote_steering_wheel_heat_level_request(level: Level): Promise<CommandResponse>;
455
+ /**
456
+ * Sets steering wheel heating on/off. For vehicles that do not support auto steering wheel heat.
457
+ * @param on `true` or `false`
458
+ */
459
+ remote_steering_wheel_heater_request(on: boolean): Promise<CommandResponse>;
460
+ /**
461
+ * Resets PIN to Drive for fleet managers and owners. Requires firmware 2023.44+.
462
+ * The vehicle only accepts this with account credentials, which the cloud
463
+ * transport has and a raw Bluetooth link does not.
464
+ */
465
+ reset_pin_to_drive_admin(): Promise<CommandResponse>;
466
+ /** Removes PIN to Drive. Requires the car to be in Pin to Drive mode and not in Valet mode. */
467
+ reset_pin_to_drive_pin(): Promise<CommandResponse>;
468
+ /** Removes PIN for Valet Mode. */
469
+ reset_valet_pin(): Promise<CommandResponse>;
470
+ /**
471
+ * Schedules a vehicle software update (over the air "OTA") to be installed in the future.
472
+ * @param offset_sec Offset in seconds
473
+ */
474
+ schedule_software_update(offset_sec: number): Promise<CommandResponse>;
475
+ /**
476
+ * Turns Bioweapon Defense Mode on and off.
477
+ * @param on `true` or `false`
478
+ * @param manual_override `true` or `false`
479
+ */
480
+ set_bioweapon_mode(on: boolean, manual_override: boolean): Promise<CommandResponse>;
481
+ /**
482
+ * Sets the vehicle overheat protection.
483
+ * @param on `true` or `false`
484
+ * @param fan_only `true` or `false`
485
+ */
486
+ set_cabin_overheat_protection(on: boolean, fan_only: boolean): Promise<CommandResponse>;
487
+ /**
488
+ * Sets the vehicle's charge limit to a custom percentage.
489
+ * @param percent Charge limit percentage typically between 50-100
490
+ */
491
+ set_charge_limit(percent: number): Promise<CommandResponse>;
492
+ /**
493
+ * Sets the charging amps.
494
+ * @param charging_amps Current limit in Amps typically between 5-32
495
+ */
496
+ set_charging_amps(charging_amps: number): Promise<CommandResponse>;
497
+ /**
498
+ * Enables climate keeper mode.
499
+ * @param climate_keeper_mode `0` is Off, `1` is Keep, `2` is Dog, `3` is Camp
500
+ */
501
+ set_climate_keeper_mode(climate_keeper_mode: number | ClimateMode): Promise<CommandResponse>;
502
+ /**
503
+ * Adjusts the Cabin Overheat Protection temperature (COP).
504
+ * @param cop_temp Integer representing Low (0/30C/90F), Medium (1/35C/95F), or High (2/40C/100F)
505
+ */
506
+ set_cop_temp(cop_temp: 0 | 1 | 2 | 30 | 35 | 40 | 90 | 95 | 100): Promise<CommandResponse>;
507
+ /**
508
+ * Sets the vehicle's general discharge limit. This is not `set_powershare_discharge_limit`, which is a separate message.
509
+ * @param discharge_limit Discharge limit
510
+ */
511
+ set_discharge_limit(discharge_limit: number): Promise<CommandResponse>;
512
+ /**
513
+ * Turns Keep Accessory Power mode on and off, keeping 12V accessory power available while the vehicle is parked.
514
+ * @param on `true` or `false`
515
+ */
516
+ set_keep_accessory_power_mode(on: boolean): Promise<CommandResponse>;
517
+ /**
518
+ * Turns Low Power mode on and off, reducing standby power consumption while the vehicle is parked.
519
+ * @param on `true` or `false`
520
+ */
521
+ set_low_power_mode(on: boolean): Promise<CommandResponse>;
522
+ /**
523
+ * Sets a four-digit passcode for PIN to Drive.
524
+ * @param on `true` or `false`
525
+ * @param password Four-digit passcode
526
+ */
527
+ set_pin_to_drive(on: boolean, password: string | number): Promise<CommandResponse>;
528
+ /**
529
+ * Sets an override for preconditioning — it should default to empty if no override is used.
530
+ * @param on `true` or `false`
531
+ * @param manual_override `true` or `false`
532
+ */
533
+ set_preconditioning_max(on: boolean, manual_override: boolean): Promise<CommandResponse>;
534
+ /**
535
+ * Sets a time-of-use rate tariff schedule. The schedule nests up to five
536
+ * named seasons of four period types each, so build `seasons` and `tariff`
537
+ * with the `tesla-protocol` message types.
538
+ * @param seasons The tariff's seasons
539
+ * @param tariff The tariff
540
+ */
541
+ set_rate_tariff(seasons: SetRateTariffRequest_Seasons, tariff?: SetRateTariffRequest_Tariff): Promise<CommandResponse>;
542
+ /**
543
+ * Sets HVAC recirculation mode on and off.
544
+ * @param on `true` or `false`
545
+ */
546
+ set_recirculation(on: boolean): Promise<CommandResponse>;
547
+ /**
548
+ * Sets a time at which charging should be completed.
549
+ * @param enable `true` or `false`
550
+ * @param time Minutes after midnight
551
+ */
552
+ set_scheduled_charging(enable: boolean, time: number): Promise<CommandResponse>;
553
+ /**
554
+ * Sets a time at which departure should be completed.
555
+ *
556
+ * The protocol has no enable flags: a present recurrence block switches its
557
+ * feature on. So preconditioning and off-peak charging are sent only when
558
+ * their `*_enabled` or `*_weekdays_only` argument is true, and an absent
559
+ * block is what turns the feature off.
560
+ * @param enable `true` or `false`
561
+ * @param preconditioning_enabled `true` or `false`
562
+ * @param preconditioning_weekdays_only `true` or `false`
563
+ * @param departure_time Minutes after midnight
564
+ * @param off_peak_charging_enabled `true` or `false`
565
+ * @param off_peak_charging_weekdays_only `true` or `false`
566
+ * @param end_off_peak_time Minutes after midnight
567
+ */
568
+ 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>;
569
+ /**
570
+ * Enables and disables Sentry Mode.
571
+ * @param on `true` or `false`
572
+ */
573
+ set_sentry_mode(on: boolean): Promise<CommandResponse>;
574
+ /**
575
+ * Sets the vehicle suspension level.
576
+ * @param level `1` entry, `2` low, `3` medium, `4` high, `5` very high, `6` extract
577
+ */
578
+ set_suspension_level(level: number): Promise<CommandResponse>;
579
+ /**
580
+ * Sets the driver and/or passenger-side cabin temperature (and other zones if sync is enabled).
581
+ * @param driver_temp Driver temperature
582
+ * @param passenger_temp Passenger temperature
583
+ */
584
+ set_temps(driver_temp: number, passenger_temp: number): Promise<CommandResponse>;
585
+ /**
586
+ * Enables or disables tent mode.
587
+ * @param on `true` or `false`
588
+ */
589
+ set_tent_mode(on: boolean): Promise<CommandResponse>;
590
+ /**
591
+ * Turns on Valet Mode and sets a four-digit passcode.
592
+ * @param on `true` or `false`
593
+ * @param password Four-digit passcode
594
+ */
595
+ set_valet_mode(on: boolean, password?: string | number): Promise<CommandResponse>;
596
+ /**
597
+ * Changes the name of a vehicle.
598
+ * @param vehicle_name New name
599
+ */
600
+ set_vehicle_name(vehicle_name: string): Promise<CommandResponse>;
601
+ /**
602
+ * Activates Speed Limit Mode with a four-digit PIN.
603
+ * @param pin Four-digit PIN
604
+ */
605
+ speed_limit_activate(pin: string | number): Promise<CommandResponse>;
606
+ /**
607
+ * Deactivates Speed Limit Mode and resets the associated PIN.
608
+ * @param pin Four-digit PIN
609
+ */
610
+ speed_limit_clear_pin(pin: string | number): Promise<CommandResponse>;
611
+ /** Deactivates Speed Limit Mode and resets the associated PIN, for fleet managers or owners. */
612
+ speed_limit_clear_pin_admin(): Promise<CommandResponse>;
613
+ /**
614
+ * Deactivates Speed Limit Mode.
615
+ * @param pin Four-digit PIN
616
+ */
617
+ speed_limit_deactivate(pin: string | number): Promise<CommandResponse>;
618
+ /**
619
+ * Sets the maximum speed allowed when Speed Limit Mode is active.
620
+ * @param limit_mph Maximum speed in MPH
621
+ */
622
+ speed_limit_set_limit(limit_mph: number): Promise<CommandResponse>;
623
+ /**
624
+ * Starts a light show.
625
+ * @param show_index Index of the show
626
+ * @param start_time Start time
627
+ * @param volume Volume
628
+ * @param dance_moves Whether the vehicle moves during the show
629
+ */
630
+ start_light_show(show_index?: number, start_time?: number, volume?: number, dance_moves?: boolean): Promise<CommandResponse>;
631
+ /** Stops the current light show. */
632
+ stop_light_show(): Promise<CommandResponse>;
633
+ /** Stops the Cybertruck tonneau cover. */
634
+ stop_tonneau(): Promise<CommandResponse>;
635
+ /**
636
+ * Controls the panoramic sunroof on the Model S.
637
+ *
638
+ * "stop" has no corresponding field in the signed-command protobuf (only
639
+ * vent/close/open), so it is rejected rather than guessed at.
640
+ * @param state "open", "close" or "vent"
641
+ */
642
+ sun_roof_control(state: "stop" | "close" | "vent" | "open"): Promise<CommandResponse>;
643
+ /**
644
+ * Records a drive note. Overrides the inherited plaintext command so it is
645
+ * signed and dispatched over the vehicle-command protocol rather than
646
+ * silently falling through to the unsigned REST endpoint on vehicles that
647
+ * require signing.
648
+ * @param note Drive note
649
+ */
650
+ take_drivenote(note: string): Promise<CommandResponse>;
651
+ /**
652
+ * Turns on HomeLink (used to open and close garage doors).
653
+ * @param token
654
+ * @param lat Latitude. `0` is a coordinate; the location is sent when both are given.
655
+ * @param lon Longitude
656
+ */
657
+ trigger_homelink(token?: string, lat?: number, lon?: number): Promise<CommandResponse>;
658
+ /**
659
+ * Updates the charge on solar settings.
660
+ * @param enabled `true` or `false`
661
+ * @param lower_charge_limit Lower charge limit
662
+ * @param upper_charge_limit Upper charge limit
663
+ */
664
+ update_charge_on_solar(enabled: boolean, lower_charge_limit: number, upper_charge_limit: number): Promise<CommandResponse>;
665
+ /**
666
+ * Sends upcoming calendar entries to the vehicle. Overrides the inherited
667
+ * plaintext command so it is signed and dispatched over the vehicle-command
668
+ * protocol rather than silently falling through to the unsigned REST
669
+ * endpoint on vehicles that require signing.
670
+ * @param calendar_data Calendar data
671
+ */
672
+ upcoming_calendar_entries(calendar_data: string): Promise<CommandResponse>;
673
+ /**
674
+ * Asks the vehicle to open a video stream.
675
+ * @param url Video URL
676
+ */
677
+ video_request(url: string): Promise<CommandResponse>;
678
+ /**
679
+ * Control the windows of a parked vehicle. Supported commands: vent and close.
680
+ * @param command "vent" or "close"
681
+ * @param lat Latitude
682
+ * @param lon Longitude
683
+ */
684
+ window_control(command: "vent" | "close", _lat?: number, _lon?: number): Promise<CommandResponse>;
685
+ /**
686
+ * Requests a PII key, for privacy and telemetry pseudonymization.
687
+ * @param subscriber_public_key Subscriber public key
688
+ * @param pii_key_expiration Expiry as a Unix timestamp in seconds
689
+ */
690
+ pii_key_request(subscriber_public_key: string, pii_key_expiration: number): Promise<SignedCommandResponse>;
691
+ /**
692
+ * Syncs the vehicle's privacy and telemetry pseudonym with a previously known hashed value.
693
+ * @param last_known_pseudonym_hashed The hashed pseudonym
694
+ */
695
+ pseudonym_sync_request(last_known_pseudonym_hashed: Uint8Array): Promise<SignedCommandResponse>;
696
+ /**
697
+ * Passes a completed "Sign in with Tesla" OAuth response to the vehicle
698
+ * screen. The caller must already hold that response from its own auth flow.
699
+ * @param client_id OAuth client ID
700
+ * @param scope OAuth scope
701
+ * @param access_token Access token
702
+ * @param refresh_token Refresh token
703
+ * @param expiry_timestamp Token expiry
704
+ * @param error OAuth error, if any
705
+ * @param scoped_token Scoped token
706
+ */
707
+ tesla_auth_response(client_id: string, scope: string, access_token: string, refresh_token: string, expiry_timestamp: number, error?: string, scoped_token?: string): Promise<CommandResponse>;
708
+ /**
709
+ * Links a local Tesla profile to a cloud vault profile.
710
+ * @param cloud_vault_uuid Cloud vault UUID
711
+ * @param local_profile_uuid Local profile UUID
712
+ * @param delete_local_profile_after_setup Whether to delete the local profile afterwards
713
+ */
714
+ setup_cloud_profile_with_local_profile_uuid(cloud_vault_uuid: string, local_profile_uuid: string, delete_local_profile_after_setup?: boolean): Promise<CommandResponse>;
715
+ /**
716
+ * Gets the local Tesla profiles of a cloud vault, under `response.getLocalProfilesResponse`.
717
+ * @param vault_uuid Cloud vault UUID
718
+ */
719
+ get_local_profiles_for_vault_uuid(vault_uuid: string): Promise<SignedCommandResponse>;
720
+ /**
721
+ * Requests Bluetooth Classic, not BLE, pairing with a phone for calls and audio.
722
+ * @param name Device name
723
+ * @param mac_address Device MAC address
724
+ */
725
+ bluetooth_classic_pairing_request(name: string, mac_address: Uint8Array): Promise<CommandResponse>;
726
+ /**
727
+ * Runs a diagnostic bandwidth test, with its result under `response.bandwidthTestResponse`.
728
+ * @param requested_size Size in bytes
729
+ */
730
+ bandwidth_test(requested_size: number): Promise<SignedCommandResponse>;
731
+ /** Gets information about keys paired with the vehicle, under `response.keysInfoResponse`. */
732
+ fetch_keys_info(): Promise<SignedCommandResponse>;
733
+ /** Formats the USB drive connected to the vehicle, erasing all files on it. Irreversible. */
734
+ format_usb(): Promise<CommandResponse>;
735
+ /** Deletes all dashcam clips stored on the vehicle. Irreversible. */
736
+ delete_dashcam_clips(): Promise<CommandResponse>;
737
+ /**
738
+ * Activates or deactivates parental controls.
739
+ * @param activate `true` or `false`
740
+ * @param pin Four-digit PIN
741
+ */
742
+ parental_controls(activate: boolean, pin: string | number): Promise<CommandResponse>;
743
+ /**
744
+ * Clears the parental controls PIN.
745
+ * @param pin Four-digit PIN
746
+ */
747
+ parental_controls_clear_pin(pin: string | number): Promise<CommandResponse>;
748
+ /** Clears the parental controls PIN, for fleet managers and owners. */
749
+ parental_controls_clear_pin_admin(): Promise<CommandResponse>;
750
+ /**
751
+ * Enables or disables a parental controls setting.
752
+ * @param setting `0` speed limit, `1` acceleration, `2` safety features, `3` curfew, `4` browser blocked, `5` theater blocked, `6` arcade blocked
753
+ * @param enable `true` or `false`
754
+ */
755
+ parental_controls_enable_setting(setting: number, enable: boolean): Promise<CommandResponse>;
756
+ /**
757
+ * Sets the parental controls speed limit.
758
+ * @param limit_mph Maximum speed in MPH
759
+ */
760
+ parental_controls_set_speed_limit(limit_mph: number): Promise<CommandResponse>;
761
+ /**
762
+ * Sets the displayed temperature unit.
763
+ * @param unit `TemperatureUnit`
764
+ */
765
+ set_temperature_unit(unit: TemperatureUnit | number): Promise<CommandResponse>;
766
+ /**
767
+ * Sets the displayed distance unit.
768
+ * @param unit `DistanceUnit`
769
+ */
770
+ set_distance_unit(unit: DistanceUnit | number): Promise<CommandResponse>;
771
+ /**
772
+ * Sets the displayed clock format.
773
+ * @param format `TimeDisplayFormat`
774
+ */
775
+ set_time_display_format(format: TimeDisplayFormat | number): Promise<CommandResponse>;
776
+ /**
777
+ * Sets the displayed tire pressure unit.
778
+ * @param unit `TirePressureUnit`
779
+ */
780
+ set_tire_pressure_unit(unit: TirePressureUnit | number): Promise<CommandResponse>;
781
+ /**
782
+ * Sets the displayed energy or range unit.
783
+ * @param format `EnergyDisplayFormat`
784
+ */
785
+ set_energy_display_format(format: EnergyDisplayFormat | number): Promise<CommandResponse>;
786
+ /**
787
+ * Sets paired-phone display preferences.
788
+ * @param font_size `PhoneFontSize`
789
+ * @param options.distance_unit `DistanceUnit`
790
+ * @param options.temperature_unit `TemperatureUnit`
791
+ */
792
+ set_phone_setting_preferences(font_size?: PhoneFontSize | number, { distance_unit, temperature_unit }?: {
793
+ distance_unit?: DistanceUnit | number;
794
+ temperature_unit?: TemperatureUnit | number;
795
+ }): Promise<CommandResponse>;
796
+ /**
797
+ * Enables or disables the Powershare feature.
798
+ * @param on `true` or `false`
799
+ */
800
+ set_powershare_feature(on: boolean): Promise<CommandResponse>;
801
+ /**
802
+ * Enables or disables powershare.
803
+ * @param on `true` or `false`
804
+ */
805
+ set_powershare_request(on: boolean): Promise<CommandResponse>;
806
+ /**
807
+ * Sets the Powershare discharge limit. This is not `set_discharge_limit`, which is a separate message.
808
+ * @param percent Discharge limit percentage
809
+ */
810
+ set_powershare_discharge_limit(percent: number): Promise<CommandResponse>;
811
+ /**
812
+ * Sets the outlets on or off.
813
+ * @param request `0` off, `1` cabin and bed, `2` cabin
814
+ */
815
+ set_outlets(request: number): Promise<CommandResponse>;
816
+ /**
817
+ * Sets the outlet timer.
818
+ * @param num_minutes Minutes
819
+ */
820
+ set_outlet_timer(num_minutes: number): Promise<CommandResponse>;
821
+ /**
822
+ * Sets the outlet state of charge limit.
823
+ * @param percent State of charge percentage
824
+ */
825
+ set_outlet_soc_limit(percent: number): Promise<CommandResponse>;
826
+ /**
827
+ * Sets the power feed on or off.
828
+ * @param request `0` off, `1` feed 1, `2` feed 2, `3` both
829
+ */
830
+ set_power_feed(request: number): Promise<CommandResponse>;
831
+ /**
832
+ * Sets the power feed timer.
833
+ * @param num_minutes Minutes
834
+ */
835
+ set_power_feed_timer(num_minutes: number): Promise<CommandResponse>;
836
+ /**
837
+ * Sets the power feed state of charge limit.
838
+ * @param percent State of charge percentage
839
+ */
840
+ set_power_feed_soc_limit(percent: number): Promise<CommandResponse>;
841
+ /**
842
+ * Sets the lightbar brightness.
843
+ * @param brightness Brightness
844
+ */
845
+ set_lightbar_brightness(brightness: number): Promise<CommandResponse>;
846
+ /**
847
+ * Turns the lightbar middle light on or off.
848
+ * @param on `true` or `false`
849
+ */
850
+ set_lightbar_middle(on: boolean): Promise<CommandResponse>;
851
+ /**
852
+ * Turns the ditch lights on or off.
853
+ * @param on `true` or `false`
854
+ */
855
+ set_lightbar_ditch(on: boolean): Promise<CommandResponse>;
856
+ /**
857
+ * Sets the front zone light level.
858
+ * @param level `0` off, `1` low, `2` medium, `3` high
859
+ */
860
+ set_front_zone_lights(level: number): Promise<CommandResponse>;
861
+ /**
862
+ * Sets the rear zone light level.
863
+ * @param level `0` off, `1` low, `2` medium, `3` high
864
+ */
865
+ set_rear_zone_lights(level: number): Promise<CommandResponse>;
866
+ /**
867
+ * Starts or stops the trailer light test.
868
+ * @param on `true` or `false`
869
+ */
870
+ set_trailer_light_test(on: boolean): Promise<CommandResponse>;
871
+ /**
872
+ * Sets the truck bed light's auto state.
873
+ * @param on `true` or `false`
874
+ */
875
+ set_truck_bed_light_auto(on: boolean): Promise<CommandResponse>;
876
+ /**
877
+ * Sets the truck bed light brightness.
878
+ * @param brightness Brightness
879
+ */
880
+ set_truck_bed_light_brightness(brightness: number): Promise<CommandResponse>;
881
+ }