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.
Files changed (215) hide show
  1. package/README.md +269 -1
  2. package/dist/_virtual/_rolldown/runtime.cjs +10 -0
  3. package/dist/bluetooth/adapters/shared.cjs +38 -0
  4. package/dist/bluetooth/adapters/shared.mjs +36 -0
  5. package/dist/bluetooth/async.cjs +121 -0
  6. package/dist/bluetooth/async.d.cts +10 -0
  7. package/dist/bluetooth/async.d.mts +10 -0
  8. package/dist/bluetooth/async.mjs +116 -0
  9. package/dist/bluetooth/broadcast.cjs +153 -0
  10. package/dist/bluetooth/broadcast.d.cts +59 -0
  11. package/dist/bluetooth/broadcast.d.mts +59 -0
  12. package/dist/bluetooth/broadcast.mjs +151 -0
  13. package/dist/bluetooth/constants.cjs +96 -0
  14. package/dist/bluetooth/constants.d.cts +68 -0
  15. package/dist/bluetooth/constants.d.mts +68 -0
  16. package/dist/bluetooth/constants.mjs +70 -0
  17. package/dist/bluetooth/framing.cjs +125 -0
  18. package/dist/bluetooth/framing.d.cts +45 -0
  19. package/dist/bluetooth/framing.d.mts +45 -0
  20. package/dist/bluetooth/framing.mjs +122 -0
  21. package/dist/bluetooth/homey.cjs +165 -0
  22. package/dist/bluetooth/homey.d.cts +84 -0
  23. package/dist/bluetooth/homey.d.mts +84 -0
  24. package/dist/bluetooth/homey.mjs +159 -0
  25. package/dist/bluetooth/names.cjs +24 -0
  26. package/dist/bluetooth/names.d.cts +10 -0
  27. package/dist/bluetooth/names.d.mts +10 -0
  28. package/dist/bluetooth/names.mjs +20 -0
  29. package/dist/bluetooth/noble.cjs +178 -0
  30. package/dist/bluetooth/noble.d.cts +58 -0
  31. package/dist/bluetooth/noble.d.mts +58 -0
  32. package/dist/bluetooth/noble.mjs +177 -0
  33. package/dist/bluetooth/streamglue.cjs +157 -0
  34. package/dist/bluetooth/streamglue.d.cts +37 -0
  35. package/dist/bluetooth/streamglue.d.mts +37 -0
  36. package/dist/bluetooth/streamglue.mjs +154 -0
  37. package/dist/bluetooth/teslabluetooth.cjs +67 -0
  38. package/dist/bluetooth/teslabluetooth.d.cts +41 -0
  39. package/dist/bluetooth/teslabluetooth.d.mts +41 -0
  40. package/dist/bluetooth/teslabluetooth.mjs +66 -0
  41. package/dist/bluetooth/transport.cjs +10 -0
  42. package/dist/bluetooth/transport.d.cts +97 -0
  43. package/dist/bluetooth/transport.d.mts +97 -0
  44. package/dist/bluetooth/transport.mjs +10 -0
  45. package/dist/bluetooth/vehiclebluetooth.cjs +1272 -0
  46. package/dist/bluetooth/vehiclebluetooth.d.cts +495 -0
  47. package/dist/bluetooth/vehiclebluetooth.d.mts +495 -0
  48. package/dist/bluetooth/vehiclebluetooth.mjs +1270 -0
  49. package/dist/bluetooth/verify.cjs +93 -0
  50. package/dist/bluetooth/verify.d.cts +35 -0
  51. package/dist/bluetooth/verify.d.mts +35 -0
  52. package/dist/bluetooth/verify.mjs +91 -0
  53. package/dist/bluetooth.cjs +52 -0
  54. package/dist/bluetooth.d.cts +10 -0
  55. package/dist/bluetooth.d.mts +10 -0
  56. package/dist/bluetooth.mjs +9 -0
  57. package/dist/commands.cjs +1080 -85
  58. package/dist/commands.d.cts +585 -54
  59. package/dist/commands.d.mts +583 -51
  60. package/dist/commands.mjs +1084 -93
  61. package/dist/const.cjs +22 -0
  62. package/dist/const.d.cts +21 -0
  63. package/dist/const.d.mts +21 -0
  64. package/dist/const.mjs +20 -1
  65. package/dist/energy.cjs +24 -19
  66. package/dist/energy.d.cts +21 -15
  67. package/dist/energy.d.mts +21 -15
  68. package/dist/energy.mjs +24 -19
  69. package/dist/energyisland.cjs +38 -0
  70. package/dist/energyisland.mjs +37 -0
  71. package/dist/energyparsers.cjs +118 -0
  72. package/dist/energyparsers.d.cts +39 -0
  73. package/dist/energyparsers.d.mts +39 -0
  74. package/dist/energyparsers.mjs +116 -0
  75. package/dist/energyspecific.cjs +375 -17
  76. package/dist/energyspecific.d.cts +199 -19
  77. package/dist/energyspecific.d.mts +197 -16
  78. package/dist/energyspecific.mjs +370 -18
  79. package/dist/exceptions.cjs +3 -2
  80. package/dist/exceptions.d.cts +3 -2
  81. package/dist/exceptions.d.mts +3 -2
  82. package/dist/exceptions.mjs +3 -2
  83. package/dist/funnel.cjs +297 -0
  84. package/dist/funnel.d.cts +118 -0
  85. package/dist/funnel.d.mts +118 -0
  86. package/dist/funnel.mjs +292 -0
  87. package/dist/index.cjs +61 -0
  88. package/dist/index.d.cts +22 -8
  89. package/dist/index.d.mts +22 -8
  90. package/dist/index.mjs +19 -6
  91. package/dist/log.cjs +75 -0
  92. package/dist/log.d.cts +4 -0
  93. package/dist/log.d.mts +4 -0
  94. package/dist/log.mjs +71 -0
  95. package/dist/oauth.cjs +143 -0
  96. package/dist/oauth.d.cts +69 -0
  97. package/dist/oauth.d.mts +69 -0
  98. package/dist/oauth.mjs +143 -0
  99. package/dist/powerwall/client.cjs +818 -0
  100. package/dist/powerwall/client.d.cts +297 -0
  101. package/dist/powerwall/client.d.mts +297 -0
  102. package/dist/powerwall/client.mjs +807 -0
  103. package/dist/powerwall/components.cjs +188 -0
  104. package/dist/powerwall/components.d.cts +45 -0
  105. package/dist/powerwall/components.d.mts +45 -0
  106. package/dist/powerwall/components.mjs +182 -0
  107. package/dist/powerwall/energysite.cjs +216 -0
  108. package/dist/powerwall/energysite.d.cts +104 -0
  109. package/dist/powerwall/energysite.d.mts +104 -0
  110. package/dist/powerwall/energysite.mjs +214 -0
  111. package/dist/powerwall/exceptions.cjs +59 -0
  112. package/dist/powerwall/exceptions.d.cts +38 -0
  113. package/dist/powerwall/exceptions.d.mts +38 -0
  114. package/dist/powerwall/exceptions.mjs +51 -0
  115. package/dist/powerwall/gateway.cjs +102 -0
  116. package/dist/powerwall/gateway.d.cts +57 -0
  117. package/dist/powerwall/gateway.d.mts +57 -0
  118. package/dist/powerwall/gateway.mjs +101 -0
  119. package/dist/powerwall/merge.cjs +163 -0
  120. package/dist/powerwall/merge.d.cts +63 -0
  121. package/dist/powerwall/merge.d.mts +63 -0
  122. package/dist/powerwall/merge.mjs +159 -0
  123. package/dist/powerwall/models.d.cts +95 -0
  124. package/dist/powerwall/models.d.mts +95 -0
  125. package/dist/powerwall/queries.cjs +17 -0
  126. package/dist/powerwall/queries.mjs +10 -0
  127. package/dist/powerwall/transport.cjs +232 -0
  128. package/dist/powerwall/transport.mjs +227 -0
  129. package/dist/powerwall.cjs +47 -0
  130. package/dist/powerwall.d.cts +9 -0
  131. package/dist/powerwall.d.mts +9 -0
  132. package/dist/powerwall.mjs +8 -0
  133. package/dist/router/base.cjs +203 -0
  134. package/dist/router/base.d.cts +112 -0
  135. package/dist/router/base.d.mts +112 -0
  136. package/dist/router/base.mjs +200 -0
  137. package/dist/router/energysite.cjs +65 -0
  138. package/dist/router/energysite.d.cts +47 -0
  139. package/dist/router/energysite.d.mts +47 -0
  140. package/dist/router/energysite.mjs +60 -0
  141. package/dist/router.cjs +13 -0
  142. package/dist/router.d.cts +3 -1
  143. package/dist/router.d.mts +3 -1
  144. package/dist/router.mjs +3 -1
  145. package/dist/signing/crypto.cjs +28 -0
  146. package/dist/signing/crypto.mjs +26 -1
  147. package/dist/signing/energy.cjs +123 -0
  148. package/dist/signing/energy.d.cts +45 -0
  149. package/dist/signing/energy.d.mts +45 -0
  150. package/dist/signing/energy.mjs +120 -0
  151. package/dist/signing/jws.cjs +229 -0
  152. package/dist/signing/jws.d.cts +45 -0
  153. package/dist/signing/jws.d.mts +45 -0
  154. package/dist/signing/jws.mjs +211 -0
  155. package/dist/signing/keys.cjs +191 -0
  156. package/dist/signing/keys.d.cts +21 -0
  157. package/dist/signing/keys.d.mts +21 -0
  158. package/dist/signing/keys.mjs +182 -0
  159. package/dist/signing/session.cjs +104 -30
  160. package/dist/signing/session.d.cts +60 -23
  161. package/dist/signing/session.d.mts +60 -23
  162. package/dist/signing/session.mjs +105 -31
  163. package/dist/tariff.cjs +27 -0
  164. package/dist/tariff.d.cts +11 -0
  165. package/dist/tariff.d.mts +11 -0
  166. package/dist/tariff.mjs +27 -1
  167. package/dist/teslafleetapi.cjs +256 -55
  168. package/dist/teslafleetapi.d.cts +110 -14
  169. package/dist/teslafleetapi.d.mts +110 -14
  170. package/dist/teslafleetapi.mjs +258 -57
  171. package/dist/teslemetry.cjs +152 -5
  172. package/dist/teslemetry.d.cts +95 -5
  173. package/dist/teslemetry.d.mts +93 -3
  174. package/dist/teslemetry.mjs +151 -6
  175. package/dist/teslemetryenergy.cjs +287 -0
  176. package/dist/teslemetryenergy.d.cts +154 -0
  177. package/dist/teslemetryenergy.d.mts +154 -0
  178. package/dist/teslemetryenergy.mjs +282 -0
  179. package/dist/teslemetryvehicle.cjs +407 -0
  180. package/dist/teslemetryvehicle.d.cts +238 -0
  181. package/dist/teslemetryvehicle.d.mts +238 -0
  182. package/dist/teslemetryvehicle.mjs +405 -0
  183. package/dist/tessie.cjs +42 -5
  184. package/dist/tessie.d.cts +51 -5
  185. package/dist/tessie.d.mts +49 -3
  186. package/dist/tessie.mjs +42 -5
  187. package/dist/tessievehicle.cjs +514 -0
  188. package/dist/tessievehicle.d.cts +333 -0
  189. package/dist/tessievehicle.d.mts +333 -0
  190. package/dist/tessievehicle.mjs +513 -0
  191. package/dist/types/live_status.d.cts +16 -16
  192. package/dist/types/live_status.d.mts +16 -16
  193. package/dist/types/responses.d.cts +5 -1
  194. package/dist/types/responses.d.mts +5 -1
  195. package/dist/types/vehicle.d.cts +7 -1
  196. package/dist/types/vehicle.d.mts +7 -1
  197. package/dist/types.d.cts +3 -3
  198. package/dist/types.d.mts +3 -3
  199. package/dist/util.cjs +41 -0
  200. package/dist/util.d.cts +18 -0
  201. package/dist/util.d.mts +18 -0
  202. package/dist/util.mjs +40 -0
  203. package/dist/vehicle.cjs +79 -36
  204. package/dist/vehicle.d.cts +42 -26
  205. package/dist/vehicle.d.mts +42 -26
  206. package/dist/vehicle.mjs +80 -37
  207. package/dist/vehiclesigned.cjs +20 -5
  208. package/dist/vehiclesigned.d.cts +14 -5
  209. package/dist/vehiclesigned.d.mts +14 -5
  210. package/dist/vehiclesigned.mjs +20 -5
  211. package/dist/vehiclespecific.cjs +126 -15
  212. package/dist/vehiclespecific.d.cts +82 -18
  213. package/dist/vehiclespecific.d.mts +82 -18
  214. package/dist/vehiclespecific.mjs +126 -15
  215. package/package.json +56 -3
