tesla-fleet-api 0.4.0 → 0.6.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.
- package/README.md +269 -1
- package/dist/_virtual/_rolldown/runtime.cjs +10 -0
- package/dist/bluetooth/adapters/shared.cjs +38 -0
- package/dist/bluetooth/adapters/shared.mjs +36 -0
- package/dist/bluetooth/async.cjs +121 -0
- package/dist/bluetooth/async.d.cts +10 -0
- package/dist/bluetooth/async.d.mts +10 -0
- package/dist/bluetooth/async.mjs +116 -0
- package/dist/bluetooth/broadcast.cjs +153 -0
- package/dist/bluetooth/broadcast.d.cts +59 -0
- package/dist/bluetooth/broadcast.d.mts +59 -0
- package/dist/bluetooth/broadcast.mjs +151 -0
- package/dist/bluetooth/constants.cjs +96 -0
- package/dist/bluetooth/constants.d.cts +68 -0
- package/dist/bluetooth/constants.d.mts +68 -0
- package/dist/bluetooth/constants.mjs +70 -0
- package/dist/bluetooth/framing.cjs +125 -0
- package/dist/bluetooth/framing.d.cts +45 -0
- package/dist/bluetooth/framing.d.mts +45 -0
- package/dist/bluetooth/framing.mjs +122 -0
- package/dist/bluetooth/homey.cjs +165 -0
- package/dist/bluetooth/homey.d.cts +84 -0
- package/dist/bluetooth/homey.d.mts +84 -0
- package/dist/bluetooth/homey.mjs +159 -0
- package/dist/bluetooth/names.cjs +24 -0
- package/dist/bluetooth/names.d.cts +10 -0
- package/dist/bluetooth/names.d.mts +10 -0
- package/dist/bluetooth/names.mjs +20 -0
- package/dist/bluetooth/noble.cjs +178 -0
- package/dist/bluetooth/noble.d.cts +58 -0
- package/dist/bluetooth/noble.d.mts +58 -0
- package/dist/bluetooth/noble.mjs +177 -0
- package/dist/bluetooth/streamglue.cjs +157 -0
- package/dist/bluetooth/streamglue.d.cts +37 -0
- package/dist/bluetooth/streamglue.d.mts +37 -0
- package/dist/bluetooth/streamglue.mjs +154 -0
- package/dist/bluetooth/teslabluetooth.cjs +67 -0
- package/dist/bluetooth/teslabluetooth.d.cts +41 -0
- package/dist/bluetooth/teslabluetooth.d.mts +41 -0
- package/dist/bluetooth/teslabluetooth.mjs +66 -0
- package/dist/bluetooth/transport.cjs +10 -0
- package/dist/bluetooth/transport.d.cts +97 -0
- package/dist/bluetooth/transport.d.mts +97 -0
- package/dist/bluetooth/transport.mjs +10 -0
- package/dist/bluetooth/vehiclebluetooth.cjs +1272 -0
- package/dist/bluetooth/vehiclebluetooth.d.cts +495 -0
- package/dist/bluetooth/vehiclebluetooth.d.mts +495 -0
- package/dist/bluetooth/vehiclebluetooth.mjs +1270 -0
- package/dist/bluetooth/verify.cjs +93 -0
- package/dist/bluetooth/verify.d.cts +35 -0
- package/dist/bluetooth/verify.d.mts +35 -0
- package/dist/bluetooth/verify.mjs +91 -0
- package/dist/bluetooth.cjs +52 -0
- package/dist/bluetooth.d.cts +10 -0
- package/dist/bluetooth.d.mts +10 -0
- package/dist/bluetooth.mjs +9 -0
- package/dist/commands.cjs +1080 -85
- package/dist/commands.d.cts +585 -54
- package/dist/commands.d.mts +583 -51
- package/dist/commands.mjs +1084 -93
- package/dist/const.cjs +22 -0
- package/dist/const.d.cts +21 -0
- package/dist/const.d.mts +21 -0
- package/dist/const.mjs +20 -1
- package/dist/energy.cjs +24 -19
- package/dist/energy.d.cts +21 -15
- package/dist/energy.d.mts +21 -15
- package/dist/energy.mjs +24 -19
- package/dist/energyisland.cjs +38 -0
- package/dist/energyisland.mjs +37 -0
- package/dist/energyparsers.cjs +118 -0
- package/dist/energyparsers.d.cts +39 -0
- package/dist/energyparsers.d.mts +39 -0
- package/dist/energyparsers.mjs +116 -0
- package/dist/energyspecific.cjs +375 -17
- package/dist/energyspecific.d.cts +199 -19
- package/dist/energyspecific.d.mts +197 -16
- package/dist/energyspecific.mjs +370 -18
- package/dist/exceptions.cjs +3 -2
- package/dist/exceptions.d.cts +3 -2
- package/dist/exceptions.d.mts +3 -2
- package/dist/exceptions.mjs +3 -2
- package/dist/funnel.cjs +297 -0
- package/dist/funnel.d.cts +118 -0
- package/dist/funnel.d.mts +118 -0
- package/dist/funnel.mjs +292 -0
- package/dist/index.cjs +61 -0
- package/dist/index.d.cts +22 -8
- package/dist/index.d.mts +22 -8
- package/dist/index.mjs +19 -6
- package/dist/log.cjs +75 -0
- package/dist/log.d.cts +4 -0
- package/dist/log.d.mts +4 -0
- package/dist/log.mjs +71 -0
- package/dist/oauth.cjs +143 -0
- package/dist/oauth.d.cts +69 -0
- package/dist/oauth.d.mts +69 -0
- package/dist/oauth.mjs +143 -0
- package/dist/powerwall/client.cjs +818 -0
- package/dist/powerwall/client.d.cts +297 -0
- package/dist/powerwall/client.d.mts +297 -0
- package/dist/powerwall/client.mjs +807 -0
- package/dist/powerwall/components.cjs +188 -0
- package/dist/powerwall/components.d.cts +45 -0
- package/dist/powerwall/components.d.mts +45 -0
- package/dist/powerwall/components.mjs +182 -0
- package/dist/powerwall/energysite.cjs +216 -0
- package/dist/powerwall/energysite.d.cts +104 -0
- package/dist/powerwall/energysite.d.mts +104 -0
- package/dist/powerwall/energysite.mjs +214 -0
- package/dist/powerwall/exceptions.cjs +59 -0
- package/dist/powerwall/exceptions.d.cts +38 -0
- package/dist/powerwall/exceptions.d.mts +38 -0
- package/dist/powerwall/exceptions.mjs +51 -0
- package/dist/powerwall/gateway.cjs +102 -0
- package/dist/powerwall/gateway.d.cts +57 -0
- package/dist/powerwall/gateway.d.mts +57 -0
- package/dist/powerwall/gateway.mjs +101 -0
- package/dist/powerwall/merge.cjs +163 -0
- package/dist/powerwall/merge.d.cts +63 -0
- package/dist/powerwall/merge.d.mts +63 -0
- package/dist/powerwall/merge.mjs +159 -0
- package/dist/powerwall/models.d.cts +95 -0
- package/dist/powerwall/models.d.mts +95 -0
- package/dist/powerwall/queries.cjs +17 -0
- package/dist/powerwall/queries.mjs +10 -0
- package/dist/powerwall/transport.cjs +232 -0
- package/dist/powerwall/transport.mjs +227 -0
- package/dist/powerwall.cjs +47 -0
- package/dist/powerwall.d.cts +9 -0
- package/dist/powerwall.d.mts +9 -0
- package/dist/powerwall.mjs +8 -0
- package/dist/router/base.cjs +203 -0
- package/dist/router/base.d.cts +112 -0
- package/dist/router/base.d.mts +112 -0
- package/dist/router/base.mjs +200 -0
- package/dist/router/energysite.cjs +65 -0
- package/dist/router/energysite.d.cts +47 -0
- package/dist/router/energysite.d.mts +47 -0
- package/dist/router/energysite.mjs +60 -0
- package/dist/router.cjs +13 -0
- package/dist/router.d.cts +3 -1
- package/dist/router.d.mts +3 -1
- package/dist/router.mjs +3 -1
- package/dist/signing/crypto.cjs +28 -0
- package/dist/signing/crypto.mjs +26 -1
- package/dist/signing/energy.cjs +123 -0
- package/dist/signing/energy.d.cts +45 -0
- package/dist/signing/energy.d.mts +45 -0
- package/dist/signing/energy.mjs +120 -0
- package/dist/signing/jws.cjs +229 -0
- package/dist/signing/jws.d.cts +45 -0
- package/dist/signing/jws.d.mts +45 -0
- package/dist/signing/jws.mjs +211 -0
- package/dist/signing/keys.cjs +191 -0
- package/dist/signing/keys.d.cts +21 -0
- package/dist/signing/keys.d.mts +21 -0
- package/dist/signing/keys.mjs +182 -0
- package/dist/signing/session.cjs +104 -30
- package/dist/signing/session.d.cts +60 -23
- package/dist/signing/session.d.mts +60 -23
- package/dist/signing/session.mjs +105 -31
- package/dist/tariff.cjs +27 -0
- package/dist/tariff.d.cts +11 -0
- package/dist/tariff.d.mts +11 -0
- package/dist/tariff.mjs +27 -1
- package/dist/teslafleetapi.cjs +256 -55
- package/dist/teslafleetapi.d.cts +110 -14
- package/dist/teslafleetapi.d.mts +110 -14
- package/dist/teslafleetapi.mjs +258 -57
- package/dist/teslemetry.cjs +152 -5
- package/dist/teslemetry.d.cts +95 -5
- package/dist/teslemetry.d.mts +93 -3
- package/dist/teslemetry.mjs +151 -6
- package/dist/teslemetryenergy.cjs +287 -0
- package/dist/teslemetryenergy.d.cts +154 -0
- package/dist/teslemetryenergy.d.mts +154 -0
- package/dist/teslemetryenergy.mjs +282 -0
- package/dist/teslemetryvehicle.cjs +407 -0
- package/dist/teslemetryvehicle.d.cts +238 -0
- package/dist/teslemetryvehicle.d.mts +238 -0
- package/dist/teslemetryvehicle.mjs +405 -0
- package/dist/tessie.cjs +42 -5
- package/dist/tessie.d.cts +51 -5
- package/dist/tessie.d.mts +49 -3
- package/dist/tessie.mjs +42 -5
- package/dist/tessievehicle.cjs +514 -0
- package/dist/tessievehicle.d.cts +333 -0
- package/dist/tessievehicle.d.mts +333 -0
- package/dist/tessievehicle.mjs +513 -0
- package/dist/types/live_status.d.cts +16 -16
- package/dist/types/live_status.d.mts +16 -16
- package/dist/types/responses.d.cts +5 -1
- package/dist/types/responses.d.mts +5 -1
- package/dist/types/vehicle.d.cts +7 -1
- package/dist/types/vehicle.d.mts +7 -1
- package/dist/types.d.cts +3 -3
- package/dist/types.d.mts +3 -3
- package/dist/util.cjs +41 -0
- package/dist/util.d.cts +18 -0
- package/dist/util.d.mts +18 -0
- package/dist/util.mjs +40 -0
- package/dist/vehicle.cjs +79 -36
- package/dist/vehicle.d.cts +42 -26
- package/dist/vehicle.d.mts +42 -26
- package/dist/vehicle.mjs +80 -37
- package/dist/vehiclesigned.cjs +20 -5
- package/dist/vehiclesigned.d.cts +14 -5
- package/dist/vehiclesigned.d.mts +14 -5
- package/dist/vehiclesigned.mjs +20 -5
- package/dist/vehiclespecific.cjs +126 -15
- package/dist/vehiclespecific.d.cts +82 -18
- package/dist/vehiclespecific.d.mts +82 -18
- package/dist/vehiclespecific.mjs +126 -15
- package/package.json +56 -3
package/dist/commands.d.mts
CHANGED
|
@@ -1,53 +1,173 @@
|
|
|
1
1
|
import { CommandResponse } from "./types/commands.mjs";
|
|
2
|
-
import { AutoSeat, ClimateMode, Level, Seat, Trunk } from "./const.mjs";
|
|
2
|
+
import { AutoSeat, ClimateMode, DistanceUnit, EnergyDisplayFormat, Level, PhoneFontSize, Seat, TemperatureUnit, TimeDisplayFormat, TirePressureUnit, Trunk, VehicleImageType } from "./const.mjs";
|
|
3
3
|
import Vehicle from "./vehicle.mjs";
|
|
4
4
|
import VehicleSpecific from "./vehiclespecific.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Session } from "./signing/session.mjs";
|
|
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;
|
|
7
57
|
/**
|
|
8
58
|
* Transport-agnostic signed-command builder for the Tesla Vehicle Command
|
|
9
59
|
* Protocol: mirrors `python-tesla-fleet-api`'s `Commands` ABC. Every method
|
|
10
|
-
* here builds a `RoutableMessage`, signs it
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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.
|
|
14
65
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
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.
|
|
17
68
|
*/
|
|
18
69
|
export default abstract class Commands extends VehicleSpecific {
|
|
19
70
|
#private;
|
|
20
71
|
/** Delay between WAIT-retries; overridable so tests don't have to wait for real timers. */
|
|
21
72
|
protected retryDelayMs: number;
|
|
22
|
-
|
|
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;
|
|
23
81
|
private readonly sessions;
|
|
24
|
-
|
|
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;
|
|
25
97
|
/**
|
|
26
98
|
* Transmit a signed (or session-handshake) `RoutableMessage` to the
|
|
27
99
|
* vehicle and return its reply. Implementations must call
|
|
28
|
-
* `
|
|
29
|
-
*
|
|
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.
|
|
30
103
|
*/
|
|
31
|
-
protected abstract _send(msg: RoutableMessage, requires:
|
|
32
|
-
|
|
104
|
+
protected abstract _send(msg: RoutableMessage, requires: SendRequires, options?: SendOptions): Promise<RoutableMessage>;
|
|
105
|
+
protected sessionFor(domain: Domain): Session;
|
|
33
106
|
/**
|
|
34
107
|
* Absorb session info piggy-backed on any signed-command reply and raise
|
|
35
108
|
* on a whitelist rejection or a terminal message fault. Every concrete
|
|
36
|
-
* `_send` must call this on the reply - passing the `uuid`
|
|
37
|
-
* it just sent - before returning it.
|
|
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.
|
|
38
113
|
*
|
|
39
114
|
* A `SessionInfo` is untrusted wire data until its `session_info_tag` is
|
|
40
|
-
* verified: the tag is an HMAC over the exact bytes received,
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
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 -
|
|
45
121
|
* including its own whitelist-status field - and even then `Session.commit`
|
|
46
122
|
* still refuses a clock time that regresses within the same epoch.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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;
|
|
50
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;
|
|
51
171
|
/**
|
|
52
172
|
* Build, sign, dispatch (with WAIT/epoch-fault retry), and interpret one
|
|
53
173
|
* domain command.
|
|
@@ -60,19 +180,93 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
60
180
|
* most one VCSEC message is ever in flight. Infotainment keeps the
|
|
61
181
|
* narrower build-only lock, serializing only counter assignment.
|
|
62
182
|
*/
|
|
63
|
-
|
|
183
|
+
protected dispatch(domain: Domain, command: Buffer, options?: Omit<SendOptions, "optimistic">): Promise<SignedReply>;
|
|
64
184
|
private interpretResponse;
|
|
65
185
|
private interpretVcsecResponse;
|
|
186
|
+
protected raiseWhitelistFault(information: WhitelistOperationInformationE | undefined): void;
|
|
66
187
|
private interpretInfotainmentResponse;
|
|
67
|
-
|
|
68
|
-
private
|
|
69
|
-
|
|
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;
|
|
70
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>;
|
|
71
265
|
/**
|
|
72
266
|
* Controls the front (which_trunk: "front") or rear (which_trunk: "rear") trunk.
|
|
73
267
|
* @param which_trunk "front" or "rear"
|
|
74
268
|
*/
|
|
75
|
-
|
|
269
|
+
actuate_trunk(which_trunk: Trunk): Promise<CommandResponse>;
|
|
76
270
|
/**
|
|
77
271
|
* Adjusts vehicle media playback volume.
|
|
78
272
|
* @param volume A floating point number from 0.0 to 11.0.
|
|
@@ -82,8 +276,26 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
82
276
|
auto_conditioning_start(): Promise<CommandResponse>;
|
|
83
277
|
/** Stops climate preconditioning. */
|
|
84
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>;
|
|
85
295
|
/** Cancels the countdown to install the vehicle software update. */
|
|
86
296
|
cancel_software_update(): Promise<CommandResponse>;
|
|
297
|
+
/** Cancels a State of Health test. */
|
|
298
|
+
cancel_soh_test(): Promise<CommandResponse>;
|
|
87
299
|
/** Charges in max range mode -- we recommend limiting the use of this mode to long trips. */
|
|
88
300
|
charge_max_range(): Promise<CommandResponse>;
|
|
89
301
|
/** Closes the charge port door. */
|
|
@@ -98,8 +310,13 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
98
310
|
charge_stop(): Promise<CommandResponse>;
|
|
99
311
|
/**
|
|
100
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.
|
|
101
314
|
*/
|
|
102
|
-
clear_pin_to_drive_admin(): Promise<CommandResponse>;
|
|
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>;
|
|
103
320
|
/** Locks the vehicle. */
|
|
104
321
|
door_lock(): Promise<CommandResponse>;
|
|
105
322
|
/** Unlocks the vehicle. */
|
|
@@ -108,6 +325,14 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
108
325
|
erase_user_data(): Promise<CommandResponse>;
|
|
109
326
|
/** Briefly flashes the vehicle headlights. Requires the vehicle to be in park. */
|
|
110
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>;
|
|
111
336
|
/**
|
|
112
337
|
* Restricts certain vehicle UI functionality from guest users
|
|
113
338
|
* @param enable `true` or `false`
|
|
@@ -127,6 +352,16 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
127
352
|
media_toggle_playback(): Promise<CommandResponse>;
|
|
128
353
|
/** Turns the volume down by one. */
|
|
129
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>;
|
|
130
365
|
/**
|
|
131
366
|
* Start navigation to given coordinates.
|
|
132
367
|
* @param lat Latitude
|
|
@@ -137,19 +372,36 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
137
372
|
/**
|
|
138
373
|
* Sends a location to the in-vehicle navigation system.
|
|
139
374
|
*
|
|
140
|
-
* `locale` and `
|
|
141
|
-
* signed-command protocol
|
|
142
|
-
* multi-stop order
|
|
143
|
-
*
|
|
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.
|
|
144
379
|
* @param value Destination text
|
|
145
380
|
*/
|
|
146
|
-
navigation_request(value: string, _locale?: string,
|
|
381
|
+
navigation_request(value: string, _type?: string, _locale?: string | null, _timestamp_ms?: number | null): Promise<CommandResponse>;
|
|
147
382
|
/**
|
|
148
383
|
* Start navigation to a supercharger.
|
|
149
384
|
* @param id Supercharger ID
|
|
150
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
|
|
151
386
|
*/
|
|
152
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>;
|
|
153
405
|
/**
|
|
154
406
|
* Sets automatic seat heating and cooling. Only the front seats support this action.
|
|
155
407
|
* @param auto_seat_position `AutoSeat` position (1-indexed: front left is 1, front right is 2)
|
|
@@ -161,6 +413,21 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
161
413
|
* @param on `true` or `false`
|
|
162
414
|
*/
|
|
163
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>;
|
|
164
431
|
/**
|
|
165
432
|
* Plays a sound through the vehicle external speaker.
|
|
166
433
|
* @param sound Fart is `0`, Locate ping is `2000`
|
|
@@ -168,10 +435,10 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
168
435
|
remote_boombox(sound?: number): Promise<CommandResponse>;
|
|
169
436
|
/**
|
|
170
437
|
* Sets seat cooling. Only the front seats support this action.
|
|
171
|
-
* @param seat_position
|
|
438
|
+
* @param seat_position `AutoSeat` position (1-indexed: front left is 1, front right is 2), unlike seat heating
|
|
172
439
|
* @param seat_cooler_level Cooling level
|
|
173
440
|
*/
|
|
174
|
-
remote_seat_cooler_request(seat_position:
|
|
441
|
+
remote_seat_cooler_request(seat_position: keyof typeof AutoSeat | number, seat_cooler_level: Level): Promise<CommandResponse>;
|
|
175
442
|
/**
|
|
176
443
|
* Sets seat heating.
|
|
177
444
|
* @param seat_position Seat position
|
|
@@ -182,7 +449,7 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
182
449
|
remote_start_drive(): Promise<CommandResponse>;
|
|
183
450
|
/**
|
|
184
451
|
* Sets steering wheel heat level.
|
|
185
|
-
* @param level
|
|
452
|
+
* @param level `Level` OFF, LOW or HIGH (0, 1, 3). There is no medium level.
|
|
186
453
|
*/
|
|
187
454
|
remote_steering_wheel_heat_level_request(level: Level): Promise<CommandResponse>;
|
|
188
455
|
/**
|
|
@@ -190,6 +457,12 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
190
457
|
* @param on `true` or `false`
|
|
191
458
|
*/
|
|
192
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>;
|
|
193
466
|
/** Removes PIN to Drive. Requires the car to be in Pin to Drive mode and not in Valet mode. */
|
|
194
467
|
reset_pin_to_drive_pin(): Promise<CommandResponse>;
|
|
195
468
|
/** Removes PIN for Valet Mode. */
|
|
@@ -231,6 +504,21 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
231
504
|
* @param cop_temp Integer representing Low (0/30C/90F), Medium (1/35C/95F), or High (2/40C/100F)
|
|
232
505
|
*/
|
|
233
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>;
|
|
234
522
|
/**
|
|
235
523
|
* Sets a four-digit passcode for PIN to Drive.
|
|
236
524
|
* @param on `true` or `false`
|
|
@@ -243,6 +531,19 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
243
531
|
* @param manual_override `true` or `false`
|
|
244
532
|
*/
|
|
245
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>;
|
|
246
547
|
/**
|
|
247
548
|
* Sets a time at which charging should be completed.
|
|
248
549
|
* @param enable `true` or `false`
|
|
@@ -252,35 +553,46 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
252
553
|
/**
|
|
253
554
|
* Sets a time at which departure should be completed.
|
|
254
555
|
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
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.
|
|
258
560
|
* @param enable `true` or `false`
|
|
259
|
-
* @param preconditioning_enabled
|
|
561
|
+
* @param preconditioning_enabled `true` or `false`
|
|
260
562
|
* @param preconditioning_weekdays_only `true` or `false`
|
|
261
563
|
* @param departure_time Minutes after midnight
|
|
262
|
-
* @param off_peak_charging_enabled
|
|
564
|
+
* @param off_peak_charging_enabled `true` or `false`
|
|
263
565
|
* @param off_peak_charging_weekdays_only `true` or `false`
|
|
264
566
|
* @param end_off_peak_time Minutes after midnight
|
|
265
567
|
*/
|
|
266
|
-
set_scheduled_departure(enable?: boolean,
|
|
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>;
|
|
267
569
|
/**
|
|
268
570
|
* Enables and disables Sentry Mode.
|
|
269
571
|
* @param on `true` or `false`
|
|
270
572
|
*/
|
|
271
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>;
|
|
272
579
|
/**
|
|
273
580
|
* Sets the driver and/or passenger-side cabin temperature (and other zones if sync is enabled).
|
|
274
581
|
* @param driver_temp Driver temperature
|
|
275
582
|
* @param passenger_temp Passenger temperature
|
|
276
583
|
*/
|
|
277
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>;
|
|
278
590
|
/**
|
|
279
591
|
* Turns on Valet Mode and sets a four-digit passcode.
|
|
280
592
|
* @param on `true` or `false`
|
|
281
593
|
* @param password Four-digit passcode
|
|
282
594
|
*/
|
|
283
|
-
set_valet_mode(on: boolean, password
|
|
595
|
+
set_valet_mode(on: boolean, password?: string | number): Promise<CommandResponse>;
|
|
284
596
|
/**
|
|
285
597
|
* Changes the name of a vehicle.
|
|
286
598
|
* @param vehicle_name New name
|
|
@@ -308,14 +620,26 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
308
620
|
* @param limit_mph Maximum speed in MPH
|
|
309
621
|
*/
|
|
310
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>;
|
|
311
635
|
/**
|
|
312
636
|
* Controls the panoramic sunroof on the Model S.
|
|
313
637
|
*
|
|
314
638
|
* "stop" has no corresponding field in the signed-command protobuf (only
|
|
315
639
|
* vent/close/open), so it is rejected rather than guessed at.
|
|
316
|
-
* @param state "close" or "vent"
|
|
640
|
+
* @param state "open", "close" or "vent"
|
|
317
641
|
*/
|
|
318
|
-
sun_roof_control(state: "stop" | "close" | "vent"): Promise<CommandResponse>;
|
|
642
|
+
sun_roof_control(state: "stop" | "close" | "vent" | "open"): Promise<CommandResponse>;
|
|
319
643
|
/**
|
|
320
644
|
* Records a drive note. Overrides the inherited plaintext command so it is
|
|
321
645
|
* signed and dispatched over the vehicle-command protocol rather than
|
|
@@ -326,11 +650,18 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
326
650
|
take_drivenote(note: string): Promise<CommandResponse>;
|
|
327
651
|
/**
|
|
328
652
|
* Turns on HomeLink (used to open and close garage doors).
|
|
329
|
-
* @param lat Latitude
|
|
330
|
-
* @param lon Longitude
|
|
331
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
|
|
332
663
|
*/
|
|
333
|
-
|
|
664
|
+
update_charge_on_solar(enabled: boolean, lower_charge_limit: number, upper_charge_limit: number): Promise<CommandResponse>;
|
|
334
665
|
/**
|
|
335
666
|
* Sends upcoming calendar entries to the vehicle. Overrides the inherited
|
|
336
667
|
* plaintext command so it is signed and dispatched over the vehicle-command
|
|
@@ -339,6 +670,11 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
339
670
|
* @param calendar_data Calendar data
|
|
340
671
|
*/
|
|
341
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>;
|
|
342
678
|
/**
|
|
343
679
|
* Control the windows of a parked vehicle. Supported commands: vent and close.
|
|
344
680
|
* @param command "vent" or "close"
|
|
@@ -346,4 +682,200 @@ export default abstract class Commands extends VehicleSpecific {
|
|
|
346
682
|
* @param lon Longitude
|
|
347
683
|
*/
|
|
348
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>;
|
|
349
881
|
}
|