tesla-fleet-api 0.9.10__py3-none-any.whl → 1.0.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- tesla_fleet_api/__init__.py +7 -22
- tesla_fleet_api/const.py +1 -225
- tesla_fleet_api/exceptions.py +117 -0
- tesla_fleet_api/tesla/__init__.py +11 -0
- tesla_fleet_api/tesla/bluetooth.py +38 -0
- tesla_fleet_api/{charging.py → tesla/charging.py} +1 -1
- tesla_fleet_api/{energy.py → tesla/energysite.py} +41 -33
- tesla_fleet_api/{teslafleetapi.py → tesla/fleet.py} +8 -53
- tesla_fleet_api/{teslafleetoauth.py → tesla/oauth.py} +3 -4
- tesla_fleet_api/{partner.py → tesla/partner.py} +1 -1
- tesla_fleet_api/tesla/tesla.py +52 -0
- tesla_fleet_api/{user.py → tesla/user.py} +1 -1
- tesla_fleet_api/tesla/vehicle/__init__.py +13 -0
- tesla_fleet_api/tesla/vehicle/bluetooth.py +219 -0
- tesla_fleet_api/{vehiclesigned.py → tesla/vehicle/commands.py} +321 -164
- tesla_fleet_api/{vehicle.py → tesla/vehicle/fleet.py} +173 -206
- tesla_fleet_api/tesla/vehicle/signed.py +56 -0
- tesla_fleet_api/tesla/vehicle/vehicle.py +19 -0
- tesla_fleet_api/tesla/vehicle/vehicles.py +46 -0
- tesla_fleet_api/teslemetry/__init__.py +5 -0
- tesla_fleet_api/{teslemetry.py → teslemetry/teslemetry.py} +16 -25
- tesla_fleet_api/teslemetry/vehicle.py +73 -0
- tesla_fleet_api/tessie/__init__.py +5 -0
- tesla_fleet_api/{tessie.py → tessie/tessie.py} +17 -9
- tesla_fleet_api/tessie/vehicle.py +41 -0
- {tesla_fleet_api-0.9.10.dist-info → tesla_fleet_api-1.0.1.dist-info}/METADATA +3 -2
- tesla_fleet_api-1.0.1.dist-info/RECORD +51 -0
- tesla_fleet_api/energyspecific.py +0 -125
- tesla_fleet_api/teslafleetopensource.py +0 -61
- tesla_fleet_api/vehiclespecific.py +0 -509
- tesla_fleet_api-0.9.10.dist-info/RECORD +0 -42
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/__init__.py +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/__init__.pyi +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/car_server_pb2.py +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/car_server_pb2.pyi +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/common_pb2.py +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/common_pb2.pyi +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/errors_pb2.py +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/errors_pb2.pyi +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/keys_pb2.py +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/keys_pb2.pyi +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/managed_charging_pb2.py +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/managed_charging_pb2.pyi +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/signatures_pb2.py +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/signatures_pb2.pyi +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/universal_message_pb2.py +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/universal_message_pb2.pyi +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/vcsec_pb2.py +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/vcsec_pb2.pyi +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/vehicle_pb2.py +0 -0
- /tesla_fleet_api/{pb2 → tesla/vehicle/proto}/vehicle_pb2.pyi +0 -0
- {tesla_fleet_api-0.9.10.dist-info → tesla_fleet_api-1.0.1.dist-info}/LICENSE +0 -0
- {tesla_fleet_api-0.9.10.dist-info → tesla_fleet_api-1.0.1.dist-info}/WHEEL +0 -0
- {tesla_fleet_api-0.9.10.dist-info → tesla_fleet_api-1.0.1.dist-info}/top_level.txt +0 -0
@@ -1,256 +1,239 @@
|
|
1
1
|
from __future__ import annotations
|
2
|
-
|
2
|
+
|
3
3
|
from locale import getlocale
|
4
|
-
from
|
5
|
-
from
|
6
|
-
|
4
|
+
from time import time
|
5
|
+
from typing import TYPE_CHECKING, Any, List
|
6
|
+
|
7
|
+
from ...const import (
|
8
|
+
CabinOverheatProtectionTemp,
|
9
|
+
ClimateKeeperMode,
|
10
|
+
Level,
|
7
11
|
Method,
|
12
|
+
Seat,
|
13
|
+
SunRoofCommand,
|
8
14
|
Trunk,
|
9
|
-
ClimateKeeperMode,
|
10
|
-
CabinOverheatProtectionTemp,
|
11
15
|
VehicleDataEndpoint,
|
12
|
-
SunRoofCommand,
|
13
16
|
WindowCommand,
|
14
|
-
DeviceType,
|
15
|
-
Seat,
|
16
|
-
Level,
|
17
17
|
)
|
18
|
-
from .
|
19
|
-
from .vehiclesigned import VehicleSigned
|
20
|
-
|
21
|
-
if TYPE_CHECKING:
|
22
|
-
from .teslafleetapi import TeslaFleetApi
|
18
|
+
from .vehicle import Vehicle
|
23
19
|
|
24
20
|
DEFAULT_LOCALE = (getlocale()[0] or "en-US").replace("_","-")
|
25
21
|
|
26
|
-
|
27
|
-
|
22
|
+
if TYPE_CHECKING:
|
23
|
+
from ..fleet import TeslaFleetApi
|
28
24
|
|
29
|
-
|
25
|
+
class VehicleFleet(Vehicle):
|
26
|
+
"""Class describing the Tesla Fleet API vehicle endpoints and commands."""
|
30
27
|
|
31
|
-
def __init__(self, parent: TeslaFleetApi):
|
32
|
-
|
28
|
+
def __init__(self, parent: TeslaFleetApi, vin: str):
|
29
|
+
super().__init__(parent, vin)
|
33
30
|
self._request = parent._request
|
34
31
|
|
35
|
-
def specific(self, vin: str) -> VehicleSpecific:
|
36
|
-
"""Creates a class for each vehicle."""
|
37
|
-
return VehicleSpecific(self, vin)
|
38
|
-
|
39
|
-
def specific_signed(
|
40
|
-
self, vin: str, private_key: ec.EllipticCurvePrivateKey | None = None
|
41
|
-
) -> VehicleSigned:
|
42
|
-
"""Creates a class for each vehicle with command signing."""
|
43
|
-
return VehicleSigned(self, vin, private_key)
|
44
|
-
|
45
|
-
def pre2021(self, vin: str) -> bool:
|
46
|
-
"""Checks if a vehicle is a pre-2021 model S or X."""
|
47
|
-
return vin[3] in ["S", "X"] and (vin[9] <= "L" or (vin[9] == "M" and vin[7] in ['1', '2', '3', '4']))
|
48
|
-
|
49
32
|
async def actuate_trunk(
|
50
|
-
self,
|
33
|
+
self, which_trunk: Trunk | str
|
51
34
|
) -> dict[str, Any]:
|
52
35
|
"""Controls the front or rear trunk."""
|
53
36
|
return await self._request(
|
54
37
|
Method.POST,
|
55
|
-
f"api/1/vehicles/{
|
38
|
+
f"api/1/vehicles/{self.vin}/command/actuate_trunk",
|
56
39
|
json={"which_trunk": which_trunk},
|
57
40
|
)
|
58
41
|
|
59
42
|
async def adjust_volume(
|
60
|
-
self,
|
43
|
+
self, volume: float
|
61
44
|
) -> dict[str, Any]:
|
62
45
|
"""Adjusts vehicle media playback volume."""
|
63
46
|
if volume < 0.0 or volume > 11.0:
|
64
47
|
raise ValueError("Volume must a number from 0.0 to 11.0")
|
65
48
|
return await self._request(
|
66
49
|
Method.POST,
|
67
|
-
f"api/1/vehicles/{
|
50
|
+
f"api/1/vehicles/{self.vin}/command/adjust_volume",
|
68
51
|
json={"volume": volume},
|
69
52
|
)
|
70
53
|
|
71
|
-
async def auto_conditioning_start(self
|
54
|
+
async def auto_conditioning_start(self) -> dict[str, Any]:
|
72
55
|
"""Starts climate preconditioning."""
|
73
56
|
return await self._request(
|
74
57
|
Method.POST,
|
75
|
-
f"api/1/vehicles/{
|
58
|
+
f"api/1/vehicles/{self.vin}/command/auto_conditioning_start",
|
76
59
|
)
|
77
60
|
|
78
|
-
async def auto_conditioning_stop(self
|
61
|
+
async def auto_conditioning_stop(self) -> dict[str, Any]:
|
79
62
|
"""Stops climate preconditioning."""
|
80
63
|
return await self._request(
|
81
64
|
Method.POST,
|
82
|
-
f"api/1/vehicles/{
|
65
|
+
f"api/1/vehicles/{self.vin}/command/auto_conditioning_stop",
|
83
66
|
)
|
84
67
|
|
85
|
-
async def cancel_software_update(self
|
68
|
+
async def cancel_software_update(self) -> dict[str, Any]:
|
86
69
|
"""Cancels the countdown to install the vehicle software update."""
|
87
70
|
return await self._request(
|
88
71
|
Method.POST,
|
89
|
-
f"api/1/vehicles/{
|
72
|
+
f"api/1/vehicles/{self.vin}/command/cancel_software_update",
|
90
73
|
)
|
91
74
|
|
92
|
-
async def charge_max_range(self
|
75
|
+
async def charge_max_range(self) -> dict[str, Any]:
|
93
76
|
"""Charges in max range mode -- we recommend limiting the use of this mode to long trips."""
|
94
77
|
return await self._request(
|
95
|
-
Method.POST, f"api/1/vehicles/{
|
78
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/charge_max_range"
|
96
79
|
)
|
97
80
|
|
98
|
-
async def charge_port_door_close(self
|
81
|
+
async def charge_port_door_close(self) -> dict[str, Any]:
|
99
82
|
"""Closes the charge port door."""
|
100
83
|
return await self._request(
|
101
84
|
Method.POST,
|
102
|
-
f"api/1/vehicles/{
|
85
|
+
f"api/1/vehicles/{self.vin}/command/charge_port_door_close",
|
103
86
|
)
|
104
87
|
|
105
|
-
async def charge_port_door_open(self
|
88
|
+
async def charge_port_door_open(self) -> dict[str, Any]:
|
106
89
|
"""Opens the charge port door."""
|
107
90
|
return await self._request(
|
108
91
|
Method.POST,
|
109
|
-
f"api/1/vehicles/{
|
92
|
+
f"api/1/vehicles/{self.vin}/command/charge_port_door_open",
|
110
93
|
)
|
111
94
|
|
112
|
-
async def charge_standard(self
|
95
|
+
async def charge_standard(self) -> dict[str, Any]:
|
113
96
|
"""Charges in Standard mode."""
|
114
97
|
return await self._request(
|
115
|
-
Method.POST, f"api/1/vehicles/{
|
98
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/charge_standard"
|
116
99
|
)
|
117
100
|
|
118
|
-
async def charge_start(self
|
101
|
+
async def charge_start(self) -> dict[str, Any]:
|
119
102
|
"""Starts charging the vehicle."""
|
120
103
|
return await self._request(
|
121
|
-
Method.POST, f"api/1/vehicles/{
|
104
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/charge_start"
|
122
105
|
)
|
123
106
|
|
124
|
-
async def charge_stop(self
|
107
|
+
async def charge_stop(self) -> dict[str, Any]:
|
125
108
|
"""Stops charging the vehicle."""
|
126
109
|
return await self._request(
|
127
|
-
Method.POST, f"api/1/vehicles/{
|
110
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/charge_stop"
|
128
111
|
)
|
129
112
|
|
130
|
-
async def clear_pin_to_drive_admin(self,
|
113
|
+
async def clear_pin_to_drive_admin(self, pin: str | None = None):
|
131
114
|
"""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."""
|
132
115
|
return await self._request(
|
133
116
|
Method.POST,
|
134
|
-
f"api/1/vehicles/{
|
117
|
+
f"api/1/vehicles/{self.vin}/command/clear_pin_to_drive_admin",
|
118
|
+
json={"pin": pin}
|
135
119
|
)
|
136
120
|
|
137
|
-
async def door_lock(self
|
121
|
+
async def door_lock(self) -> dict[str, Any]:
|
138
122
|
"""Locks the vehicle."""
|
139
123
|
return await self._request(
|
140
|
-
Method.POST, f"api/1/vehicles/{
|
124
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/door_lock"
|
141
125
|
)
|
142
126
|
|
143
|
-
async def door_unlock(self
|
127
|
+
async def door_unlock(self) -> dict[str, Any]:
|
144
128
|
"""Unlocks the vehicle."""
|
145
129
|
return await self._request(
|
146
|
-
Method.POST, f"api/1/vehicles/{
|
130
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/door_unlock"
|
147
131
|
)
|
148
132
|
|
149
|
-
async def erase_user_data(self
|
133
|
+
async def erase_user_data(self) -> dict[str, Any]:
|
150
134
|
"""Erases user's data from the user interface. Requires the vehicle to be in park."""
|
151
135
|
return await self._request(
|
152
|
-
Method.POST, f"api/1/vehicles/{
|
136
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/erase_user_data"
|
153
137
|
)
|
154
138
|
|
155
|
-
async def flash_lights(self
|
139
|
+
async def flash_lights(self) -> dict[str, Any]:
|
156
140
|
"""Briefly flashes the vehicle headlights. Requires the vehicle to be in park."""
|
157
141
|
return await self._request(
|
158
|
-
Method.POST, f"api/1/vehicles/{
|
142
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/flash_lights"
|
159
143
|
)
|
160
144
|
|
161
|
-
async def guest_mode(self,
|
145
|
+
async def guest_mode(self, enable: bool) -> dict[str, Any]:
|
162
146
|
"""Restricts certain vehicle UI functionality from guest users"""
|
163
147
|
return await self._request(
|
164
148
|
Method.POST,
|
165
|
-
f"api/1/vehicles/{
|
149
|
+
f"api/1/vehicles/{self.vin}/command/guest_mode",
|
166
150
|
json={"enable": enable},
|
167
151
|
)
|
168
152
|
|
169
|
-
async def honk_horn(self
|
153
|
+
async def honk_horn(self) -> dict[str, Any]:
|
170
154
|
"""Honks the vehicle horn. Requires the vehicle to be in park."""
|
171
155
|
return await self._request(
|
172
|
-
Method.POST, f"api/1/vehicles/{
|
156
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/honk_horn"
|
173
157
|
)
|
174
158
|
|
175
|
-
async def media_next_fav(self
|
159
|
+
async def media_next_fav(self) -> dict[str, Any]:
|
176
160
|
"""Advances media player to next favorite track."""
|
177
161
|
return await self._request(
|
178
|
-
Method.POST, f"api/1/vehicles/{
|
162
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/media_next_fav"
|
179
163
|
)
|
180
164
|
|
181
|
-
async def media_next_track(self
|
165
|
+
async def media_next_track(self) -> dict[str, Any]:
|
182
166
|
"""Advances media player to next track."""
|
183
167
|
return await self._request(
|
184
|
-
Method.POST, f"api/1/vehicles/{
|
168
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/media_next_track"
|
185
169
|
)
|
186
170
|
|
187
|
-
async def media_prev_fav(self
|
171
|
+
async def media_prev_fav(self) -> dict[str, Any]:
|
188
172
|
"""Advances media player to previous favorite track."""
|
189
173
|
return await self._request(
|
190
|
-
Method.POST, f"api/1/vehicles/{
|
174
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/media_prev_fav"
|
191
175
|
)
|
192
176
|
|
193
|
-
async def media_prev_track(self
|
177
|
+
async def media_prev_track(self) -> dict[str, Any]:
|
194
178
|
"""Advances media player to previous track."""
|
195
179
|
return await self._request(
|
196
|
-
Method.POST, f"api/1/vehicles/{
|
180
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/media_prev_track"
|
197
181
|
)
|
198
182
|
|
199
|
-
async def media_toggle_playback(self
|
183
|
+
async def media_toggle_playback(self) -> dict[str, Any]:
|
200
184
|
"""Toggles current play/pause state."""
|
201
185
|
return await self._request(
|
202
186
|
Method.POST,
|
203
|
-
f"api/1/vehicles/{
|
187
|
+
f"api/1/vehicles/{self.vin}/command/media_toggle_playback",
|
204
188
|
)
|
205
189
|
|
206
|
-
async def media_volume_down(self
|
190
|
+
async def media_volume_down(self) -> dict[str, Any]:
|
207
191
|
"""Turns the volume down by one."""
|
208
192
|
return await self._request(
|
209
|
-
Method.POST, f"api/1/vehicles/{
|
193
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/media_volume_down"
|
210
194
|
)
|
211
195
|
|
212
196
|
async def navigation_gps_request(
|
213
|
-
self,
|
197
|
+
self, lat: float, lon: float, order: int | None = None
|
214
198
|
) -> dict[str, Any]:
|
215
199
|
"""Start navigation to given coordinates. Order can be used to specify order of multiple stops."""
|
216
200
|
return await self._request(
|
217
201
|
Method.POST,
|
218
|
-
f"api/1/vehicles/{
|
202
|
+
f"api/1/vehicles/{self.vin}/command/navigation_gps_request",
|
219
203
|
json={"lat": lat, "lon": lon, "order": order},
|
220
204
|
)
|
221
205
|
|
222
206
|
async def navigation_request(
|
223
|
-
self,
|
207
|
+
self, value: str, type: str = "share_ext_content_raw", locale: str | None = None, timestamp_ms: int | None = None
|
224
208
|
) -> dict[str, Any]:
|
225
209
|
"""Sends a location to the in-vehicle navigation system."""
|
226
210
|
timestamp_ms = timestamp_ms or int(time() * 1000)
|
227
211
|
locale = locale or DEFAULT_LOCALE
|
228
212
|
return await self._request(
|
229
213
|
Method.POST,
|
230
|
-
f"api/1/vehicles/{
|
214
|
+
f"api/1/vehicles/{self.vin}/command/navigation_request",
|
231
215
|
json={"value": {"android.intent.extra.TEXT":value}, "type": type, "locale": locale, "timestamp_ms": timestamp_ms},
|
232
216
|
)
|
233
217
|
|
234
218
|
async def navigation_sc_request(
|
235
|
-
self,
|
219
|
+
self, id: int, order: int | None = None
|
236
220
|
) -> dict[str, Any]:
|
237
221
|
"""Sends a location to the in-vehicle navigation system."""
|
238
222
|
return await self._request(
|
239
223
|
Method.POST,
|
240
|
-
f"api/1/vehicles/{
|
224
|
+
f"api/1/vehicles/{self.vin}/command/navigation_sc_request",
|
241
225
|
json={"type": type, "id": id, "order": order},
|
242
226
|
)
|
243
227
|
|
244
228
|
async def remote_auto_seat_climate_request(
|
245
229
|
self,
|
246
|
-
vehicle_tag: str | int,
|
247
230
|
auto_seat_position: int | Seat,
|
248
231
|
auto_climate_on: bool,
|
249
232
|
) -> dict[str, Any]:
|
250
233
|
"""Sets automatic seat heating and cooling."""
|
251
234
|
return await self._request(
|
252
235
|
Method.POST,
|
253
|
-
f"api/1/vehicles/{
|
236
|
+
f"api/1/vehicles/{self.vin}/command/remote_auto_seat_climate_request",
|
254
237
|
json={
|
255
238
|
"auto_seat_position": auto_seat_position,
|
256
239
|
"auto_climate_on": auto_climate_on,
|
@@ -258,35 +241,34 @@ class Vehicle:
|
|
258
241
|
)
|
259
242
|
|
260
243
|
async def remote_auto_steering_wheel_heat_climate_request(
|
261
|
-
self,
|
244
|
+
self, on: bool
|
262
245
|
) -> dict[str, Any]:
|
263
246
|
"""Sets automatic steering wheel heating on/off."""
|
264
247
|
return await self._request(
|
265
248
|
Method.POST,
|
266
|
-
f"api/1/vehicles/{
|
249
|
+
f"api/1/vehicles/{self.vin}/command/remote_auto_steering_wheel_heat_climate_request",
|
267
250
|
json={"on": on},
|
268
251
|
)
|
269
252
|
|
270
253
|
async def remote_boombox(
|
271
|
-
self,
|
254
|
+
self, sound: int
|
272
255
|
) -> dict[str, Any]:
|
273
256
|
"""Plays a sound through the vehicle external speaker."""
|
274
257
|
return await self._request(
|
275
258
|
Method.POST,
|
276
|
-
f"api/1/vehicles/{
|
259
|
+
f"api/1/vehicles/{self.vin}/command/remote_boombox",
|
277
260
|
json={"sound": sound},
|
278
261
|
)
|
279
262
|
|
280
263
|
async def remote_seat_cooler_request(
|
281
264
|
self,
|
282
|
-
vehicle_tag: str | int,
|
283
265
|
seat_position: Seat | int,
|
284
266
|
seat_cooler_level: Level | int,
|
285
267
|
) -> dict[str, Any]:
|
286
268
|
"""Sets seat cooling."""
|
287
269
|
return await self._request(
|
288
270
|
Method.POST,
|
289
|
-
f"api/1/vehicles/{
|
271
|
+
f"api/1/vehicles/{self.vin}/command/remote_seat_cooler_request",
|
290
272
|
json={
|
291
273
|
"seat_position": seat_position,
|
292
274
|
"seat_cooler_level": seat_cooler_level,
|
@@ -295,162 +277,160 @@ class Vehicle:
|
|
295
277
|
|
296
278
|
async def remote_seat_heater_request(
|
297
279
|
self,
|
298
|
-
vehicle_tag: str | int,
|
299
280
|
seat_position: Seat | int,
|
300
281
|
seat_heater_level: Level | int,
|
301
282
|
) -> dict[str, Any]:
|
302
283
|
"""Sets seat heating."""
|
303
284
|
return await self._request(
|
304
285
|
Method.POST,
|
305
|
-
f"api/1/vehicles/{
|
286
|
+
f"api/1/vehicles/{self.vin}/command/remote_seat_heater_request",
|
306
287
|
json={
|
307
288
|
"heater": seat_position,
|
308
289
|
"level": seat_heater_level,
|
309
290
|
},
|
310
291
|
)
|
311
292
|
|
312
|
-
async def remote_start_drive(self
|
293
|
+
async def remote_start_drive(self) -> dict[str, Any]:
|
313
294
|
"""Starts the vehicle remotely. Requires keyless driving to be enabled."""
|
314
295
|
return await self._request(
|
315
|
-
Method.POST, f"api/1/vehicles/{
|
296
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/remote_start_drive"
|
316
297
|
)
|
317
298
|
|
318
299
|
async def remote_steering_wheel_heat_level_request(
|
319
|
-
self,
|
300
|
+
self, level: Level | int
|
320
301
|
) -> dict[str, Any]:
|
321
302
|
"""Sets steering wheel heat level."""
|
322
303
|
return await self._request(
|
323
304
|
Method.POST,
|
324
|
-
f"api/1/vehicles/{
|
305
|
+
f"api/1/vehicles/{self.vin}/command/remote_steering_wheel_heat_level_request",
|
325
306
|
json={"level": level},
|
326
307
|
)
|
327
308
|
|
328
309
|
async def remote_steering_wheel_heater_request(
|
329
|
-
self,
|
310
|
+
self, on: bool
|
330
311
|
) -> dict[str, Any]:
|
331
312
|
"""Sets steering wheel heating on/off. For vehicles that do not support auto steering wheel heat."""
|
332
313
|
return await self._request(
|
333
314
|
Method.POST,
|
334
|
-
f"api/1/vehicles/{
|
315
|
+
f"api/1/vehicles/{self.vin}/command/remote_steering_wheel_heater_request",
|
335
316
|
json={"on": on},
|
336
317
|
)
|
337
318
|
|
338
|
-
async def reset_pin_to_drive_pin(self
|
319
|
+
async def reset_pin_to_drive_pin(self) -> dict[str, Any]:
|
339
320
|
"""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."""
|
340
321
|
return await self._request(
|
341
322
|
Method.POST,
|
342
|
-
f"api/1/vehicles/{
|
323
|
+
f"api/1/vehicles/{self.vin}/command/reset_pin_to_drive_pin",
|
343
324
|
)
|
344
325
|
|
345
|
-
async def reset_valet_pin(self
|
326
|
+
async def reset_valet_pin(self) -> dict[str, Any]:
|
346
327
|
"""Removes PIN for Valet Mode."""
|
347
328
|
return await self._request(
|
348
|
-
Method.POST, f"api/1/vehicles/{
|
329
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/reset_valet_pin"
|
349
330
|
)
|
350
331
|
|
351
332
|
async def schedule_software_update(
|
352
|
-
self,
|
333
|
+
self, offset_sec: int
|
353
334
|
) -> dict[str, Any]:
|
354
335
|
"""Schedules a vehicle software update (over the air "OTA") to be installed in the future."""
|
355
336
|
return await self._request(
|
356
337
|
Method.POST,
|
357
|
-
f"api/1/vehicles/{
|
338
|
+
f"api/1/vehicles/{self.vin}/command/schedule_software_update",
|
358
339
|
json={"offset_sec": offset_sec},
|
359
340
|
)
|
360
341
|
|
361
342
|
async def set_bioweapon_mode(
|
362
|
-
self,
|
343
|
+
self, on: bool, manual_override: bool
|
363
344
|
) -> dict[str, Any]:
|
364
345
|
"""Turns Bioweapon Defense Mode on and off."""
|
365
346
|
return await self._request(
|
366
347
|
Method.POST,
|
367
|
-
f"api/1/vehicles/{
|
348
|
+
f"api/1/vehicles/{self.vin}/command/set_bioweapon_mode",
|
368
349
|
json={"on": on, "manual_override": manual_override},
|
369
350
|
)
|
370
351
|
|
371
352
|
async def set_cabin_overheat_protection(
|
372
|
-
self,
|
353
|
+
self, on: bool, fan_only: bool
|
373
354
|
) -> dict[str, Any]:
|
374
355
|
"""Sets the vehicle overheat protection."""
|
375
356
|
return await self._request(
|
376
357
|
Method.POST,
|
377
|
-
f"api/1/vehicles/{
|
358
|
+
f"api/1/vehicles/{self.vin}/command/set_cabin_overheat_protection",
|
378
359
|
json={"on": on, "fan_only": fan_only},
|
379
360
|
)
|
380
361
|
|
381
362
|
async def set_charge_limit(
|
382
|
-
self,
|
363
|
+
self, percent: int
|
383
364
|
) -> dict[str, Any]:
|
384
365
|
"""Sets the vehicle charge limit."""
|
385
366
|
return await self._request(
|
386
367
|
Method.POST,
|
387
|
-
f"api/1/vehicles/{
|
368
|
+
f"api/1/vehicles/{self.vin}/command/set_charge_limit",
|
388
369
|
json={"percent": percent},
|
389
370
|
)
|
390
371
|
|
391
372
|
async def set_charging_amps(
|
392
|
-
self,
|
373
|
+
self, charging_amps: int
|
393
374
|
) -> dict[str, Any]:
|
394
375
|
"""Sets the vehicle charging amps."""
|
395
376
|
return await self._request(
|
396
377
|
Method.POST,
|
397
|
-
f"api/1/vehicles/{
|
378
|
+
f"api/1/vehicles/{self.vin}/command/set_charging_amps",
|
398
379
|
json={"charging_amps": charging_amps},
|
399
380
|
)
|
400
381
|
|
401
382
|
async def set_climate_keeper_mode(
|
402
|
-
self,
|
383
|
+
self, climate_keeper_mode: ClimateKeeperMode | int
|
403
384
|
) -> dict[str, Any]:
|
404
385
|
"""Enables climate keeper mode."""
|
405
386
|
return await self._request(
|
406
387
|
Method.POST,
|
407
|
-
f"api/1/vehicles/{
|
388
|
+
f"api/1/vehicles/{self.vin}/command/set_climate_keeper_mode",
|
408
389
|
json={"climate_keeper_mode": climate_keeper_mode},
|
409
390
|
)
|
410
391
|
|
411
392
|
async def set_cop_temp(
|
412
|
-
self,
|
393
|
+
self, cop_temp: CabinOverheatProtectionTemp | int
|
413
394
|
) -> dict[str, Any]:
|
414
395
|
"""Adjusts the Cabin Overheat Protection temperature (COP)."""
|
415
396
|
return await self._request(
|
416
397
|
Method.POST,
|
417
|
-
f"api/1/vehicles/{
|
398
|
+
f"api/1/vehicles/{self.vin}/command/set_cop_temp",
|
418
399
|
json={"cop_temp": cop_temp},
|
419
400
|
)
|
420
401
|
|
421
402
|
async def set_pin_to_drive(
|
422
|
-
self,
|
403
|
+
self, on: bool, password: str | int
|
423
404
|
) -> dict[str, Any]:
|
424
405
|
"""Sets a four-digit passcode for PIN to Drive. This PIN must then be entered before the vehicle can be driven."""
|
425
406
|
return await self._request(
|
426
407
|
Method.POST,
|
427
|
-
f"api/1/vehicles/{
|
408
|
+
f"api/1/vehicles/{self.vin}/command/set_pin_to_drive",
|
428
409
|
json={"on": on, "password": str(password)},
|
429
410
|
)
|
430
411
|
|
431
412
|
async def set_preconditioning_max(
|
432
|
-
self,
|
413
|
+
self, on: bool, manual_override: bool
|
433
414
|
) -> dict[str, Any]:
|
434
415
|
"""Sets an override for preconditioning — it should default to empty if no override is used."""
|
435
416
|
return await self._request(
|
436
417
|
Method.POST,
|
437
|
-
f"api/1/vehicles/{
|
418
|
+
f"api/1/vehicles/{self.vin}/command/set_preconditioning_max",
|
438
419
|
json={"on": on, "manual_override": manual_override},
|
439
420
|
)
|
440
421
|
|
441
422
|
async def set_scheduled_charging(
|
442
|
-
self,
|
423
|
+
self, enable: bool, time: int
|
443
424
|
) -> dict[str, Any]:
|
444
425
|
"""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)."""
|
445
426
|
return await self._request(
|
446
427
|
Method.POST,
|
447
|
-
f"api/1/vehicles/{
|
428
|
+
f"api/1/vehicles/{self.vin}/command/set_scheduled_charging",
|
448
429
|
json={"enable": enable, "time": time},
|
449
430
|
)
|
450
431
|
|
451
432
|
async def set_scheduled_departure(
|
452
433
|
self,
|
453
|
-
vehicle_tag: str | int,
|
454
434
|
enable: bool = True,
|
455
435
|
preconditioning_enabled: bool = False,
|
456
436
|
preconditioning_weekdays_only: bool = False,
|
@@ -462,7 +442,7 @@ class Vehicle:
|
|
462
442
|
"""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)."""
|
463
443
|
return await self._request(
|
464
444
|
Method.POST,
|
465
|
-
f"api/1/vehicles/{
|
445
|
+
f"api/1/vehicles/{self.vin}/command/set_scheduled_departure",
|
466
446
|
json={
|
467
447
|
"enable": enable,
|
468
448
|
"preconditioning_enabled": preconditioning_enabled,
|
@@ -474,117 +454,115 @@ class Vehicle:
|
|
474
454
|
},
|
475
455
|
)
|
476
456
|
|
477
|
-
async def set_sentry_mode(self,
|
457
|
+
async def set_sentry_mode(self, on: bool) -> dict[str, Any]:
|
478
458
|
"""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."""
|
479
459
|
return await self._request(
|
480
460
|
Method.POST,
|
481
|
-
f"api/1/vehicles/{
|
461
|
+
f"api/1/vehicles/{self.vin}/command/set_sentry_mode",
|
482
462
|
json={"on": on},
|
483
463
|
)
|
484
464
|
|
485
465
|
async def set_temps(
|
486
466
|
self,
|
487
|
-
vehicle_tag: str | int,
|
488
467
|
driver_temp: float,
|
489
468
|
passenger_temp: float,
|
490
469
|
) -> dict[str, Any]:
|
491
470
|
"""Sets the driver and/or passenger-side cabin temperature (and other zones if sync is enabled)."""
|
492
471
|
return await self._request(
|
493
472
|
Method.POST,
|
494
|
-
f"api/1/vehicles/{
|
473
|
+
f"api/1/vehicles/{self.vin}/command/set_temps",
|
495
474
|
json={"driver_temp": driver_temp, "passenger_temp": passenger_temp},
|
496
475
|
)
|
497
476
|
|
498
477
|
async def set_valet_mode(
|
499
|
-
self,
|
478
|
+
self, on: bool, password: str | int
|
500
479
|
) -> dict[str, Any]:
|
501
480
|
"""Turns on Valet Mode and sets a four-digit passcode that must then be entered to disable Valet Mode."""
|
502
481
|
return await self._request(
|
503
482
|
Method.POST,
|
504
|
-
f"api/1/vehicles/{
|
483
|
+
f"api/1/vehicles/{self.vin}/command/set_valet_mode",
|
505
484
|
json={"on": on, "password": str(password)},
|
506
485
|
)
|
507
486
|
|
508
487
|
async def set_vehicle_name(
|
509
|
-
self,
|
488
|
+
self, vehicle_name: str
|
510
489
|
) -> dict[str, Any]:
|
511
490
|
"""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."""
|
512
491
|
return await self._request(
|
513
492
|
Method.POST,
|
514
|
-
f"api/1/vehicles/{
|
493
|
+
f"api/1/vehicles/{self.vin}/command/set_vehicle_name",
|
515
494
|
json={"vehicle_name": vehicle_name},
|
516
495
|
)
|
517
496
|
|
518
497
|
async def speed_limit_activate(
|
519
|
-
self,
|
498
|
+
self, pin: str | int
|
520
499
|
) -> dict[str, Any]:
|
521
500
|
"""Activates Speed Limit Mode with a four-digit PIN."""
|
522
501
|
return await self._request(
|
523
502
|
Method.POST,
|
524
|
-
f"api/1/vehicles/{
|
503
|
+
f"api/1/vehicles/{self.vin}/command/speed_limit_activate",
|
525
504
|
json={"pin": str(pin)},
|
526
505
|
)
|
527
506
|
|
528
507
|
async def speed_limit_clear_pin(
|
529
|
-
self,
|
508
|
+
self, pin: str | int
|
530
509
|
) -> dict[str, Any]:
|
531
510
|
"""Deactivates Speed Limit Mode and resets the associated PIN."""
|
532
511
|
return await self._request(
|
533
512
|
Method.POST,
|
534
|
-
f"api/1/vehicles/{
|
513
|
+
f"api/1/vehicles/{self.vin}/command/speed_limit_clear_pin",
|
535
514
|
json={"pin": str(pin)},
|
536
515
|
)
|
537
516
|
|
538
517
|
async def speed_limit_clear_pin_admin(
|
539
|
-
self
|
518
|
+
self
|
540
519
|
) -> dict[str, Any]:
|
541
520
|
"""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."""
|
542
521
|
return await self._request(
|
543
522
|
Method.POST,
|
544
|
-
f"api/1/vehicles/{
|
523
|
+
f"api/1/vehicles/{self.vin}/command/speed_limit_clear_pin_admin",
|
545
524
|
)
|
546
525
|
|
547
526
|
async def speed_limit_deactivate(
|
548
|
-
self,
|
527
|
+
self, pin: str | int
|
549
528
|
) -> dict[str, Any]:
|
550
529
|
"""Deactivates Speed Limit Mode."""
|
551
530
|
return await self._request(
|
552
531
|
Method.POST,
|
553
|
-
f"api/1/vehicles/{
|
532
|
+
f"api/1/vehicles/{self.vin}/command/speed_limit_deactivate",
|
554
533
|
json={"pin": str(pin)},
|
555
534
|
)
|
556
535
|
|
557
536
|
async def speed_limit_set_limit(
|
558
|
-
self,
|
537
|
+
self, limit_mph: int
|
559
538
|
) -> dict[str, Any]:
|
560
539
|
"""Sets the maximum speed allowed when Speed Limit Mode is active."""
|
561
540
|
return await self._request(
|
562
541
|
Method.POST,
|
563
|
-
f"api/1/vehicles/{
|
542
|
+
f"api/1/vehicles/{self.vin}/command/speed_limit_set_limit",
|
564
543
|
json={"limit_mph": limit_mph},
|
565
544
|
)
|
566
545
|
|
567
546
|
async def sun_roof_control(
|
568
|
-
self,
|
547
|
+
self, state: str | SunRoofCommand
|
569
548
|
) -> dict[str, Any]:
|
570
549
|
"""Controls the panoramic sunroof on the Model S."""
|
571
550
|
return await self._request(
|
572
551
|
Method.POST,
|
573
|
-
f"api/1/vehicles/{
|
552
|
+
f"api/1/vehicles/{self.vin}/command/sun_roof_control",
|
574
553
|
json={"state": state},
|
575
554
|
)
|
576
555
|
|
577
|
-
async def take_drivenote(self,
|
556
|
+
async def take_drivenote(self, note: str) -> dict[str, Any]:
|
578
557
|
"""Records a drive note. The note parameter is truncated to 80 characters in length."""
|
579
558
|
return await self._request(
|
580
559
|
Method.POST,
|
581
|
-
f"api/1/vehicles/{
|
560
|
+
f"api/1/vehicles/{self.vin}/command/take_drivenote",
|
582
561
|
json={"note": note},
|
583
562
|
)
|
584
563
|
|
585
564
|
async def trigger_homelink(
|
586
565
|
self,
|
587
|
-
vehicle_tag: str | int,
|
588
566
|
token: str | None = None,
|
589
567
|
lat: float | None = None,
|
590
568
|
lon: float | None = None,
|
@@ -598,23 +576,23 @@ class Vehicle:
|
|
598
576
|
data["lon"] = lon
|
599
577
|
return await self._request(
|
600
578
|
Method.POST,
|
601
|
-
f"api/1/vehicles/{
|
579
|
+
f"api/1/vehicles/{self.vin}/command/trigger_homelink",
|
602
580
|
json=data,
|
603
581
|
)
|
604
582
|
|
605
583
|
async def upcoming_calendar_entries(
|
606
|
-
self,
|
584
|
+
self,
|
585
|
+
calendar_data: str
|
607
586
|
) -> dict[str, Any]:
|
608
587
|
"""Upcoming calendar entries stored on the vehicle."""
|
609
588
|
return await self._request(
|
610
589
|
Method.POST,
|
611
|
-
f"api/1/vehicles/{
|
590
|
+
f"api/1/vehicles/{self.vin}/command/upcoming_calendar_entries",
|
612
591
|
json={"calendar_data": calendar_data},
|
613
592
|
)
|
614
593
|
|
615
594
|
async def window_control(
|
616
595
|
self,
|
617
|
-
vehicle_tag: str | int,
|
618
596
|
command: str | WindowCommand,
|
619
597
|
lat: float | None = None,
|
620
598
|
lon: float | None = None,
|
@@ -622,21 +600,21 @@ class Vehicle:
|
|
622
600
|
"""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)."""
|
623
601
|
return await self._request(
|
624
602
|
Method.POST,
|
625
|
-
f"api/1/vehicles/{
|
603
|
+
f"api/1/vehicles/{self.vin}/command/window_control",
|
626
604
|
json={"lat": lat, "lon": lon, "command": command},
|
627
605
|
)
|
628
606
|
|
629
|
-
async def drivers(self,
|
607
|
+
async def drivers(self, ) -> dict[str, Any]:
|
630
608
|
"""Returns all allowed drivers for a vehicle. This endpoint is only available for the vehicle owner."""
|
631
|
-
return await self._request(Method.GET, f"api/1/vehicles/{
|
609
|
+
return await self._request(Method.GET, f"api/1/vehicles/{self.vin}/drivers")
|
632
610
|
|
633
611
|
async def drivers_remove(
|
634
|
-
self,
|
612
|
+
self, share_user_id: str | int | None = None
|
635
613
|
) -> dict[str, Any]:
|
636
614
|
"""Removes driver access from a vehicle. Share users can only remove their own access. Owners can remove share access or their own."""
|
637
615
|
return await self._request(
|
638
616
|
Method.DELETE,
|
639
|
-
f"api/1/vehicles/{
|
617
|
+
f"api/1/vehicles/{self.vin}/drivers",
|
640
618
|
{"share_user_id": share_user_id},
|
641
619
|
)
|
642
620
|
|
@@ -648,15 +626,14 @@ class Vehicle:
|
|
648
626
|
Method.GET, "api/1/vehicles", {"page": page, "per_page": per_page}
|
649
627
|
)
|
650
628
|
|
651
|
-
async def mobile_enabled(self,
|
629
|
+
async def mobile_enabled(self, ) -> dict[str, Any]:
|
652
630
|
"""Returns whether or not mobile access is enabled for the vehicle."""
|
653
631
|
return await self._request(
|
654
|
-
Method.GET, f"api/1/vehicles/{
|
632
|
+
Method.GET, f"api/1/vehicles/{self.vin}/mobile_enabled"
|
655
633
|
)
|
656
634
|
|
657
635
|
async def nearby_charging_sites(
|
658
636
|
self,
|
659
|
-
vehicle_tag: str | int,
|
660
637
|
count: int | None = None,
|
661
638
|
radius: int | None = None,
|
662
639
|
detail: bool | None = None,
|
@@ -664,7 +641,7 @@ class Vehicle:
|
|
664
641
|
"""Returns the charging sites near the current location of the vehicle."""
|
665
642
|
return await self._request(
|
666
643
|
Method.GET,
|
667
|
-
f"api/1/vehicles/{
|
644
|
+
f"api/1/vehicles/{self.vin}/nearby_charging_sites",
|
668
645
|
{"count": count, "radius": radius, "detail": detail},
|
669
646
|
)
|
670
647
|
|
@@ -674,41 +651,40 @@ class Vehicle:
|
|
674
651
|
Method.GET, "api/1/dx/vehicles/options", {"vin": vin}
|
675
652
|
)
|
676
653
|
|
677
|
-
async def recent_alerts(self
|
654
|
+
async def recent_alerts(self) -> dict[str, Any]:
|
678
655
|
"""List of recent alerts"""
|
679
656
|
return await self._request(
|
680
|
-
Method.GET, f"api/1/vehicles/{
|
657
|
+
Method.GET, f"api/1/vehicles/{self.vin}/recent_alerts"
|
681
658
|
)
|
682
659
|
|
683
660
|
async def release_notes(
|
684
661
|
self,
|
685
|
-
vehicle_tag: str | int,
|
686
662
|
staged: bool | None = None,
|
687
663
|
language: int | None = None,
|
688
664
|
) -> dict[str, Any]:
|
689
665
|
"""Returns firmware release notes."""
|
690
666
|
return await self._request(
|
691
667
|
Method.GET,
|
692
|
-
f"api/1/vehicles/{
|
668
|
+
f"api/1/vehicles/{self.vin}/release_notes",
|
693
669
|
{"staged": staged, "language": language},
|
694
670
|
)
|
695
671
|
|
696
|
-
async def service_data(self
|
672
|
+
async def service_data(self) -> dict[str, Any]:
|
697
673
|
"""Returns service data."""
|
698
674
|
return await self._request(
|
699
|
-
Method.GET, f"api/1/vehicles/{
|
675
|
+
Method.GET, f"api/1/vehicles/{self.vin}/service_data"
|
700
676
|
)
|
701
677
|
|
702
|
-
async def share_invites(self
|
678
|
+
async def share_invites(self) -> dict[str, Any]:
|
703
679
|
"""Returns the share invites for a vehicle."""
|
704
680
|
return await self._request(
|
705
|
-
Method.GET, f"api/1/vehicles/{
|
681
|
+
Method.GET, f"api/1/vehicles/{self.vin}/invitations"
|
706
682
|
)
|
707
683
|
|
708
|
-
async def share_invites_create(self
|
684
|
+
async def share_invites_create(self) -> dict[str, Any]:
|
709
685
|
"""Creates a share invite for a vehicle."""
|
710
686
|
return await self._request(
|
711
|
-
Method.POST, f"api/1/vehicles/{
|
687
|
+
Method.POST, f"api/1/vehicles/{self.vin}/invitations"
|
712
688
|
)
|
713
689
|
|
714
690
|
async def share_invites_redeem(self, code: str) -> dict[str, Any]:
|
@@ -718,43 +694,41 @@ class Vehicle:
|
|
718
694
|
)
|
719
695
|
|
720
696
|
async def share_invites_revoke(
|
721
|
-
self,
|
697
|
+
self, id: str
|
722
698
|
) -> dict[str, Any]:
|
723
699
|
"""Revokes a share invite."""
|
724
700
|
return await self._request(
|
725
|
-
Method.POST, f"api/1/vehicles/{
|
701
|
+
Method.POST, f"api/1/vehicles/{self.vin}/invitations/{id}/revoke"
|
726
702
|
)
|
727
703
|
|
728
704
|
async def signed_command(
|
729
|
-
self,
|
705
|
+
self, routable_message: str
|
730
706
|
) -> dict[str, Any]:
|
731
707
|
"""Signed Commands is a generic endpoint replacing legacy commands."""
|
732
708
|
return await self._request(
|
733
709
|
Method.POST,
|
734
|
-
f"api/1/vehicles/{
|
710
|
+
f"api/1/vehicles/{self.vin}/signed_command",
|
735
711
|
json={"routable_message": routable_message},
|
736
712
|
)
|
737
713
|
|
738
|
-
async def vehicle(self,
|
714
|
+
async def vehicle(self, ) -> dict[str, Any]:
|
739
715
|
"""Returns information about a vehicle."""
|
740
|
-
return await self._request(Method.GET, f"api/1/vehicles/{
|
716
|
+
return await self._request(Method.GET, f"api/1/vehicles/{self.vin}")
|
741
717
|
|
742
718
|
async def vehicle_data(
|
743
|
-
self,
|
744
|
-
vehicle_tag: str | int,
|
745
|
-
endpoints: list[VehicleDataEndpoint | str] | None = None,
|
719
|
+
self, endpoints: list[VehicleDataEndpoint | str] | None = None,
|
746
720
|
) -> dict[str, Any]:
|
747
721
|
"""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."""
|
748
722
|
endpoint_payload = ";".join(endpoints) if endpoints else None
|
749
723
|
return await self._request(
|
750
724
|
Method.GET,
|
751
|
-
f"api/1/vehicles/{
|
725
|
+
f"api/1/vehicles/{self.vin}/vehicle_data",
|
752
726
|
{"endpoints": endpoint_payload},
|
753
727
|
)
|
754
728
|
|
755
|
-
async def wake_up(self
|
729
|
+
async def wake_up(self) -> dict[str, Any]:
|
756
730
|
"""Wakes the vehicle from sleep, which is a state to minimize idle energy consumption."""
|
757
|
-
return await self._request(Method.POST, f"api/1/vehicles/{
|
731
|
+
return await self._request(Method.POST, f"api/1/vehicles/{self.vin}/wake_up")
|
758
732
|
|
759
733
|
async def warranty_details(self, vin: str | None) -> dict[str, Any]:
|
760
734
|
"""Returns warranty details."""
|
@@ -776,25 +750,20 @@ class Vehicle:
|
|
776
750
|
Method.POST, "api/1/vehicles/fleet_telemetry_config", json=config
|
777
751
|
)
|
778
752
|
|
779
|
-
async def fleet_telemetry_config_get(
|
780
|
-
self, vehicle_tag: str | int
|
781
|
-
) -> dict[str, Any]:
|
753
|
+
async def fleet_telemetry_config_get(self) -> dict[str, Any]:
|
782
754
|
"""Configures fleet telemetry."""
|
783
755
|
return await self._request(
|
784
|
-
Method.GET, f"api/1/vehicles/{
|
756
|
+
Method.GET, f"api/1/vehicles/{self.vin}/fleet_telemetry_config"
|
785
757
|
)
|
786
758
|
|
787
|
-
async def fleet_telemetry_config_delete(
|
788
|
-
self, vehicle_tag: str | int
|
789
|
-
) -> dict[str, Any]:
|
759
|
+
async def fleet_telemetry_config_delete(self) -> dict[str, Any]:
|
790
760
|
"""Configures fleet telemetry."""
|
791
761
|
return await self._request(
|
792
|
-
Method.DELETE, f"api/1/vehicles/{
|
762
|
+
Method.DELETE, f"api/1/vehicles/{self.vin}/fleet_telemetry_config"
|
793
763
|
)
|
794
764
|
|
795
765
|
async def add_charge_schedule(
|
796
766
|
self,
|
797
|
-
vehicle_tag: str | int,
|
798
767
|
days_of_week: str | int,
|
799
768
|
enabled: bool,
|
800
769
|
lat: float,
|
@@ -828,14 +797,12 @@ class Vehicle:
|
|
828
797
|
|
829
798
|
return await self._request(
|
830
799
|
Method.POST,
|
831
|
-
f"api/1/vehicles/{
|
800
|
+
f"api/1/vehicles/{self.vin}/command/add_charge_schedule",
|
832
801
|
json=json_payload,
|
833
802
|
)
|
834
803
|
|
835
804
|
async def add_precondition_schedule(
|
836
|
-
self,
|
837
|
-
vehicle_tag: str | int,
|
838
|
-
days_of_week: str | int,
|
805
|
+
self,days_of_week: str | int,
|
839
806
|
enabled: bool,
|
840
807
|
lat: float,
|
841
808
|
lon: float,
|
@@ -859,22 +826,22 @@ class Vehicle:
|
|
859
826
|
|
860
827
|
return await self._request(
|
861
828
|
Method.POST,
|
862
|
-
f"api/1/vehicles/{
|
829
|
+
f"api/1/vehicles/{self.vin}/command/add_precondition_schedule",
|
863
830
|
json=json_payload,
|
864
831
|
)
|
865
832
|
|
866
833
|
async def remove_charge_schedule(
|
867
|
-
self,
|
834
|
+
self, id: int
|
868
835
|
) -> dict[str, Any]:
|
869
836
|
"""Removes the scheduled charging settings."""
|
870
837
|
return await self._request(
|
871
|
-
Method.POST, f"api/1/vehicles/{
|
838
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/remove_charge_schedule", json={"id": id}
|
872
839
|
)
|
873
840
|
|
874
841
|
async def remove_precondition_schedule(
|
875
|
-
self,
|
842
|
+
self, id: int
|
876
843
|
) -> dict[str, Any]:
|
877
844
|
"""Removes the scheduled precondition settings."""
|
878
845
|
return await self._request(
|
879
|
-
Method.POST, f"api/1/vehicles/{
|
846
|
+
Method.POST, f"api/1/vehicles/{self.vin}/command/remove_precondition_schedule", json={"id": id}
|
880
847
|
)
|