@@ -0,0 +1,238 @@
1
+ import { ClosureState, DistanceUnit, EnergyDisplayFormat, SeatHeaterLevel, SnapshotTopic, TemperatureUnit, TimeDisplayFormat, TirePressureUnit } from "./const.cjs";
2
+ import Teslemetry from "./teslemetry.cjs";
3
+ import Vehicle from "./vehicle.cjs";
4
+ import VehicleSpecific from "./vehiclespecific.cjs";
5
+ type Reply = Record<string, any>;
6
+ /** Telemetry topics: a list, or an already `;`-joined string. Omit for every topic. */
7
+ export type TelemetryTopics = SnapshotTopic[] | string[] | string | null;
8
+ /** What each closure should do. A closure left out, or set to `none`, is not sent. */
9
+ export type ClosureOptions = {
10
+ front_driver_door?: ClosureState;
11
+ front_passenger_door?: ClosureState;
12
+ rear_driver_door?: ClosureState;
13
+ rear_passenger_door?: ClosureState;
14
+ rear_trunk?: ClosureState;
15
+ front_trunk?: ClosureState;
16
+ charge_port?: ClosureState;
17
+ tonneau?: ClosureState;
18
+ };
19
+ /** The heater level for each seat. A seat left out is not sent. */
20
+ export type SeatHeaterOptions = {
21
+ front_left?: SeatHeaterLevel;
22
+ front_right?: SeatHeaterLevel;
23
+ rear_left?: SeatHeaterLevel;
24
+ rear_right?: SeatHeaterLevel;
25
+ rear_left_back?: SeatHeaterLevel;
26
+ rear_center?: SeatHeaterLevel;
27
+ rear_right_back?: SeatHeaterLevel;
28
+ third_row_left?: SeatHeaterLevel;
29
+ third_row_right?: SeatHeaterLevel;
30
+ };
31
+ /** A Teslemetry vehicle: the Fleet REST commands plus Teslemetry's `custom_command` routes. */
32
+ export declare class TeslemetryVehicle extends VehicleSpecific {
33
+ parent: TeslemetryVehicles;
34
+ private _request;
35
+ private _custom_command;
36
+ /**
37
+ * Get or set Auto mode.
38
+ * @deprecated Python marks this for removal in a future release.
39
+ * @param value `true` enables it, `false` disables it, omit to read it.
40
+ */
41
+ server_side_polling(value?: boolean | null): Promise<boolean | undefined>;
42
+ /** Force a refresh of the vehicle data. */
43
+ data_refresh(): Promise<Reply>;
44
+ /** Performs a no-op on the vehicle. */
45
+ ping(): Promise<Reply>;
46
+ /**
47
+ * Open, close, move and stop the vehicle's doors, frunk, trunk, charge port and tonneau.
48
+ * @example await vehicle.closure({ front_trunk: ClosureState.OPEN });
49
+ */
50
+ closure(options?: ClosureOptions): Promise<Reply>;
51
+ /** Opens the rear trunk; unlike `actuate_trunk`, never closes it. */
52
+ open_rear_trunk(): Promise<Reply>;
53
+ /** Closes the rear trunk; unlike `actuate_trunk`, never opens it. */
54
+ close_rear_trunk(): Promise<Reply>;
55
+ /** Opens the tonneau cover. */
56
+ open_tonneau(): Promise<Reply>;
57
+ /** Closes the tonneau cover. */
58
+ close_tonneau(): Promise<Reply>;
59
+ /** Stops the tonneau cover. */
60
+ stop_tonneau(): Promise<Reply>;
61
+ /**
62
+ * Sets multiple seat heaters at once.
63
+ * @example await vehicle.seat_heater({ front_left: SeatHeaterLevel.HIGH });
64
+ */
65
+ seat_heater(options?: SeatHeaterOptions): Promise<Reply>;
66
+ /**
67
+ * Enable or disable charging on solar, and set its charge limits.
68
+ * @param enabled
69
+ * @param lower_charge_limit 0 to `upper_charge_limit`
70
+ * @param upper_charge_limit `lower_charge_limit` to 100
71
+ */
72
+ charge_on_solar(enabled?: boolean, lower_charge_limit?: number, upper_charge_limit?: number): Promise<Reply>;
73
+ /** Gets the current charge-on-solar settings. */
74
+ get_charge_on_solar(): Promise<Reply>;
75
+ /** Save the last 10 minutes of dashcam footage. */
76
+ dashcam_save(): Promise<Reply>;
77
+ /**
78
+ * Play a supported video URL in the vehicle.
79
+ * @param url Video URL, e.g. a YouTube URL.
80
+ */
81
+ play_video(url: string): Promise<Reply>;
82
+ /** Stop the currently playing light show. */
83
+ stop_light_show(): Promise<Reply>;
84
+ /**
85
+ * Start a light show on the vehicle.
86
+ * @param show_index Index of the light show to play.
87
+ * @param start_time Start time in milliseconds since epoch.
88
+ * @param volume Volume level for the light show.
89
+ * @param dance_moves Enable dance moves during the light show.
90
+ */
91
+ start_light_show(show_index: number, start_time?: number, volume?: number, dance_moves?: boolean): Promise<Reply>;
92
+ /**
93
+ * Deactivates PIN to Drive.
94
+ * @param pin 4-digit PIN to clear.
95
+ */
96
+ clear_pin_to_drive(pin: string): Promise<Reply>;
97
+ /** Remove all impermanent keys from the vehicle. */
98
+ remove_key(): Promise<Reply>;
99
+ /**
100
+ * Sets the front zone light level. Named to match the signed sibling for router failover.
101
+ * @param level 0 off, 1 low, 2 medium, 3 high.
102
+ */
103
+ set_front_zone_lights(level: number): Promise<Reply>;
104
+ /**
105
+ * Sets the rear zone light level. Named to match the signed sibling for router failover.
106
+ * @param level 0 off, 1 low, 2 medium, 3 high.
107
+ */
108
+ set_rear_zone_lights(level: number): Promise<Reply>;
109
+ /**
110
+ * Sets outlets on or off.
111
+ * @param request 0 off, 1 cabin and bed, 2 cabin.
112
+ */
113
+ set_outlets(request: number): Promise<Reply>;
114
+ /** Sets the outlet SOC limit percentage. */
115
+ set_outlet_soc_limit(percent: number): Promise<Reply>;
116
+ /**
117
+ * Sets power feed on or off.
118
+ * @param request 0 off, 1 feed 1, 2 feed 2, 3 both.
119
+ */
120
+ set_power_feed(request: number): Promise<Reply>;
121
+ /** Sets the power feed SOC limit percentage. */
122
+ set_power_feed_soc_limit(percent: number): Promise<Reply>;
123
+ /** Sets the lightbar brightness. */
124
+ set_lightbar_brightness(brightness: number): Promise<Reply>;
125
+ /** Enables or disables the lightbar middle light. */
126
+ set_lightbar_middle(on: boolean): Promise<Reply>;
127
+ /** Enables or disables the ditch lights. */
128
+ set_lightbar_ditch(on: boolean): Promise<Reply>;
129
+ /** Starts or stops the trailer light test. */
130
+ set_trailer_light_test(on: boolean): Promise<Reply>;
131
+ /** Sets the truck bed light auto state. */
132
+ set_truck_bed_light_auto(on: boolean): Promise<Reply>;
133
+ /** Sets the truck bed light brightness. */
134
+ set_truck_bed_light_brightness(brightness: number): Promise<Reply>;
135
+ /** Enables or disables the Powershare feature. */
136
+ set_powershare_feature(on: boolean): Promise<Reply>;
137
+ /** Enables or disables an active Powershare session. */
138
+ set_powershare_request(on: boolean): Promise<Reply>;
139
+ /** Sets the Powershare discharge limit percentage. */
140
+ set_powershare_discharge_limit(percent: number): Promise<Reply>;
141
+ /** Sets HVAC recirculation on or off. Named to match the signed sibling for router failover. */
142
+ set_recirculation(on: boolean): Promise<Reply>;
143
+ /** Enables or disables tent mode. */
144
+ set_tent_mode(on: boolean): Promise<Reply>;
145
+ /**
146
+ * Sets the suspension level.
147
+ * @param level 1 entry, 2 low, 3 medium, 4 high, 5 very high, 6 extract.
148
+ */
149
+ set_suspension_level(level: number): Promise<Reply>;
150
+ /** Turns Low Power mode on or off, reducing standby consumption while parked. */
151
+ set_low_power_mode(on: boolean): Promise<Reply>;
152
+ /** Turns Keep Accessory Power mode on or off, keeping 12V accessory power available while parked. */
153
+ set_keep_accessory_power_mode(on: boolean): Promise<Reply>;
154
+ /** Sets the displayed temperature unit. */
155
+ set_temperature_unit(unit: TemperatureUnit | number): Promise<Reply>;
156
+ /** Sets the displayed distance unit. */
157
+ set_distance_unit(unit: DistanceUnit | number): Promise<Reply>;
158
+ /** Sets the displayed clock format (12h or 24h). */
159
+ set_time_display_format(format: TimeDisplayFormat | number): Promise<Reply>;
160
+ /** Sets the displayed tire pressure unit. */
161
+ set_tire_pressure_unit(unit: TirePressureUnit | number): Promise<Reply>;
162
+ /** Sets the displayed energy unit (percentage or distance). */
163
+ set_energy_display_format(format: EnergyDisplayFormat | number): Promise<Reply>;
164
+ /** Activates or deactivates parental controls with a PIN. */
165
+ parental_controls(activate: boolean, pin: string): Promise<Reply>;
166
+ /** Clears the parental controls PIN. */
167
+ parental_controls_clear_pin(pin: string): Promise<Reply>;
168
+ /** Clears the parental controls PIN as admin (fleet manager or owner). */
169
+ parental_controls_clear_pin_admin(): Promise<Reply>;
170
+ /**
171
+ * Enables or disables a parental controls setting.
172
+ * @param setting 1 speed limit, 2 acceleration, 3 safety features, 4 curfew.
173
+ * @param enable
174
+ */
175
+ parental_controls_enable_setting(setting: number, enable: boolean): Promise<Reply>;
176
+ /** Sets the parental controls speed limit. */
177
+ parental_controls_set_speed_limit(limit_mph: number): Promise<Reply>;
178
+ /**
179
+ * Navigates to coordinates with a named destination. Named to match the signed sibling for router failover.
180
+ * @param lat
181
+ * @param lon
182
+ * @param destination
183
+ * @param order Sent as given: on tesla-protocol 6, `RemoteNavTripOrder_E` is 0 replace, 1 prepend, 2 append.
184
+ */
185
+ navigation_gps_destination_request(lat: number, lon: number, destination: string, order: number): Promise<Reply>;
186
+ /** Auto-secures the vehicle: locks it, closes windows, and so on. */
187
+ auto_secure_vehicle(): Promise<Reply>;
188
+ /** Cancels a State of Health test. */
189
+ cancel_soh_test(): Promise<Reply>;
190
+ /** Returns the charging sites near the vehicle's current location. */
191
+ get_nearby_charging_sites(count?: number, radius?: number, detail?: boolean): Promise<Reply>;
192
+ /** Gets the current time-of-use rate tariff schedule. */
193
+ get_rate_tariff(): Promise<Reply>;
194
+ /**
195
+ * Triggers a time-of-use rate tariff update, with no schedule payload.
196
+ * Deliberately not named `set_rate_tariff`: the signed sibling takes a
197
+ * required schedule, which a router failing over here would silently drop.
198
+ */
199
+ trigger_rate_tariff_update(): Promise<Reply>;
200
+ /**
201
+ * Gets a snapshot of cached vehicle telemetry.
202
+ * @param topics Topics to include.
203
+ * @param cursor Return only what changed since this cursor.
204
+ */
205
+ telemetry(topics?: TelemetryTopics, cursor?: number | null): Promise<Reply>;
206
+ /** Creates a cursor-aware reader of this vehicle's cached telemetry. */
207
+ create_telemetry_tracker(topics?: TelemetryTopics): TeslemetryVehicleTelemetry;
208
+ }
209
+ /** A cursor-aware vehicle telemetry reader, keeping a snapshot merged from each update. */
210
+ export declare class TeslemetryVehicleTelemetry {
211
+ /** The cursor the next `update()` sends. */
212
+ cursor: number;
213
+ /** Everything received so far. `data` merges field by field; other topics are replaced whole. */
214
+ snapshot: Record<string, any>;
215
+ private readonly _parent;
216
+ private readonly _topics;
217
+ constructor(parent: TeslemetryVehicle, topics?: TelemetryTopics);
218
+ /**
219
+ * Get the changes since the last update, and merge them into `snapshot`.
220
+ * @returns The update's `response`.
221
+ * @throws InvalidResponse when the update has an empty `response`, or no `cursor`.
222
+ */
223
+ update(): Promise<Reply>;
224
+ }
225
+ /** Creates `TeslemetryVehicle`s. Teslemetry cannot use the Fleet API directly, so `create` is the only factory. */
226
+ export declare class TeslemetryVehicles extends Vehicle {
227
+ /** Class `create` instantiates; a subclass overrides it to supply its own vehicle type. */
228
+ static Vehicle: new (parent: Vehicle, vin: string) => TeslemetryVehicle;
229
+ parent: Teslemetry;
230
+ byVin: Map<string, TeslemetryVehicle>;
231
+ readonly createFleet: never;
232
+ readonly createSigned: never;
233
+ readonly specific: never;
234
+ readonly specificSigned: never;
235
+ /** Creates a vehicle, and records it by VIN. */
236
+ create(vin: string): TeslemetryVehicle;
237
+ }
238
+ export {};
@@ -0,0 +1,238 @@
1
+ import { ClosureState, DistanceUnit, EnergyDisplayFormat, SeatHeaterLevel, SnapshotTopic, TemperatureUnit, TimeDisplayFormat, TirePressureUnit } from "./const.mjs";
2
+ import Teslemetry from "./teslemetry.mjs";
3
+ import Vehicle from "./vehicle.mjs";
4
+ import VehicleSpecific from "./vehiclespecific.mjs";
5
+ type Reply = Record<string, any>;
6
+ /** Telemetry topics: a list, or an already `;`-joined string. Omit for every topic. */
7
+ export type TelemetryTopics = SnapshotTopic[] | string[] | string | null;
8
+ /** What each closure should do. A closure left out, or set to `none`, is not sent. */
9
+ export type ClosureOptions = {
10
+ front_driver_door?: ClosureState;
11
+ front_passenger_door?: ClosureState;
12
+ rear_driver_door?: ClosureState;
13
+ rear_passenger_door?: ClosureState;
14
+ rear_trunk?: ClosureState;
15
+ front_trunk?: ClosureState;
16
+ charge_port?: ClosureState;
17
+ tonneau?: ClosureState;
18
+ };
19
+ /** The heater level for each seat. A seat left out is not sent. */
20
+ export type SeatHeaterOptions = {
21
+ front_left?: SeatHeaterLevel;
22
+ front_right?: SeatHeaterLevel;
23
+ rear_left?: SeatHeaterLevel;
24
+ rear_right?: SeatHeaterLevel;
25
+ rear_left_back?: SeatHeaterLevel;
26
+ rear_center?: SeatHeaterLevel;
27
+ rear_right_back?: SeatHeaterLevel;
28
+ third_row_left?: SeatHeaterLevel;
29
+ third_row_right?: SeatHeaterLevel;
30
+ };
31
+ /** A Teslemetry vehicle: the Fleet REST commands plus Teslemetry's `custom_command` routes. */
32
+ export declare class TeslemetryVehicle extends VehicleSpecific {
33
+ parent: TeslemetryVehicles;
34
+ private _request;
35
+ private _custom_command;
36
+ /**
37
+ * Get or set Auto mode.
38
+ * @deprecated Python marks this for removal in a future release.
39
+ * @param value `true` enables it, `false` disables it, omit to read it.
40
+ */
41
+ server_side_polling(value?: boolean | null): Promise<boolean | undefined>;
42
+ /** Force a refresh of the vehicle data. */
43
+ data_refresh(): Promise<Reply>;
44
+ /** Performs a no-op on the vehicle. */
45
+ ping(): Promise<Reply>;
46
+ /**
47
+ * Open, close, move and stop the vehicle's doors, frunk, trunk, charge port and tonneau.
48
+ * @example await vehicle.closure({ front_trunk: ClosureState.OPEN });
49
+ */
50
+ closure(options?: ClosureOptions): Promise<Reply>;
51
+ /** Opens the rear trunk; unlike `actuate_trunk`, never closes it. */
52
+ open_rear_trunk(): Promise<Reply>;
53
+ /** Closes the rear trunk; unlike `actuate_trunk`, never opens it. */
54
+ close_rear_trunk(): Promise<Reply>;
55
+ /** Opens the tonneau cover. */
56
+ open_tonneau(): Promise<Reply>;
57
+ /** Closes the tonneau cover. */
58
+ close_tonneau(): Promise<Reply>;
59
+ /** Stops the tonneau cover. */
60
+ stop_tonneau(): Promise<Reply>;
61
+ /**
62
+ * Sets multiple seat heaters at once.
63
+ * @example await vehicle.seat_heater({ front_left: SeatHeaterLevel.HIGH });
64
+ */
65
+ seat_heater(options?: SeatHeaterOptions): Promise<Reply>;
66
+ /**
67
+ * Enable or disable charging on solar, and set its charge limits.
68
+ * @param enabled
69
+ * @param lower_charge_limit 0 to `upper_charge_limit`
70
+ * @param upper_charge_limit `lower_charge_limit` to 100
71
+ */
72
+ charge_on_solar(enabled?: boolean, lower_charge_limit?: number, upper_charge_limit?: number): Promise<Reply>;
73
+ /** Gets the current charge-on-solar settings. */
74
+ get_charge_on_solar(): Promise<Reply>;
75
+ /** Save the last 10 minutes of dashcam footage. */
76
+ dashcam_save(): Promise<Reply>;
77
+ /**
78
+ * Play a supported video URL in the vehicle.
79
+ * @param url Video URL, e.g. a YouTube URL.
80
+ */
81
+ play_video(url: string): Promise<Reply>;
82
+ /** Stop the currently playing light show. */
83
+ stop_light_show(): Promise<Reply>;
84
+ /**
85
+ * Start a light show on the vehicle.
86
+ * @param show_index Index of the light show to play.
87
+ * @param start_time Start time in milliseconds since epoch.
88
+ * @param volume Volume level for the light show.
89
+ * @param dance_moves Enable dance moves during the light show.
90
+ */
91
+ start_light_show(show_index: number, start_time?: number, volume?: number, dance_moves?: boolean): Promise<Reply>;
92
+ /**
93
+ * Deactivates PIN to Drive.
94
+ * @param pin 4-digit PIN to clear.
95
+ */
96
+ clear_pin_to_drive(pin: string): Promise<Reply>;
97
+ /** Remove all impermanent keys from the vehicle. */
98
+ remove_key(): Promise<Reply>;
99
+ /**
100
+ * Sets the front zone light level. Named to match the signed sibling for router failover.
101
+ * @param level 0 off, 1 low, 2 medium, 3 high.
102
+ */
103
+ set_front_zone_lights(level: number): Promise<Reply>;
104
+ /**
105
+ * Sets the rear zone light level. Named to match the signed sibling for router failover.
106
+ * @param level 0 off, 1 low, 2 medium, 3 high.
107
+ */
108
+ set_rear_zone_lights(level: number): Promise<Reply>;
109
+ /**
110
+ * Sets outlets on or off.
111
+ * @param request 0 off, 1 cabin and bed, 2 cabin.
112
+ */
113
+ set_outlets(request: number): Promise<Reply>;
114
+ /** Sets the outlet SOC limit percentage. */
115
+ set_outlet_soc_limit(percent: number): Promise<Reply>;
116
+ /**
117
+ * Sets power feed on or off.
118
+ * @param request 0 off, 1 feed 1, 2 feed 2, 3 both.
119
+ */
120
+ set_power_feed(request: number): Promise<Reply>;
121
+ /** Sets the power feed SOC limit percentage. */
122
+ set_power_feed_soc_limit(percent: number): Promise<Reply>;
123
+ /** Sets the lightbar brightness. */
124
+ set_lightbar_brightness(brightness: number): Promise<Reply>;
125
+ /** Enables or disables the lightbar middle light. */
126
+ set_lightbar_middle(on: boolean): Promise<Reply>;
127
+ /** Enables or disables the ditch lights. */
128
+ set_lightbar_ditch(on: boolean): Promise<Reply>;
129
+ /** Starts or stops the trailer light test. */
130
+ set_trailer_light_test(on: boolean): Promise<Reply>;
131
+ /** Sets the truck bed light auto state. */
132
+ set_truck_bed_light_auto(on: boolean): Promise<Reply>;
133
+ /** Sets the truck bed light brightness. */
134
+ set_truck_bed_light_brightness(brightness: number): Promise<Reply>;
135
+ /** Enables or disables the Powershare feature. */
136
+ set_powershare_feature(on: boolean): Promise<Reply>;
137
+ /** Enables or disables an active Powershare session. */
138
+ set_powershare_request(on: boolean): Promise<Reply>;
139
+ /** Sets the Powershare discharge limit percentage. */
140
+ set_powershare_discharge_limit(percent: number): Promise<Reply>;
141
+ /** Sets HVAC recirculation on or off. Named to match the signed sibling for router failover. */
142
+ set_recirculation(on: boolean): Promise<Reply>;
143
+ /** Enables or disables tent mode. */
144
+ set_tent_mode(on: boolean): Promise<Reply>;
145
+ /**
146
+ * Sets the suspension level.
147
+ * @param level 1 entry, 2 low, 3 medium, 4 high, 5 very high, 6 extract.
148
+ */
149
+ set_suspension_level(level: number): Promise<Reply>;
150
+ /** Turns Low Power mode on or off, reducing standby consumption while parked. */
151
+ set_low_power_mode(on: boolean): Promise<Reply>;
152
+ /** Turns Keep Accessory Power mode on or off, keeping 12V accessory power available while parked. */
153
+ set_keep_accessory_power_mode(on: boolean): Promise<Reply>;
154
+ /** Sets the displayed temperature unit. */
155
+ set_temperature_unit(unit: TemperatureUnit | number): Promise<Reply>;
156
+ /** Sets the displayed distance unit. */
157
+ set_distance_unit(unit: DistanceUnit | number): Promise<Reply>;
158
+ /** Sets the displayed clock format (12h or 24h). */
159
+ set_time_display_format(format: TimeDisplayFormat | number): Promise<Reply>;
160
+ /** Sets the displayed tire pressure unit. */
161
+ set_tire_pressure_unit(unit: TirePressureUnit | number): Promise<Reply>;
162
+ /** Sets the displayed energy unit (percentage or distance). */
163
+ set_energy_display_format(format: EnergyDisplayFormat | number): Promise<Reply>;
164
+ /** Activates or deactivates parental controls with a PIN. */
165
+ parental_controls(activate: boolean, pin: string): Promise<Reply>;
166
+ /** Clears the parental controls PIN. */
167
+ parental_controls_clear_pin(pin: string): Promise<Reply>;
168
+ /** Clears the parental controls PIN as admin (fleet manager or owner). */
169
+ parental_controls_clear_pin_admin(): Promise<Reply>;
170
+ /**
171
+ * Enables or disables a parental controls setting.
172
+ * @param setting 1 speed limit, 2 acceleration, 3 safety features, 4 curfew.
173
+ * @param enable
174
+ */
175
+ parental_controls_enable_setting(setting: number, enable: boolean): Promise<Reply>;
176
+ /** Sets the parental controls speed limit. */
177
+ parental_controls_set_speed_limit(limit_mph: number): Promise<Reply>;
178
+ /**
179
+ * Navigates to coordinates with a named destination. Named to match the signed sibling for router failover.
180
+ * @param lat
181
+ * @param lon
182
+ * @param destination
183
+ * @param order Sent as given: on tesla-protocol 6, `RemoteNavTripOrder_E` is 0 replace, 1 prepend, 2 append.
184
+ */
185
+ navigation_gps_destination_request(lat: number, lon: number, destination: string, order: number): Promise<Reply>;
186
+ /** Auto-secures the vehicle: locks it, closes windows, and so on. */
187
+ auto_secure_vehicle(): Promise<Reply>;
188
+ /** Cancels a State of Health test. */
189
+ cancel_soh_test(): Promise<Reply>;
190
+ /** Returns the charging sites near the vehicle's current location. */
191
+ get_nearby_charging_sites(count?: number, radius?: number, detail?: boolean): Promise<Reply>;
192
+ /** Gets the current time-of-use rate tariff schedule. */
193
+ get_rate_tariff(): Promise<Reply>;
194
+ /**
195
+ * Triggers a time-of-use rate tariff update, with no schedule payload.
196
+ * Deliberately not named `set_rate_tariff`: the signed sibling takes a
197
+ * required schedule, which a router failing over here would silently drop.
198
+ */
199
+ trigger_rate_tariff_update(): Promise<Reply>;
200
+ /**
201
+ * Gets a snapshot of cached vehicle telemetry.
202
+ * @param topics Topics to include.
203
+ * @param cursor Return only what changed since this cursor.
204
+ */
205
+ telemetry(topics?: TelemetryTopics, cursor?: number | null): Promise<Reply>;
206
+ /** Creates a cursor-aware reader of this vehicle's cached telemetry. */
207
+ create_telemetry_tracker(topics?: TelemetryTopics): TeslemetryVehicleTelemetry;
208
+ }
209
+ /** A cursor-aware vehicle telemetry reader, keeping a snapshot merged from each update. */
210
+ export declare class TeslemetryVehicleTelemetry {
211
+ /** The cursor the next `update()` sends. */
212
+ cursor: number;
213
+ /** Everything received so far. `data` merges field by field; other topics are replaced whole. */
214
+ snapshot: Record<string, any>;
215
+ private readonly _parent;
216
+ private readonly _topics;
217
+ constructor(parent: TeslemetryVehicle, topics?: TelemetryTopics);
218
+ /**
219
+ * Get the changes since the last update, and merge them into `snapshot`.
220
+ * @returns The update's `response`.
221
+ * @throws InvalidResponse when the update has an empty `response`, or no `cursor`.
222
+ */
223
+ update(): Promise<Reply>;
224
+ }
225
+ /** Creates `TeslemetryVehicle`s. Teslemetry cannot use the Fleet API directly, so `create` is the only factory. */
226
+ export declare class TeslemetryVehicles extends Vehicle {
227
+ /** Class `create` instantiates; a subclass overrides it to supply its own vehicle type. */
228
+ static Vehicle: new (parent: Vehicle, vin: string) => TeslemetryVehicle;
229
+ parent: Teslemetry;
230
+ byVin: Map<string, TeslemetryVehicle>;
231
+ readonly createFleet: never;
232
+ readonly createSigned: never;
233
+ readonly specific: never;
234
+ readonly specificSigned: never;
235
+ /** Creates a vehicle, and records it by VIN. */
236
+ create(vin: string): TeslemetryVehicle;
237
+ }
238
+ export {};