Skip to content

Commit 54c5838

Browse files
committed
Add comprehensive Tessie API endpoint coverage
This commit significantly expands the Tessie API implementation to include all custom endpoints available in the Tessie API reference documentation. Changes to tesla_fleet_api/tessie/tessie.py: - Add historical data endpoints: states, drives, charges, idles, path - Add location and mapping endpoints: location, map, weather - Add battery and tire monitoring: consumption_since_charge, tire_pressure - Add firmware and alert endpoints: firmware_alerts, vehicle_status - Add fleet-wide endpoints: charging_invoices, all_battery_health - Add license plate management: plate, update_plate Changes to tesla_fleet_api/tessie/vehicles.py: - Add complete set of vehicle command endpoints with wait_for_completion support - Add climate control commands: start/stop climate, temperature, seat heat/cool - Add trunk and window commands: activate trunks, vent/close windows - Add charging commands: start/stop charging, set limits and amps - Add security commands: lock/unlock, sentry mode, valet mode, guest mode - Add software update commands: schedule and cancel updates - Add scheduling commands: scheduled charging and departure - Add driver management endpoints: list, delete, invite drivers - Add fleet telemetry configuration endpoints - Add data management: set drive tags and charge costs - Prefix conflicting method names with 'tessie_' to avoid parent class conflicts All changes pass pyright type checking and ruff linting.
1 parent 23534a7 commit 54c5838

File tree

2 files changed

+865
-1
lines changed

2 files changed

+865
-1
lines changed

tesla_fleet_api/tessie/tessie.py

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,182 @@ async def all_battery_health(
8383
"only_active": only_active,
8484
},
8585
)
86+
87+
async def states(
88+
self,
89+
vin: str,
90+
start: int | None = None,
91+
end: int | None = None,
92+
results: int | None = None,
93+
page: int | None = None,
94+
exclude: str | None = None,
95+
fields: str | None = None,
96+
) -> Any:
97+
"""Get historical vehicle states within timeframe."""
98+
return await self._request(
99+
Method.GET,
100+
f"{vin}/states",
101+
params={
102+
"from": start,
103+
"to": end,
104+
"results": results,
105+
"page": page,
106+
"exclude": exclude,
107+
"fields": fields,
108+
},
109+
)
110+
111+
async def location(self, vin: str) -> Any:
112+
"""Get coordinates, address, and saved location."""
113+
return await self._request(Method.GET, f"{vin}/location")
114+
115+
async def firmware_alerts(self, vin: str) -> Any:
116+
"""Get list of firmware-generated alerts."""
117+
return await self._request(Method.GET, f"{vin}/firmware_alerts")
118+
119+
async def map(
120+
self,
121+
vin: str,
122+
width: int | None = None,
123+
height: int | None = None,
124+
zoom: int | None = None,
125+
) -> Any:
126+
"""Get map image of vehicle location."""
127+
return await self._request(
128+
Method.GET,
129+
f"{vin}/map",
130+
params={"width": width, "height": height, "zoom": zoom},
131+
)
132+
133+
async def consumption_since_charge(self, vin: str) -> Any:
134+
"""Get energy use data since last charge."""
135+
return await self._request(Method.GET, f"{vin}/consumption_since_charge")
136+
137+
async def weather(self, vin: str) -> Any:
138+
"""Get weather forecast around vehicle."""
139+
return await self._request(Method.GET, f"{vin}/weather")
140+
141+
async def drives(
142+
self,
143+
vin: str,
144+
start: int | None = None,
145+
end: int | None = None,
146+
results: int | None = None,
147+
page: int | None = None,
148+
timezone: str | None = None,
149+
distance_format: str | None = None,
150+
) -> Any:
151+
"""Get historical drive records."""
152+
return await self._request(
153+
Method.GET,
154+
f"{vin}/drives",
155+
params={
156+
"from": start,
157+
"to": end,
158+
"results": results,
159+
"page": page,
160+
"timezone": timezone,
161+
"distance_format": distance_format,
162+
},
163+
)
164+
165+
async def path(
166+
self,
167+
vin: str,
168+
start: int,
169+
end: int,
170+
timezone: str | None = None,
171+
) -> Any:
172+
"""Get driving route during specified timeframe."""
173+
return await self._request(
174+
Method.GET,
175+
f"{vin}/path",
176+
params={"from": start, "to": end, "timezone": timezone},
177+
)
178+
179+
async def charges(
180+
self,
181+
vin: str,
182+
start: int | None = None,
183+
end: int | None = None,
184+
results: int | None = None,
185+
page: int | None = None,
186+
timezone: str | None = None,
187+
distance_format: str | None = None,
188+
) -> Any:
189+
"""Get charging history."""
190+
return await self._request(
191+
Method.GET,
192+
f"{vin}/charges",
193+
params={
194+
"from": start,
195+
"to": end,
196+
"results": results,
197+
"page": page,
198+
"timezone": timezone,
199+
"distance_format": distance_format,
200+
},
201+
)
202+
203+
async def charging_invoices(
204+
self,
205+
start: int | None = None,
206+
end: int | None = None,
207+
only_active: bool = False,
208+
) -> Any:
209+
"""Get charging costs for all vehicles (fleet)."""
210+
return await self._request(
211+
Method.GET,
212+
"charging_invoices",
213+
params={"from": start, "to": end, "only_active": only_active},
214+
)
215+
216+
async def idles(
217+
self,
218+
vin: str,
219+
start: int | None = None,
220+
end: int | None = None,
221+
results: int | None = None,
222+
page: int | None = None,
223+
timezone: str | None = None,
224+
) -> Any:
225+
"""Get idle periods when vehicle inactive."""
226+
return await self._request(
227+
Method.GET,
228+
f"{vin}/idles",
229+
params={
230+
"from": start,
231+
"to": end,
232+
"results": results,
233+
"page": page,
234+
"timezone": timezone,
235+
},
236+
)
237+
238+
async def last_idle_state(self, vin: str) -> Any:
239+
"""Get latest idle period data."""
240+
return await self._request(Method.GET, f"{vin}/last_idle_state")
241+
242+
async def tire_pressure(self, vin: str) -> Any:
243+
"""Get current tire pressure readings."""
244+
return await self._request(Method.GET, f"{vin}/tire_pressure")
245+
246+
async def vehicle_status(self, vin: str) -> Any:
247+
"""Get vehicle operational status."""
248+
return await self._request(Method.GET, f"{vin}/status")
249+
250+
async def plate(self, vin: str) -> Any:
251+
"""Get license plate information."""
252+
return await self._request(Method.GET, f"{vin}/plate")
253+
254+
async def update_plate(
255+
self,
256+
vin: str,
257+
plate: str,
258+
state: str | None = None,
259+
) -> Any:
260+
"""Update license plate information."""
261+
params: dict[str, str] = {"plate": plate}
262+
if state:
263+
params["state"] = state
264+
return await self._request(Method.POST, f"{vin}/plate", params=params)

0 commit comments

Comments
 (0)