Tesla Skill
by @lyair1
Connect and control Tesla vehicles via the tesla-cli. Handles guided setup (key generation, AgentGen hosting, partner registration, OAuth) and all vehicle co...
clawhub install tesla-connectπ About This Skill
name: tesla-connect description: Connect and control Tesla vehicles via the tesla-cli. Handles guided setup (key generation, AgentGen hosting, partner registration, OAuth) and all vehicle commands. metadata: openclaw: emoji: "π" homepage: https://www.agent-gen.com/use-cases/tesla-control primaryEnv: AGENTGEN_API_KEY requires: bins: - teslacli install: - kind: shell cmd: "curl -fsSL https://raw.githubusercontent.com/Agent-Gen-com/tesla-cli/main/install.sh | sh" bins: [teslacli]
Tesla β Connect & Control
This skill installs and configures teslacli to connect Claude to your Tesla account. Once setup is complete, Claude can control your vehicle directly.
Prerequisites
AGENTGEN_API_KEY) β required for hosting your Tesla virtual key. Get one free at agent-gen.com.Installation
curl -fsSL https://raw.githubusercontent.com/Agent-Gen-com/tesla-cli/main/install.sh | sh
Supports macOS (Intel & Apple Silicon) and Linux (x86_64 & ARM64).
Setup
Run the interactive setup wizard:
teslacli setup
The wizard walks through six stages automatically:
1. Setup mode β choose _Agent flow_ for headless/AI use (uses headless Chrome for OAuth)
2. AgentGen origin β provisions a public subdomain using your AGENTGEN_API_KEY
3. Tesla Developer App credentials β enter client_id, client_secret, and region
4. EC key pair β generates a P-256 key pair and enrolls the public key with Tesla
5. Partner registration β registers your domain with Tesla Fleet API
6. OAuth authentication β completes the OAuth flow and stores tokens locally
Setup creates config files in ~/.config/teslacli/:
config.toml β app credentials and regiontoken.json β OAuth tokens (auto-refreshing)keys/private.pem β P-256 private key (mode 0600, never leave local machine)keys/public.pem β public key (served via AgentGen)Vehicle Commands
Always wake the vehicle first if it may be asleep, then run your command.
Vehicle:
teslacli vehicle list # List account vehicles
teslacli vehicle data # Full JSON snapshot (battery, location, state)
teslacli vehicle wake # Wake the car
teslacli vehicle lock # Lock doors
teslacli vehicle unlock # Unlock doors
teslacli vehicle flash # Flash headlights
teslacli vehicle honk # Sound horn
Climate:
teslacli climate start # Enable climate
teslacli climate stop # Disable climate
teslacli climate set-temp -t 22.5 # Set cabin temperature (Β°C)
Charging:
teslacli charge start # Start charging
teslacli charge stop # Stop charging
teslacli charge set-limit -l 80 # Set charge limit (%)
teslacli charge set-amps -a 16 # Set charging current (A)
Error Handling
| Error | Action |
| --------------------------------- | ---------------------------------------------------------- |
| 401 Unauthorized | Re-run once β teslacli refreshes the token automatically |
| Vehicle unavailable | Run teslacli vehicle wake and retry after 10β15 seconds |
| Command timeout | Vehicle may be in a no-signal area; advise the user |
| Token expired (>45 days inactive) | Re-run teslacli setup to re-authenticate |
| Any other error | Show the raw error to the user and ask how to proceed |
Critical Guardrails
~/.config/teslacli/keys/private.pem β not to any service, log, or message.~/.config/teslacli/ as a sensitive directory. Do not read its contents into a response.token.json contains OAuth tokens β treat as equally sensitive as the private key.Typical Workflow
1. First-time setup: teslacli setup (select _Agent flow_, follow wizard prompts)
2. Check battery: teslacli vehicle wake β teslacli vehicle data
3. Pre-heat car: teslacli vehicle wake β teslacli climate start β teslacli climate set-temp -t 22
4. Lock car: teslacli vehicle lock
5. Charge to 80%: teslacli vehicle wake β teslacli charge set-limit -l 80 β teslacli charge start
βοΈ Configuration
Run the interactive setup wizard:
teslacli setup
The wizard walks through six stages automatically:
1. Setup mode β choose _Agent flow_ for headless/AI use (uses headless Chrome for OAuth)
2. AgentGen origin β provisions a public subdomain using your AGENTGEN_API_KEY
3. Tesla Developer App credentials β enter client_id, client_secret, and region
4. EC key pair β generates a P-256 key pair and enrolls the public key with Tesla
5. Partner registration β registers your domain with Tesla Fleet API
6. OAuth authentication β completes the OAuth flow and stores tokens locally
Setup creates config files in ~/.config/teslacli/:
config.toml β app credentials and regiontoken.json β OAuth tokens (auto-refreshing)keys/private.pem β P-256 private key (mode 0600, never leave local machine)keys/public.pem β public key (served via AgentGen)