Skip to content

Commit 984bd58

Browse files
committed
Move vehicle-specific methods to TessieVehicle class
Moved tire_pressure, vehicle_status, plate, and update_plate from the main Tessie class to TessieVehicle class where they belong. These methods operate on a specific vehicle and should use self.vin instead of taking a VIN parameter. This follows the established pattern where vehicle-specific operations are in the Vehicle class (using self.vin) while fleet-wide operations remain in the main API class.
1 parent 54c5838 commit 984bd58

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

tesla_fleet_api/tessie/tessie.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -238,27 +238,3 @@ async def idles(
238238
async def last_idle_state(self, vin: str) -> Any:
239239
"""Get latest idle period data."""
240240
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)

tesla_fleet_api/tessie/vehicles.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,30 @@ async def set_charge_cost(
694694
params={"cost": cost, "currency": currency},
695695
)
696696

697+
# Vehicle Information
698+
async def tire_pressure(self) -> dict[str, Any]:
699+
"""Get current tire pressure readings."""
700+
return await self._request(Method.GET, f"{self.vin}/tire_pressure")
701+
702+
async def vehicle_status(self) -> dict[str, Any]:
703+
"""Get vehicle operational status."""
704+
return await self._request(Method.GET, f"{self.vin}/status")
705+
706+
async def plate(self) -> dict[str, Any]:
707+
"""Get license plate information."""
708+
return await self._request(Method.GET, f"{self.vin}/plate")
709+
710+
async def update_plate(
711+
self,
712+
plate: str,
713+
state: str | None = None,
714+
) -> dict[str, Any]:
715+
"""Update license plate information."""
716+
params: dict[str, str] = {"plate": plate}
717+
if state:
718+
params["state"] = state
719+
return await self._request(Method.POST, f"{self.vin}/plate", params=params)
720+
697721
class TessieVehicles(Vehicles):
698722
"""Class containing and creating vehicles."""
699723

0 commit comments

Comments
 (0)