tesla-fleet-api 0.3.2__py3-none-any.whl → 0.4.0__py3-none-any.whl

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.
@@ -1,13 +1,15 @@
1
1
  from typing import Any, List
2
2
  from .const import (
3
- Methods,
4
- Trunks,
3
+ Method,
4
+ Trunk,
5
5
  ClimateKeeperMode,
6
- CabinOverheatProtectionTemps,
7
- VehicleDataEndpoints,
8
- SunRoofCommands,
9
- WindowCommands,
10
- DeviceTypes,
6
+ CabinOverheatProtectionTemp,
7
+ VehicleDataEndpoint,
8
+ SunRoofCommand,
9
+ WindowCommand,
10
+ DeviceType,
11
+ Seat,
12
+ Level,
11
13
  )
12
14
  from .vehiclespecific import VehicleSpecific
13
15
 
@@ -24,11 +26,11 @@ class Vehicle:
24
26
  return VehicleSpecific(self, vehicle_tag)
25
27
 
26
28
  async def actuate_trunk(
27
- self, vehicle_tag: str | int, which_trunk: Trunks | str
29
+ self, vehicle_tag: str | int, which_trunk: Trunk | str
28
30
  ) -> dict[str, Any]:
29
31
  """Controls the front or rear trunk."""
30
32
  return await self._request(
31
- Methods.POST,
33
+ Method.POST,
32
34
  f"api/1/vehicles/{vehicle_tag}/command/actuate_trunk",
33
35
  json={"which_trunk": which_trunk},
34
36
  )
@@ -40,7 +42,7 @@ class Vehicle:
40
42
  if volume < 0.0 or volume > 11.0:
41
43
  raise ValueError("Volume must a number from 0.0 to 11.0")
42
44
  return await self._request(
43
- Methods.POST,
45
+ Method.POST,
44
46
  f"api/1/vehicles/{vehicle_tag}/command/adjust_volume",
45
47
  json={"volume": volume},
46
48
  )
@@ -48,97 +50,97 @@ class Vehicle:
48
50
  async def auto_conditioning_start(self, vehicle_tag: str | int) -> dict[str, Any]:
49
51
  """Starts climate preconditioning."""
50
52
  return await self._request(
51
- Methods.POST,
53
+ Method.POST,
52
54
  f"api/1/vehicles/{vehicle_tag}/command/auto_conditioning_start",
53
55
  )
54
56
 
55
57
  async def auto_conditioning_stop(self, vehicle_tag: str | int) -> dict[str, Any]:
56
58
  """Stops climate preconditioning."""
57
59
  return await self._request(
58
- Methods.POST,
60
+ Method.POST,
59
61
  f"api/1/vehicles/{vehicle_tag}/command/auto_conditioning_stop",
60
62
  )
61
63
 
62
64
  async def cancel_software_update(self, vehicle_tag: str | int) -> dict[str, Any]:
63
65
  """Cancels the countdown to install the vehicle software update."""
64
66
  return await self._request(
65
- Methods.POST,
67
+ Method.POST,
66
68
  f"api/1/vehicles/{vehicle_tag}/command/cancel_software_update",
67
69
  )
68
70
 
69
71
  async def charge_max_range(self, vehicle_tag: str | int) -> dict[str, Any]:
70
72
  """Charges in max range mode -- we recommend limiting the use of this mode to long trips."""
71
73
  return await self._request(
72
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/charge_max_range"
74
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/charge_max_range"
73
75
  )
74
76
 
75
77
  async def charge_port_door_close(self, vehicle_tag: str | int) -> dict[str, Any]:
76
78
  """Closes the charge port door."""
77
79
  return await self._request(
78
- Methods.POST,
80
+ Method.POST,
79
81
  f"api/1/vehicles/{vehicle_tag}/command/charge_port_door_close",
80
82
  )
81
83
 
82
84
  async def charge_port_door_open(self, vehicle_tag: str | int) -> dict[str, Any]:
83
85
  """Opens the charge port door."""
84
86
  return await self._request(
85
- Methods.POST,
87
+ Method.POST,
86
88
  f"api/1/vehicles/{vehicle_tag}/command/charge_port_door_open",
87
89
  )
88
90
 
89
91
  async def charge_standard(self, vehicle_tag: str | int) -> dict[str, Any]:
90
92
  """Charges in Standard mode."""
91
93
  return await self._request(
92
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/charge_standard"
94
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/charge_standard"
93
95
  )
94
96
 
95
97
  async def charge_start(self, vehicle_tag: str | int) -> dict[str, Any]:
96
98
  """Starts charging the vehicle."""
97
99
  return await self._request(
98
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/charge_start"
100
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/charge_start"
99
101
  )
100
102
 
101
103
  async def charge_stop(self, vehicle_tag: str | int) -> dict[str, Any]:
102
104
  """Stops charging the vehicle."""
103
105
  return await self._request(
104
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/charge_stop"
106
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/charge_stop"
105
107
  )
