Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/fleet_api_signed_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,35 @@ async def main():

asyncio.run(main())
```

## Low Power / Keep Accessory Power Modes

These are signed-only commands with no Fleet API REST equivalent. `set_low_power_mode` reduces standby power consumption while the vehicle is parked, and `set_keep_accessory_power_mode` keeps 12V accessory power available while parked. Both take a single `bool` to turn the mode on or off:

```python
import asyncio
import aiohttp
from tesla_fleet_api import TeslaFleetApi
from tesla_fleet_api.tesla.vehicle.signed import VehicleSigned
from tesla_fleet_api.exceptions import TeslaFleetError

async def main():
async with aiohttp.ClientSession() as session:
api = TeslaFleetApi(
access_token="<access_token>",
session=session,
region="na",
)

try:
vehicle = VehicleSigned(api, "<vin>")
await vehicle.handshake()
low_power_response = await vehicle.set_low_power_mode(True)
print(low_power_response)
accessory_power_response = await vehicle.set_keep_accessory_power_mode(True)
print(accessory_power_response)
except TeslaFleetError as e:
print(e)

asyncio.run(main())
```
10 changes: 10 additions & 0 deletions proto/car_server.proto
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ message VehicleAction {
StopLightShowAction stopLightShowAction = 116;
StartLightShowAction startLightShowAction = 117;
SetSuspensionLevelAction setSuspensionLevelAction = 118;
SetLowPowerModeAction setLowPowerModeAction = 130;
SetKeepAccessoryPowerModeAction setKeepAccessoryPowerModeAction = 138;
}
}

Expand Down Expand Up @@ -892,3 +894,11 @@ message SetSuspensionLevelAction {

SuspensionLevel suspension_level = 1;
}

message SetLowPowerModeAction {
bool low_power_mode = 1;
}

message SetKeepAccessoryPowerModeAction {
bool keep_accessory_power_mode = 1;
}
25 changes: 25 additions & 0 deletions tesla_fleet_api/tesla/vehicle/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@
NavigationGpsDestinationRequest,
# Group 11: Admin
VehicleControlResetPinToDriveAdminAction,
# Group 12: Power modes
SetLowPowerModeAction,
SetKeepAccessoryPowerModeAction,
)
from tesla_fleet_api.tesla.vehicle.proto.vehicle_pb2 import (
VehicleData,
Expand Down Expand Up @@ -1293,6 +1296,28 @@ async def set_cop_temp(
)
)

async def set_keep_accessory_power_mode(self, on: bool) -> dict[str, Any]:
"""Turns Keep Accessory Power mode on and off, keeping 12V accessory power available while the vehicle is parked."""
return await self._sendInfotainment(
Action(
vehicleAction=VehicleAction(
setKeepAccessoryPowerModeAction=SetKeepAccessoryPowerModeAction(
keep_accessory_power_mode=on
)
)
)
)

async def set_low_power_mode(self, on: bool) -> dict[str, Any]:
"""Turns Low Power mode on and off, reducing standby power consumption while the vehicle is parked."""
return await self._sendInfotainment(
Action(
vehicleAction=VehicleAction(
setLowPowerModeAction=SetLowPowerModeAction(low_power_mode=on)
)
)
)

async def set_pin_to_drive(self, on: bool, password: str | int) -> dict[str, Any]:
"""Sets a four-digit passcode for PIN to Drive. This PIN must then be entered before the vehicle can be driven."""
return await self._sendInfotainment(
Expand Down
608 changes: 306 additions & 302 deletions tesla_fleet_api/tesla/vehicle/proto/car_server_pb2.py

Large diffs are not rendered by default.

Loading
Loading