{"skill":{"slug":"tesla-fleet-api","displayName":"Tesla Fleet API","summary":"Use when integrating with Tesla's official Fleet API to read vehicle/energy device data or issue remote commands (e.g. start HVAC preconditioning, wake vehic...","description":"---\nname: tesla-fleet-api\ndescription: Use when integrating with Tesla's official Fleet API to read vehicle/energy device data or issue remote commands (e.g. start HVAC preconditioning, wake vehicle, charge controls). Covers onboarding (developer app registration, regions/base URLs), OAuth token flows (third-party + partner tokens, refresh rotation), required domain/public-key hosting, and using Tesla's official vehicle-command/tesla-http-proxy for signed vehicle commands.\nversion: 1.5.2\nhomepage: https://github.com/odrobnik/tesla-fleet-api-skill\nmetadata:\n  openclaw:\n    emoji: \"🚗\"\n    requires:\n      bins: [\"python3\", \"openssl\"]\n      env: [\"TESLA_CLIENT_ID\", \"TESLA_CLIENT_SECRET\"]\n      optionalEnv: [\"TESLA_AUDIENCE\", \"TESLA_REDIRECT_URI\", \"TESLA_DOMAIN\", \"TESLA_BASE_URL\", \"TESLA_CA_CERT\", \"TESLA_ACCESS_TOKEN\", \"TESLA_REFRESH_TOKEN\", \"TESLA_SCOPE\"]\n\n---\n\n# Tesla Fleet API\n\nControl Tesla vehicles via the official Fleet API.\n\n## Scripts Overview\n\n| Script | Purpose |\n|--------|---------|\n| `command.py` | Vehicle commands (climate, charging, locks, etc.) |\n| `vehicle_data.py` | Read vehicle data (battery, climate, location, etc.) |\n| `vehicles.py` | List vehicles + refresh cache |\n| `auth.py` | Authentication and configuration |\n| `tesla_oauth_local.py` | OAuth helper with local callback server |\n| `start_proxy.sh` | Start the signing proxy (for vehicle commands) |\n| `stop_proxy.sh` | Stop the signing proxy |\n\n---\n\n## Setup / Configuration\n\nSetup is documented in **`SETUP.md`**:\n\n- [SETUP.md](SETUP.md)\n\nState directory: `{workspace}/tesla-fleet-api/`\n- `config.json` (provider creds + non-token config)\n- `auth.json` (tokens)\n- `vehicles.json` (cached vehicle list)\n- `places.json` (named locations)\n- `proxy/` (TLS material for signing proxy)\n\nNo `.env` file loading — credentials in `config.json` or environment variables.\n\n---\n\n## command.py - Vehicle Commands\n\nExecute commands on your Tesla. Vehicle is auto-selected if you only have one.\n\n### Usage\n\n```bash\ncommand.py [VEHICLE] <command> [options]\n```\n\n- `VEHICLE` - Vehicle name or VIN (optional if single vehicle)\n- Commands can be run without specifying vehicle: `command.py honk`\n- Or with vehicle name: `command.py flash honk` (vehicle \"flash\", command \"honk\")\n\n---\n\n### Climate Control\n\n#### Start/Stop Climate\n```bash\ncommand.py climate start\ncommand.py climate stop\ncommand.py flash climate start          # specific vehicle\n```\n\n#### Set Temperature\n```bash\ncommand.py climate temps <driver_temp> [passenger_temp]\ncommand.py climate temps 21             # both seats 21°C\ncommand.py climate temps 22 20          # driver 22°C, passenger 20°C\n```\n\n#### Climate Keeper Mode\n```bash\ncommand.py climate keeper <mode>\n```\nModes: `off`, `keep`, `dog`, `camp`\n\n---\n\n### Seat Heater\n\n```bash\ncommand.py seat-heater --level <level> [--position <position>]\ncommand.py seat-heater -l <level> [-p <position>]\n```\n\n**Levels:**\n| Value | Name |\n|-------|------|\n| 0 | off |\n| 1 | low |\n| 2 | medium |\n| 3 | high |\n\n**Positions:**\n| Value | Names |\n|-------|-------|\n| 0 | `driver`, `front_left`, `fl` |\n| 1 | `passenger`, `front_right`, `fr` |\n| 2 | `rear_left`, `rl` |\n| 3 | `rear_left_back` |\n| 4 | `rear_center`, `rc` |\n| 5 | `rear_right`, `rr` |\n| 6 | `rear_right_back` |\n| 7 | `third_left` |\n| 8 | `third_right` |\n\n**Examples:**\n```bash\ncommand.py seat-heater -l high                    # driver (default)\ncommand.py seat-heater -l medium -p passenger\ncommand.py seat-heater --level low --position rear_left\ncommand.py seat-heater -l 2 -p 4                  # medium, rear center\ncommand.py seat-heater -l off -p driver           # turn off\n```\n\n---\n\n### Seat Cooler (Ventilation)\n\n```bash\ncommand.py seat-cooler --level <level> [--position <position>]\ncommand.py seat-cooler -l <level> [-p <position>]\n```\n\nSame levels and positions as seat heater.\n\n**Examples:**\n```bash\ncommand.py seat-cooler -l medium -p driver\ncommand.py seat-cooler -l high -p passenger\n```\n\n---\n\n### Seat Auto Climate\n\n```bash\ncommand.py seat-climate [--position <position>] <mode>\ncommand.py seat-climate [-p <position>] <mode>\n```\n\nModes: `auto`, `on`, `off`\n\n**Examples:**\n```bash\ncommand.py seat-climate auto                      # driver auto\ncommand.py seat-climate -p passenger auto\ncommand.py seat-climate -p driver off             # disable auto\n```\n\n---\n\n### Steering Wheel Heater\n\n```bash\ncommand.py steering-heater <on|off>\n```\n\n**Examples:**\n```bash\ncommand.py steering-heater on\ncommand.py steering-heater off\n```\n\n---\n\n### Precondition Schedules\n\nModern API for scheduling departure preconditioning (replaces deprecated `set_scheduled_departure`).\n\n#### Add Schedule\n```bash\ncommand.py precondition add --time <HH:MM> [--days <days>] [--id <id>] [--one-time] [--disabled]\ncommand.py precondition add -t <HH:MM> [-d <days>] [--id <id>]\n```\n\n**Days options:**\n| Value | Description |\n|-------|-------------|\n| `all` | Every day (default) |\n| `weekdays` | Monday through Friday |\n| `weekends` | Saturday and Sunday |\n| `mon,tue,wed,...` | Specific days (comma-separated) |\n\nDay names: `sun`, `mon`, `tue`, `wed`, `thu`, `fri`, `sat` (or full names)\n\n**Examples:**\n```bash\ncommand.py precondition add -t 08:00              # every day at 8am\ncommand.py precondition add -t 08:00 -d weekdays  # Mon-Fri\ncommand.py precondition add -t 07:30 -d mon,wed,fri\ncommand.py precondition add -t 09:00 --one-time   # one-time only\ncommand.py precondition add -t 08:30 --id 123     # modify existing schedule\ncommand.py precondition add -t 08:00 --disabled   # create but disabled\n```\n\n#### Remove Schedule\n```bash\ncommand.py precondition remove --id <id>\n```\n\n**Examples:**\n```bash\ncommand.py precondition remove --id 123\ncommand.py precondition remove --id 1\n```\n\n---\n\n### Charging Control\n\n#### Start/Stop Charging\n```bash\ncommand.py charge start\ncommand.py charge stop\n```\n\n#### Set Charge Limit\n```bash\ncommand.py charge limit <percent>\n```\n\nPercent must be 50-100.\n\n**Examples:**\n```bash\ncommand.py charge limit 80\ncommand.py charge limit 90\ncommand.py flash charge limit 70                  # specific vehicle\n```\n\n---\n\n### Doors & Security\n\n```bash\ncommand.py lock                   # lock all doors\ncommand.py unlock                 # unlock all doors\ncommand.py honk                   # honk the horn\ncommand.py flash                  # flash the lights\ncommand.py wake                   # wake vehicle from sleep\n```\n\n**With vehicle name:**\n```bash\ncommand.py flash wake             # wake vehicle named \"flash\"\ncommand.py flash flash            # flash lights on vehicle \"flash\"\n```\n\n---\n\n## vehicle_data.py - Read Vehicle Data\n\nFetch vehicle data with human-readable output by default.\n\n### Usage\n\n```bash\nvehicle_data.py [VEHICLE] [flags] [--json]\n```\n\n- `VEHICLE` - Vehicle name or VIN (optional if single vehicle)\n- No flags = all data\n- `--json` = raw JSON output\n\n### Flags\n\n| Flag | Long | Data |\n|------|------|------|\n| `-c` | `--charge` | Battery level, charge limit, charging status |\n| `-t` | `--climate` | Interior/exterior temp, HVAC status |\n| `-d` | `--drive` | Gear, speed, power, heading |\n| `-l` | `--location` | GPS coordinates |\n| `-s` | `--state` | Locks, doors, windows, odometer, software |\n| `-g` | `--gui` | GUI settings (units, 24h time) |\n| | `--config-data` | Vehicle config (model, color, wheels) |\n\n### Examples\n\n```bash\n# All data\nvehicle_data.py\nvehicle_data.py flash\n\n# Specific data\nvehicle_data.py -c                        # charge only\nvehicle_data.py -c -t                     # charge + climate\nvehicle_data.py flash -c -l               # charge + location\n\n# Raw JSON\nvehicle_data.py --json\nvehicle_data.py -c --json\n```\n\n### Sample Output\n\n```\n🚗 My Tesla (online)\n   VIN: 5YJ... (redacted)\n\n⚡ Charge State\n────────────────────────────────────────\n  Battery:    [███████████████░░░░░] 78%\n  Limit:      80%\n  State:      Charging\n  Power:      11 kW (16A × 234V × 3φ)\n  Added:      37.2 kWh\n  Remaining:  10m\n  Range:      438 km (272 mi)\n  Cable:      IEC\n\n🌡️  Climate State\n────────────────────────────────────────\n  Inside:     11.9°C\n  Outside:    6.0°C\n  Set to:     20.5°C\n  Climate:    Off\n```\n\n---\n\n## auth.py - Authentication\n\nManage OAuth tokens and configuration.\n\n### Usage\n\n```bash\nauth.py <command> [options]\n```\n\n### Commands\n\n#### Login (OAuth Flow)\n```bash\nauth.py login\n```\nInteractive: generates auth URL, prompts for code, exchanges for tokens.\n\n#### Exchange Code\n```bash\nauth.py exchange <code>\n```\nExchange authorization code for tokens (non-interactive).\n\n#### Refresh Tokens\n```bash\nauth.py refresh\n```\nRefresh access token. Note: refresh tokens rotate - the new one is saved automatically.\n\n#### Register Domain\n```bash\nauth.py register --domain <domain>\n```\nRegister your app domain with Tesla (required for signed commands).\n\nAfter registration, enroll your virtual key:\n```\nhttps://tesla.com/_ak/<domain>\n```\n\n#### Show Config\n```bash\nauth.py config\n```\nDisplay current configuration (secrets redacted).\n\n#### Set Config\n```bash\nauth.py config set [options]\n```\n\nOptions:\n- `--client-id <id>`\n- `--client-secret <secret>`\n- `--redirect-uri <uri>`\n- `--audience <url>`\n- `--base-url <url>`\n- `--ca-cert <path>`\n- `--domain <domain>`\n\n**Examples:**\n```bash\n# Initial setup\nauth.py config set \\\n  --client-id \"abc123\" \\\n  --client-secret \"secret\" \\\n  --redirect-uri \"http://localhost:18080/callback\"\n\n# Configure proxy\nauth.py config set \\\n  --base-url \"https://localhost:4443\" \\\n  --ca-cert \"/path/to/tls-cert.pem\"\n```\n\n---\n\n## tesla_fleet.py - List Vehicles\n\nList vehicles with human-readable output.\n\n```bash\npython3 scripts/tesla_fleet.py vehicles\npython3 scripts/tesla_fleet.py vehicles --json\n```\n\n### Sample Output\n\n```\n🚗 Name:   My Tesla\n🔖 VIN:    5YJ... (redacted)\n🟢 Status: Online\n👤 Access: Owner\n```\n\n---\n\n## Configuration / Proxy / File layout\n\nAll setup + configuration is documented in **[SETUP.md](SETUP.md)**.\n\n---\n\n## Regional Base URLs\n\n| Region | Audience URL |\n|--------|--------------|\n| Europe | `https://fleet-api.prd.eu.vn.cloud.tesla.com` |\n| North America | `https://fleet-api.prd.na.vn.cloud.tesla.com` |\n| China | `https://fleet-api.prd.cn.vn.cloud.tesla.cn` |\n\nOAuth token endpoint (all regions):\n```\nhttps://fleet-auth.prd.vn.cloud.tesla.com/oauth2/v3/token\n```\n\n---\n\n## Troubleshooting\n\n### \"vehicle unavailable: vehicle is offline or asleep\"\nWake the vehicle first:\n```bash\ncommand.py wake\n```\n\n### \"command not signed\" / \"vehicle rejected\"\nEnsure the signing proxy is running and configured. See [SETUP.md](SETUP.md) § Proxy Setup.\n\n### Token expired\n```bash\nauth.py refresh\n```\n\n### Multiple vehicles\nSpecify vehicle by name or VIN:\n```bash\ncommand.py flash climate start\ncommand.py 5YJ... honk\n```\n\n---\n\n## Complete Command Reference\n\n### command.py\n\n```\nclimate start|stop\nclimate temps <driver> [passenger]\nclimate keeper off|keep|dog|camp\n\nseat-heater -l <level> [-p <position>]\nseat-cooler -l <level> [-p <position>]\nseat-climate [-p <position>] auto|on|off\n\nsteering-heater on|off\n\nprecondition add -t <HH:MM> [-d <days>] [--id <id>] [--one-time]\nprecondition remove --id <id>\n\ncharge start|stop\ncharge limit <percent>\n\nlock\nunlock\nhonk\nflash\nwake\n```\n\n### vehicle_data.py\n\n```\n[VEHICLE] [-c] [-t] [-d] [-l] [-s] [-g] [--config-data] [--json]\n```\n\n### auth.py\n\n```\nlogin\nexchange <code>\nrefresh\nregister --domain <domain>\nconfig\nconfig set [--client-id] [--client-secret] [--redirect-uri] [--audience] [--base-url] [--ca-cert] [--domain]\n```\n","tags":{"latest":"1.5.2"},"stats":{"comments":0,"downloads":3931,"installsAllTime":11,"installsCurrent":11,"stars":1,"versions":16},"createdAt":1769409711632,"updatedAt":1778485852489},"latestVersion":{"version":"1.5.2","createdAt":1774862418743,"changelog":"Direct Fleet API reads, automatic 401 refresh, clearer offline reporting, direct wake flow, and robust proxy path resolution.","license":"MIT-0"},"metadata":{"setup":[{"key":"TESLA_CLIENT_ID","required":true},{"key":"TESLA_CLIENT_SECRET","required":true}],"os":null,"systems":null},"owner":{"handle":"odrobnik","userId":"s175mv7e1vzhser8sz79yq23fd83h54z","displayName":"Oliver Drobnik","image":"https://avatars.githubusercontent.com/u/333270?v=4"},"moderation":null}