106
108
 
107
109
  async def clear_pin_to_drive_admin(self, vehicle_tag: str | int):
108
110
  """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."""
109
111
  return await self._request(
110
- Methods.POST,
112
+ Method.POST,
111
113
  f"api/1/vehicles/{vehicle_tag}/command/clear_pin_to_drive_admin",
112
114
  )
113
115
 
114
116
  async def door_lock(self, vehicle_tag: str | int) -> dict[str, Any]:
115
117
  """Locks the vehicle."""
116
118
  return await self._request(
117
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/door_lock"
119
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/door_lock"
118
120
  )
119
121
 
120
122
  async def door_unlock(self, vehicle_tag: str | int) -> dict[str, Any]:
121
123
  """Unlocks the vehicle."""
122
124
  return await self._request(
123
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/door_unlock"
125
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/door_unlock"
124
126
  )
125
127
 
126
128
  async def erase_user_data(self, vehicle_tag: str | int) -> dict[str, Any]:
127
129
  """Erases user's data from the user interface. Requires the vehicle to be in park."""
128
130
  return await self._request(
129
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/erase_user_data"
131
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/erase_user_data"
130
132
  )
131
133
 
132
134
  async def flash_lights(self, vehicle_tag: str | int) -> dict[str, Any]:
133
135
  """Briefly flashes the vehicle headlights. Requires the vehicle to be in park."""
134
136
  return await self._request(
135
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/flash_lights"
137
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/flash_lights"
136
138
  )
137
139
 
138
140
  async def guest_mode(self, vehicle_tag: str | int, enable: bool) -> dict[str, Any]:
139
141
  """Restricts certain vehicle UI functionality from guest users"""
140
142
  return await self._request(
141
- Methods.POST,
143
+ Method.POST,
142
144
  f"api/1/vehicles/{vehicle_tag}/command/guest_mode",
143
145
  json={"enable": enable},
144
146
  )
@@ -146,44 +148,44 @@ class Vehicle:
146
148
  async def honk_horn(self, vehicle_tag: str | int) -> dict[str, Any]:
147
149
  """Honks the vehicle horn. Requires the vehicle to be in park."""
148
150
  return await self._request(
149
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/honk_horn"
151
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/honk_horn"
150
152
  )
151
153
 
152
154
  async def media_next_fav(self, vehicle_tag: str | int) -> dict[str, Any]:
153
155
  """Advances media player to next favorite track."""
154
156
  return await self._request(
155
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/media_next_fav"
157
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/media_next_fav"
156
158
  )
157
159
 
158
160
  async def media_next_track(self, vehicle_tag: str | int) -> dict[str, Any]:
159
161
  """Advances media player to next track."""
160
162
  return await self._request(
161
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/media_next_track"
163
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/media_next_track"
162
164
  )
163
165
 
164
166
  async def media_prev_fav(self, vehicle_tag: str | int) -> dict[str, Any]:
165
167
  """Advances media player to previous favorite track."""
166
168
  return await self._request(
167
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/media_prev_fav"
169
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/media_prev_fav"
168
170
  )
169
171
 
170
172
  async def media_prev_track(self, vehicle_tag: str | int) -> dict[str, Any]:
171
173
  """Advances media player to previous track."""
172
174
  return await self._request(
173
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/media_prev_track"
175
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/media_prev_track"
174
176
  )
175
177
 
176
178
  async def media_toggle_playback(self, vehicle_tag: str | int) -> dict[str, Any]:
177
179
  """Toggles current play/pause state."""
178
180
  return await self._request(
179
- Methods.POST,
181
+ Method.POST,
180
182
  f"api/1/vehicles/{vehicle_tag}/command/media_toggle_playback",
181
183
  )
182
184
 
183
185
  async def media_volume_down(self, vehicle_tag: str | int) -> dict[str, Any]:
184
186
  """Turns the volume down by one."""
185
187
  return await self._request(
186
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/media_volume_down"
188
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/media_volume_down"
187
189
  )
188
190
 
189
191
  async def navigation_gps_request(
@@ -191,7 +193,7 @@ class Vehicle:
191
193
  ) -> dict[str, Any]:
192
194
  """Start navigation to given coordinates. Order can be used to specify order of multiple stops."""
193
195
  return await self._request(
194
- Methods.POST,
196
+ Method.POST,
195
197
  f"api/1/vehicles/{vehicle_tag}/command/navigation_gps_request",
196
198
  json={"lat": lat, "lon": lon, "order": order},
197
199
  )
@@ -201,7 +203,7 @@ class Vehicle:
201
203
  ) -> dict[str, Any]:
202
204
  """Sends a location to the in-vehicle navigation system."""
203
205
  return await self._request(
204
- Methods.POST,
206
+ Method.POST,
205
207
  f"api/1/vehicles/{vehicle_tag}/command/navigation_request",
206
208
  json={"type": type, "locale": locale, "timestamp_ms": timestamp_ms},
207
209
  )
