Skip to content

Commit

Permalink
Add all the other parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Bre77 committed Mar 30, 2024
1 parent f609153 commit 2d18d30
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
20 changes: 18 additions & 2 deletions tesla_fleet_api/vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,29 @@ async def set_scheduled_charging(
)

async def set_scheduled_departure(
self, vehicle_tag: str | int, enable: bool, time: int
self,
vehicle_tag: str | int,
enable: bool = True,
preconditioning_enabled: bool = False,
preconditioning_weekdays_only: bool = False,
departure_time: int = 0,
off_peak_charging_enabled: bool = False,
off_peak_charging_weekdays_only: bool = False,
end_off_peak_time: int = 0,
) -> dict[str, Any]:
"""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)."""
return await self._request(
Method.POST,
f"api/1/vehicles/{vehicle_tag}/command/set_scheduled_departure",
json={"preconditioning_enabled": enable, "departure_time": time},
json={
"enable": enable,
"preconditioning_enabled": preconditioning_enabled,
"preconditioning_weekdays_only": preconditioning_weekdays_only,
"departure_time": departure_time,
"off_peak_charging_enabled": off_peak_charging_enabled,
"off_peak_charging_weekdays_only": off_peak_charging_weekdays_only,
"end_off_peak_time": end_off_peak_time,
},
)

async def set_sentry_mode(self, vehicle_tag: str | int, on: bool) -> dict[str, Any]:
Expand Down
22 changes: 20 additions & 2 deletions tesla_fleet_api/vehiclespecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,27 @@ async def set_scheduled_charging(self, enable: bool, time: int) -> dict[str, Any
"""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)."""
return await self._parent.set_scheduled_charging(self.vin, enable, time)

async def set_scheduled_departure(self, enable: bool, time: int) -> dict[str, Any]:
async def set_scheduled_departure(
self,
enable: bool = True,
preconditioning_enabled: bool = False,
preconditioning_weekdays_only: bool = False,
departure_time: int = 0,
off_peak_charging_enabled: bool = False,
off_peak_charging_weekdays_only: bool = False,
end_off_peak_time: int = 0,
) -> dict[str, Any]:
"""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)."""
return await self._parent.set_scheduled_departure(self.vin, enable, time)
return await self._parent.set_scheduled_departure(
self.vin,
enable,
preconditioning_enabled,
preconditioning_weekdays_only,
departure_time,
off_peak_charging_enabled,
off_peak_charging_weekdays_only,
end_off_peak_time,
)

async def set_sentry_mode(self, on: bool) -> dict[str, Any]:
"""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."""
Expand Down

0 comments on commit 2d18d30

Please sign in to comment.