@@ -211,17 +213,20 @@ class Vehicle:
211
213
  ) -> dict[str, Any]:
212
214
  """Sends a location to the in-vehicle navigation system."""
213
215
  return await self._request(
214
- Methods.POST,
216
+ Method.POST,
215
217
  f"api/1/vehicles/{vehicle_tag}/command/navigation_sc_request",
216
218
  json={"type": type, "id": id, "order": order},
217
219
  )
218
220
 
219
221
  async def remote_auto_seat_climate_request(
220
- self, vehicle_tag: str | int, auto_seat_position: int, auto_climate_on: bool
222
+ self,
223
+ vehicle_tag: str | int,
224
+ auto_seat_position: int | Seat,
225
+ auto_climate_on: bool,
221
226
  ) -> dict[str, Any]:
222
227
  """Sets automatic seat heating and cooling."""
223
228
  return await self._request(
224
- Methods.POST,
229
+ Method.POST,
225
230
  f"api/1/vehicles/{vehicle_tag}/command/remote_auto_seat_climate_request",
226
231
  json={
227
232
  "auto_seat_position": auto_seat_position,
@@ -234,7 +239,7 @@ class Vehicle:
234
239
  ) -> dict[str, Any]:
235
240
  """Sets automatic steering wheel heating on/off."""
236
241
  return await self._request(
237
- Methods.POST,
242
+ Method.POST,
238
243
  f"api/1/vehicles/{vehicle_tag}/command/remote_auto_steering_wheel_heat_climate_request",
239
244
  json={"on": on},
240
245
  )
@@ -244,17 +249,20 @@ class Vehicle:
244
249
  ) -> dict[str, Any]:
245
250
  """Plays a sound through the vehicle external speaker."""
246
251
  return await self._request(
247
- Methods.POST,
252
+ Method.POST,
248
253
  f"api/1/vehicles/{vehicle_tag}/command/remote_boombox",
249
254
  json={"sound": sound},
250
255
  )
251
256
 
252
257
  async def remote_seat_cooler_request(
253
- self, vehicle_tag: str | int, seat_position: int, seat_cooler_level: int
258
+ self,
259
+ vehicle_tag: str | int,
260
+ seat_position: Seat | int,
261
+ seat_cooler_level: Level | int,
254
262
  ) -> dict[str, Any]:
255
263
  """Sets seat cooling."""
256
264
  return await self._request(
257
- Methods.POST,
265
+ Method.POST,
258
266
  f"api/1/vehicles/{vehicle_tag}/command/remote_seat_cooler_request",
259
267
  json={
260
268
  "seat_position": seat_position,
@@ -263,30 +271,33 @@ class Vehicle:
263
271
  )
264
272
 
265
273
  async def remote_seat_heater_request(
266
- self, vehicle_tag: str | int, seat_position: int, level: int
274
+ self,
275
+ vehicle_tag: str | int,
276
+ seat_position: Seat | int,
277
+ seat_heater_level: Level | int,
267
278
  ) -> dict[str, Any]:
268
279
  """Sets seat heating."""
269
280
  return await self._request(
270
- Methods.POST,
281
+ Method.POST,
271
282
  f"api/1/vehicles/{vehicle_tag}/command/remote_seat_heater_request",
272
283
  json={
273
- "seat_position": seat_position,
274
- "level": level,
284
+ "heater": seat_position,
285
+ "level": seat_heater_level,
275
286
  },
276
287
  )
277
288
 
278
289
  async def remote_start_drive(self, vehicle_tag: str | int) -> dict[str, Any]:
279
290
  """Starts the vehicle remotely. Requires keyless driving to be enabled."""
280
291
  return await self._request(
281
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/remote_start_drive"
292
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/remote_start_drive"
282
293
  )
283
294
 
284
295
  async def remote_steering_wheel_heat_level_request(
285
- self, vehicle_tag: str | int, level: int
296
+ self, vehicle_tag: str | int, level: Level | int
286
297
  ) -> dict[str, Any]:
287
298
  """Sets steering wheel heat level."""
288
299
  return await self._request(
289
- Methods.POST,
300
+ Method.POST,
290
301
  f"api/1/vehicles/{vehicle_tag}/command/remote_steering_wheel_heat_level_request",
291
302
  json={"level": level},
292
303
  )
@@ -296,7 +307,7 @@ class Vehicle:
296
307
  ) -> dict[str, Any]:
297
308
  """Sets steering wheel heating on/off. For vehicles that do not support auto steering wheel heat."""
298
309
  return await self._request(
299
- Methods.POST,
310
+ Method.POST,
300
311
  f"api/1/vehicles/{vehicle_tag}/command/remote_steering_wheel_heater_request",
301
312
  json={"on": on},
302
313
  )
@@ -304,14 +315,14 @@ class Vehicle:
304
315
  async def reset_pin_to_drive_pin(self, vehicle_tag: str | int) -> dict[str, Any]:
305
316
  """Removes PIN to Drive. Requires the car to be in Pin to Drive mode and not in Valet mode. Note that this only works if PIN to Drive is not active. This command also requires the Tesla Vehicle Command Protocol - for more information, please see refer to the documentation here."""
306
317
  return await self._request(
307
- Methods.POST,
318
+ Method.POST,
308
319
  f"api/1/vehicles/{vehicle_tag}/command/reset_pin_to_drive_pin",
309
320
  )
310
321
 
311
322
  async def reset_valet_pin(self, vehicle_tag: str | int) -> dict[str, Any]:
312
323
  """Removes PIN for Valet Mode."""
313
324
  return await self._request(
314
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/command/reset_valet_pin"
325
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/command/reset_valet_pin"
315
326
  )
316
327
 
317
328
  async def schedule_software_update(
@@ -319,7 +330,7 @@ class Vehicle:
319
330
  ) -> dict[str, Any]:
320
331
  """Schedules a vehicle software update (over the air "OTA") to be installed in the future."""
321
332
  return await self._request(
322
- Methods.POST,
333
+ Method.POST,
323
334
  f"api/1/vehicles/{vehicle_tag}/command/schedule_software_update",
324
335
  json={"offset_sec": offset_sec},
325
336
  )
@@ -329,7 +340,7 @@ class Vehicle:
329
340
  ) -> dict[str, Any]:
330
341
  """Turns Bioweapon Defense Mode on and off."""
331
342
  return await self._request(
332
- Methods.POST,
343
+ Method.POST,
333
344
  f"api/1/vehicles/{vehicle_tag}/command/set_bioweapon_mode",
334
345
  json={"on": on, "manual_override": manual_override},
335
346
  )
@@ -339,7 +350,7 @@ class Vehicle:
339
350
  ) -> dict[str, Any]:
340
351
  """Sets the vehicle overheat protection."""
341
352
  return await self._request(
342
- Methods.POST,
353
+ Method.POST,
343
354
  f"api/1/vehicles/{vehicle_tag}/command/set_cabin_overheat_protection",
344
355
  json={"on": on, "fan_only": fan_only},
345
356
  )
@@ -349,7 +360,7 @@ class Vehicle:
349
360
  ) -> dict[str, Any]:
350
361
  """Sets the vehicle charge limit."""
351
362
  return await self._request(
352
- Methods.POST,
363
+ Method.POST,
353
364
  f"api/1/vehicles/{vehicle_tag}/command/set_charge_limit",
354
365
  json={"percent": percent},
355
366
  )
@@ -359,7 +370,7 @@ class Vehicle:
359
370
  ) -> dict[str, Any]:
360
371
  """Sets the vehicle charging amps."""
361
372
  return await self._request(
362
- Methods.POST,
373
+ Method.POST,
363
374
  f"api/1/vehicles/{vehicle_tag}/command/set_charging_amps",
364
375
  json={"charging_amps": charging_amps},
365
376
  )
@@ -369,17 +380,17 @@ class Vehicle:
369
380
  ) -> dict[str, Any]:
370
381
  """Enables climate keeper mode."""
371
382
  return await self._request(
372
- Methods.POST,
383
+ Method.POST,
373
384
  f"api/1/vehicles/{vehicle_tag}/command/set_climate_keeper_mode",
374
385
  json={"climate_keeper_mode": climate_keeper_mode},
375
386
  )
376
387
 
377
388
  async def set_cop_temp(
378
- self, vehicle_tag: str | int, cop_temp: CabinOverheatProtectionTemps | int
389
+ self, vehicle_tag: str | int, cop_temp: CabinOverheatProtectionTemp | int
379
390
  ) -> dict[str, Any]:
380
391
  """Adjusts the Cabin Overheat Protection temperature (COP)."""
381
392
  return await self._request(
382
- Methods.POST,
393
+ Method.POST,
383
394
  f"api/1/vehicles/{vehicle_tag}/command/set_cop_temp",
384
395
  json={"cop_temp": cop_temp},
385
396
  )
@@ -389,7 +400,7 @@ class Vehicle:
389
400
  ) -> dict[str, Any]:
390
401
  """Sets a four-digit passcode for PIN to Drive. This PIN must then be entered before the vehicle can be driven."""
391
402
  return await self._request(
392
- Methods.POST,
403
+ Method.POST,
393
404
  f"api/1/vehicles/{vehicle_tag}/command/set_pin_to_drive",
394
405
  json={"on": on, "password": str(password)},
395
406
  )
@@ -399,7 +410,7 @@ class Vehicle:
399
410
  ) -> dict[str, Any]:
400
411
  """Sets an override for preconditioning — it should default to empty if no override is used."""
401
412
  return await self._request(
402
- Methods.POST,
413
+ Method.POST,
403
414
  f"api/1/vehicles/{vehicle_tag}/command/set_preconditioning_max",
404
415
  json={"on": on, "manual_override": manual_override},
405
416
  )
@@ -409,7 +420,7 @@ class Vehicle:
409
420
  ) -> dict[str, Any]:
410
421
  """Sets a time at which charging should be completed. The time parameter is minutes after midnight (e.g: time=120 schedules charging for 2:00am vehicle local time)."""
411
422
  return await self._request(
412
- Methods.POST,
423
+ Method.POST,
413
424
  f"api/1/vehicles/{vehicle_tag}/command/set_scheduled_charging",
414
425
  json={"enable": enable, "time": time},
415
426
  )
@@ -419,7 +430,7 @@ class Vehicle:
419
430
  ) -> dict[str, Any]:
420
431
  """Sets a time at which departure should be completed. The time parameter is minutes after midnight (e.g: time=120 schedules departure for 2:00am vehicle local time)."""
421
432
  return await self._request(
422
- Methods.POST,
433
+ Method.POST,
423
434
  f"api/1/vehicles/{vehicle_tag}/command/set_scheduled_departure",
424
435
  json={"enable": enable, "time": time},
425
436
  )
@@ -427,7 +438,7 @@ class Vehicle:
427
438
  async def set_sentry_mode(self, vehicle_tag: str | int, on: bool) -> dict[str, Any]:
428
439
  """Enables and disables Sentry Mode. Sentry Mode allows customers to watch the vehicle cameras live from the mobile app, as well as record sentry events."""
429
440
  return await self._request(
430
- Methods.POST,
441
+ Method.POST,
431
442
  f"api/1/vehicles/{vehicle_tag}/command/set_sentry_mode",
432
443
  json={"on": on},
433
444
  )
@@ -440,7 +451,7 @@ class Vehicle:
440
451
  ) -> dict[str, Any]:
441
452
  """Sets the driver and/or passenger-side cabin temperature (and other zones if sync is enabled)."""
442
453
  return await self._request(
443
- Methods.POST,
454
+ Method.POST,
444
455
  f"api/1/vehicles/{vehicle_tag}/command/set_temps",
445
456
  json={"driver_temp": driver_temp, "passenger_temp": passenger_temp},
446
457
  )
@@ -450,7 +461,7 @@ class Vehicle:
450
461
  ) -> dict[str, Any]:
451
462
  """Turns on Valet Mode and sets a four-digit passcode that must then be entered to disable Valet Mode."""
452
463
  return await self._request(
453
- Methods.POST,
464
+ Method.POST,
454
465
  f"api/1/vehicles/{vehicle_tag}/command/set_valet_mode",
455
466
  json={"on": on, "password": str(password)},
456
467
  )
@@ -460,7 +471,7 @@ class Vehicle:
460
471
  ) -> dict[str, Any]:
461
472
  """Changes the name of a vehicle. This command also requires the Tesla Vehicle Command Protocol - for more information, please see refer to the documentation here."""
462
473
  return await self._request(
463
- Methods.POST,
474
+ Method.POST,
464
475
  f"api/1/vehicles/{vehicle_tag}/command/set_vehicle_name",
465
476
  json={"vehicle_name": vehicle_name},
466
477
  )
@@ -470,7 +481,7 @@ class Vehicle:
470
481
  ) -> dict[str, Any]:
471
482
  """Activates Speed Limit Mode with a four-digit PIN."""
472
483
  return await self._request(
473
- Methods.POST,
484
+ Method.POST,
474
485
  f"api/1/vehicles/{vehicle_tag}/command/speed_limit_activate",
475
486
  json={"pin": str(pin)},
476
487
  )
@@ -480,7 +491,7 @@ class Vehicle:
480
491
  ) -> dict[str, Any]:
481
492
  """Deactivates Speed Limit Mode and resets the associated PIN."""
482
493
  return await self._request(
483
- Methods.POST,
494
+ Method.POST,
484
495
  f"api/1/vehicles/{vehicle_tag}/command/speed_limit_clear_pin",
485
496
  json={"pin": str(pin)},
486
497
  )
@@ -490,7 +501,7 @@ class Vehicle:
490
501
  ) -> dict[str, Any]:
491
502
  """Deactivates Speed Limit Mode and resets the associated PIN for vehicles running firmware versions 2023.38+. This command is only accessible to fleet managers or owners."""
492
503
  return await self._request(
493
- Methods.POST,
504
+ Method.POST,
494
505
  f"api/1/vehicles/{vehicle_tag}/command/speed_limit_clear_pin_admin",
495
506
  )
496
507
 
@@ -499,7 +510,7 @@ class Vehicle:
499
510
  ) -> dict[str, Any]:
500
511
  """Deactivates Speed Limit Mode."""
501
512
  return await self._request(
502
- Methods.POST,
513
+ Method.POST,
503
514
  f"api/1/vehicles/{vehicle_tag}/command/speed_limit_deactivate",
504
515
  json={"pin": str(pin)},
505
516
  )
@@ -509,17 +520,17 @@ class Vehicle:
509
520
  ) -> dict[str, Any]:
510
521
  """Sets the maximum speed allowed when Speed Limit Mode is active."""
511
522
  return await self._request(
512
- Methods.POST,
523
+ Method.POST,
513
524
  f"api/1/vehicles/{vehicle_tag}/command/speed_limit_set_limit",
514
525
  json={"limit_mph": limit_mph},
515
526
  )
516
527
 
517
528
  async def sun_roof_control(
518
- self, vehicle_tag: str | int, state: str | SunRoofCommands
529
+ self, vehicle_tag: str | int, state: str | SunRoofCommand
519
530
  ) -> dict[str, Any]:
520
531
  """Controls the panoramic sunroof on the Model S."""
521
532
  return await self._request(
522
- Methods.POST,
533
+ Method.POST,
523
534
  f"api/1/vehicles/{vehicle_tag}/command/sun_roof_control",
524
535
  json={"state": state},
525
536
  )
@@ -527,7 +538,7 @@ class Vehicle:
527
538
  async def take_drivenote(self, vehicle_tag: str | int, note: str) -> dict[str, Any]:
528
539
  """Records a drive note. The note parameter is truncated to 80 characters in length."""
529
540
  return await self._request(
530
- Methods.POST,
541
+ Method.POST,
531
542
  f"api/1/vehicles/{vehicle_tag}/command/take_drivenote",
532
543
  json={"note": note},
533
544
  )
@@ -547,7 +558,7 @@ class Vehicle:
547
558
  data["lat"] = lat
548
559
  data["lon"] = lon
549
560
  return await self._request(
550
- Methods.POST,
561
+ Method.POST,
551
562
  f"api/1/vehicles/{vehicle_tag}/command/trigger_homelink",
552
563
  json=data,
553
564
  )
@@ -557,7 +568,7 @@ class Vehicle:
557
568
  ) -> dict[str, Any]:
558
569
  """Upcoming calendar entries stored on the vehicle."""
559
570
  return await self._request(
560
- Methods.POST,
571
+ Method.POST,
561
572
  f"api/1/vehicles/{vehicle_tag}/command/upcoming_calendar_entries",
562
573
  json={"calendar_data": calendar_data},
563
574
  )
@@ -565,27 +576,27 @@ class Vehicle:
565
576
  async def window_control(
566
577
  self,
567
578
  vehicle_tag: str | int,
568
- command: str | WindowCommands,
579
+ command: str | WindowCommand,
569
580
  lat: float | None = None,
570
581
  lon: float | None = None,
571
582
  ) -> dict[str, Any]:
572
583
  """Control the windows of a parked vehicle. Supported commands: vent and close. When closing, specify lat and lon of user to ensure they are within range of vehicle (unless this is an M3 platform vehicle)."""
573
584
  return await self._request(
574
- Methods.POST,
585
+ Method.POST,
575
586
  f"api/1/vehicles/{vehicle_tag}/command/window_control",
576
587
  json={"lat": lat, "lon": lon, "command": command},
577
588
  )
578
589
 
579
590
  async def drivers(self, vehicle_tag: str | int) -> dict[str, Any]:
580
591
  """Returns all allowed drivers for a vehicle. This endpoint is only available for the vehicle owner."""
581
- return await self._request(Methods.GET, f"api/1/vehicles/{vehicle_tag}/drivers")
592
+ return await self._request(Method.GET, f"api/1/vehicles/{vehicle_tag}/drivers")
582
593
 
583
594
  async def drivers_remove(
584
595
  self, vehicle_tag: str | int, share_user_id: str | int | None = None
585
596
  ) -> dict[str, Any]:
586
597
  """Removes driver access from a vehicle. Share users can only remove their own access. Owners can remove share access or their own."""
587
598
  return await self._request(
588
- Methods.DELETE,
599
+ Method.DELETE,
589
600
  f"api/1/vehicles/{vehicle_tag}/drivers",
590
601
  {"share_user_id": share_user_id},
591
602
  )
@@ -595,13 +606,13 @@ class Vehicle:
595
606
  ) -> dict[str, Any]:
596
607
  """Returns vehicles belonging to the account."""
597
608
  return await self._request(
598
- Methods.GET, "api/1/vehicles", {"page": page, "per_page": per_page}
609
+ Method.GET, "api/1/vehicles", {"page": page, "per_page": per_page}
599
610
  )
600
611
 
601
612
  async def mobile_enabled(self, vehicle_tag: str | int) -> dict[str, Any]:
602
613
  """Returns whether or not mobile access is enabled for the vehicle."""
603
614
  return await self._request(
604
- Methods.GET, f"api/1/vehicles/{vehicle_tag}/mobile_enabled"
615
+ Method.GET, f"api/1/vehicles/{vehicle_tag}/mobile_enabled"
605
616
  )
606
617
 
607
618
  async def nearby_charging_sites(
@@ -613,7 +624,7 @@ class Vehicle:
613
624
  ) -> dict[str, Any]:
614
625
  """Returns the charging sites near the current location of the vehicle."""
615
626
  return await self._request(
616
- Methods.GET,
627
+ Method.GET,
617
628
  f"api/1/vehicles/{vehicle_tag}/nearby_charging_sites",
618
629
  {"count": count, "radius": radius, "detail": detail},
619
630
  )
@@ -621,13 +632,13 @@ class Vehicle:
621
632
  async def options(self, vin: str) -> dict[str, Any]:
622
633
  """Returns vehicle option details."""
623
634
  return await self._request(
624
- Methods.GET, "api/1/dx/vehicles/options", {"vin": vin}
635
+ Method.GET, "api/1/dx/vehicles/options", {"vin": vin}
625
636
  )
626
637
 
627
638
  async def recent_alerts(self, vehicle_tag: str | int) -> dict[str, Any]:
628
639
  """List of recent alerts"""
629
640
  return await self._request(
630
- Methods.GET, f"api/1/vehicles/{vehicle_tag}/recent_alerts"
641
+ Method.GET, f"api/1/vehicles/{vehicle_tag}/recent_alerts"
631
642
  )
632
643
 
633
644
  async def release_notes(
@@ -638,7 +649,7 @@ class Vehicle:
638
649
  ) -> dict[str, Any]:
639
650
  """Returns firmware release notes."""
640
651
  return await self._request(
641
- Methods.GET,
652
+ Method.GET,
642
653
  f"api/1/vehicles/{vehicle_tag}/release_notes",
643
654
  {"staged": staged, "language": language},
644
655
  )
@@ -646,25 +657,25 @@ class Vehicle:
646
657
  async def service_data(self, vehicle_tag: str | int) -> dict[str, Any]:
647
658
  """Returns service data."""
648
659
  return await self._request(
649
- Methods.GET, f"api/1/vehicles/{vehicle_tag}/service_data"
660
+ Method.GET, f"api/1/vehicles/{vehicle_tag}/service_data"
650
661
  )
651
662
 
652
663
  async def share_invites(self, vehicle_tag: str | int) -> dict[str, Any]:
653
664
  """Returns the share invites for a vehicle."""
654
665
  return await self._request(
655
- Methods.GET, f"api/1/vehicles/{vehicle_tag}/invitations"
666
+ Method.GET, f"api/1/vehicles/{vehicle_tag}/invitations"
656
667
  )
657
668
 
658
669
  async def share_invites_create(self, vehicle_tag: str | int) -> dict[str, Any]:
659
670
  """Creates a share invite for a vehicle."""
660
671
  return await self._request(
661
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/invitations"
672
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/invitations"
662
673
  )
663
674
 
664
675
  async def share_invites_redeem(self, code: str) -> dict[str, Any]:
665
676
  """Redeems a share invite."""
666
677
  return await self._request(
667
- Methods.POST, "api/1/invitations/redeem", {code: code}
678
+ Method.POST, "api/1/invitations/redeem", {code: code}
668
679
  )
669
680
 
670
681
  async def share_invites_revoke(
@@ -672,7 +683,7 @@ class Vehicle:
672
683
  ) -> dict[str, Any]:
673
684
  """Revokes a share invite."""
674
685
  return await self._request(
675
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/invitations/{id}/revoke"
686
+ Method.POST, f"api/1/vehicles/{vehicle_tag}/invitations/{id}/revoke"
676
687
  )
677
688
 
678
689
  async def signed_command(
@@ -680,7 +691,7 @@ class Vehicle:
680
691
  ) -> dict[str, Any]:
681
692
  """Signed Commands is a generic endpoint replacing legacy commands."""
682
693
  return await self._request(
683
- Methods.POST,
694
+ Method.POST,
684
695
  f"api/1/vehicles/{vehicle_tag}/signed_command",
685
696
  {"routable_message": routable_message},
686
697
  )
@@ -690,7 +701,7 @@ class Vehicle:
690
701
  ) -> dict[str, Any]:
691
702
  """Returns the list of vehicles for which this mobile device currently subscribes to push notifications."""
692
703
  return await self._request(
693
- Methods.GET,
704
+ Method.GET,
694
705
  "api/1/subscriptions",
695
706
  query={"device_token": device_token, "device_type": device_type},
696
707
  )
@@ -700,71 +711,67 @@ class Vehicle:
700
711
  ) -> dict[str, Any]:
701
712
  """Allows a mobile device to specify which vehicles to receive push notifications from."""
702
713
  return await self._request(
703
- Methods.POST,
714
+ Method.POST,
704
715
  "api/1/subscriptions",
705
716
  query={"device_token": device_token, "device_type": device_type},
706
717
  )
707
718
 
708
719
  async def vehicle(self, vehicle_tag: str | int) -> dict[str, Any]:
709
720
  """Returns information about a vehicle."""
710
- return await self._request(Methods.GET, f"api/1/vehicles/{vehicle_tag}")
721
+ return await self._request(Method.GET, f"api/1/vehicles/{vehicle_tag}")
711
722
 
712
723
  async def vehicle_data(
713
724
  self,
714
725
  vehicle_tag: str | int,
715
- endpoints: List[VehicleDataEndpoints] | List[str] | None = None,
726
+ endpoints: List[VehicleDataEndpoint] | List[str] | None = None,
716
727
  ) -> dict[str, Any]:
717
728
  """Makes a live call to the vehicle. This may return cached data if the vehicle is offline. For vehicles running firmware versions 2023.38+, location_data is required to fetch vehicle location. This will result in a location sharing icon to show on the vehicle UI."""
718
729
  if isinstance(endpoints, list):
719
730
  endpoints = ";".join(endpoints)
720
731
  return await self._request(
721
- Methods.GET,
732
+ Method.GET,
722
733
  f"api/1/vehicles/{vehicle_tag}/vehicle_data",
723
734
  {"endpoints": endpoints},
724
735
  )
725
736
 
726
737
  async def vehicle_subscriptions(
727
- self, device_token: str, device_type: DeviceTypes | str
738
+ self, device_token: str, device_type: DeviceType | str
728
739
  ) -> dict[str, Any]:
729
740
  """Returns the list of vehicles for which this mobile device currently subscribes to push notifications."""
730
741
  return await self._request(
731
- Methods.GET,
742
+ Method.GET,
732
743
  "api/1/vehicle_subscriptions",
733
744
  {"device_token": device_token, "device_type": device_type},
734
745
  )
735
746
 
736
747
  async def vehicle_subscriptions_set(
737
- self, device_token: str, device_type: DeviceTypes | str
748
+ self, device_token: str, device_type: DeviceType | str
738
749
  ) -> dict[str, Any]:
739
750
  """Allows a mobile device to specify which vehicles to receive push notifications from."""
740
751
  return await self._request(
741
- Methods.POST,
752
+ Method.POST,
742
753
  "api/1/vehicle_subscriptions",
743
754
  params={"device_token": device_token, "device_type": device_type},
744
755
  )
745
756
 
746
757
  async def wake_up(self, vehicle_tag: str | int) -> dict[str, Any]:
747
758
  """Wakes the vehicle from sleep, which is a state to minimize idle energy consumption."""
748
- return await self._request(
749
- Methods.POST, f"api/1/vehicles/{vehicle_tag}/wake_up"
750
- )
759
+ return await self._request(Method.POST, f"api/1/vehicles/{vehicle_tag}/wake_up")
751
760
 
752
761
  async def warranty_details(self, vin: str | None) -> dict[str, Any]:
753
762
  """Returns warranty details."""
754
- return await self._request(Methods.GET, "api/1/dx/warranty/details", {vin: vin})
763
+ return await self._request(Method.GET, "api/1/dx/warranty/details", {vin: vin})
755
764
 
756
765
  async def fleet_status(self, vins: List[str]) -> dict[str, Any]:
757
766
  """Checks whether vehicles can accept Tesla commands protocol for the partner's public key"""
758
- return await self._request(
759
- Methods.GET, "api/1/vehicles/fleet_status", json=vins
760
- )
767
+ return await self._request(Method.GET, "api/1/vehicles/fleet_status", json=vins)
761
768
 
762
769
  async def fleet_telemetry_config_create(
763
770
  self, config: dict[str, Any]
764
771
  ) -> dict[str, Any]:
765
772
  """Configures fleet telemetry."""
766
773
  return await self._request(
767
- Methods.POST, "api/1/vehicles/fleet_telemetry_config", json=config
774
+ Method.POST, "api/1/vehicles/fleet_telemetry_config", json=config
768
775
  )
769
776
 
770
777
  async def fleet_telemetry_config_get(
@@ -772,7 +779,7 @@ class Vehicle:
772
779
  ) -> dict[str, Any]:
773
780
  """Configures fleet telemetry."""
774
781
  return await self._request(
775
- Methods.GET, f"api/1/vehicles/{vehicle_tag}/fleet_telemetry_config"
782
+ Method.GET, f"api/1/vehicles/{vehicle_tag}/fleet_telemetry_config"
776
783
  )
777
784
 
778
785
  async def fleet_telemetry_config_delete(
@@ -780,5 +787,5 @@ class Vehicle:
780
787
  ) -> dict[str, Any]:
781
788
  """Configures fleet telemetry."""
782
789
  return await self._request(
783
- Methods.DELETE, f"api/1/vehicles/{vehicle_tag}/fleet_telemetry_config"
790
+ Method.DELETE, f"api/1/vehicles/{vehicle_tag}/fleet_telemetry_config"
784
791
  )