My Tesla
Author: Parth Maniar — @officialpm
A practical Tesla control skill for Clawdbot built on teslapy.
Setup
Requirements
- -
TESLA_EMAIL env var set (your Tesla account email) - Python 3.10+
First-time authentication
CODEBLOCK0
This opens a Tesla login URL. Log in, then paste the callback URL back into the CLI.
- - Token cache:
~/.tesla_cache.json (local only; best-effort chmod 0600) - Optional: set
MY_TESLA_DEFAULT_CAR to a vehicle display name to pick a default car via env var - Or persist a local default with:
python3 {baseDir}/scripts/tesla.py default-car "Name" (writes ~/.my_tesla.json; best-effort chmod 0600)
Commands
CODEBLOCK1
Safety defaults
Some actions require an explicit confirmation flag:
- -
unlock, charge start|stop|limit|amps, trunk, windows, seats set, sentry on|off, honk, flash, charge-port open|close, and scheduled-charging set|off require INLINECODE18 - INLINECODE19 is approximate by default; add
--yes for precise coordinates (or --digits N to control rounding)
Privacy
- - Credentials are cached locally only (
~/.tesla_cache.json). - Do not commit tokens, logs, VINs, or location outputs.
My Tesla
作者: Parth Maniar — @officialpm
一个基于 teslapy 构建的、适用于 Clawdbot 的实用特斯拉控制技能。
设置
环境要求
- - 设置 TESLA_EMAIL 环境变量(你的特斯拉账户邮箱)
- Python 3.10 及以上版本
首次认证
bash
TESLA_EMAIL=you@email.com python3 {baseDir}/scripts/tesla.py auth
这将打开一个特斯拉登录 URL。登录后,将回调 URL 粘贴回命令行界面。
- - 令牌缓存:~/.teslacache.json(仅本地存储;尽力设置权限为 0600)
- 可选:通过设置 MYTESLADEFAULTCAR 环境变量为车辆显示名称,来指定默认车辆
- 或者通过以下命令持久化本地默认车辆:python3 {baseDir}/scripts/tesla.py default-car 名称(写入 ~/.my_tesla.json;尽力设置权限为 0600)
命令
bash
列出车辆
python3 {baseDir}/scripts/tesla.py list
python3 {baseDir}/scripts/tesla.py list --json # 机器可读,保护隐私
版本信息
python3 {baseDir}/scripts/tesla.py version
python3 {baseDir}/scripts/tesla.py --version
调试
如果出现意外失败,添加 --debug 可获取完整回溯信息
(或设置 MYTESLADEBUG=1)
python3 {baseDir}/scripts/tesla.py --debug status --no-wake
选择车辆(可选)
--car 接受:精确名称、部分名称(子字符串匹配)或来自 list 的基于 1 的索引
python3 {baseDir}/scripts/tesla.py --car Model status
python3 {baseDir}/scripts/tesla.py --car 1 report
设置默认车辆(当未传递 --car 时使用)
python3 {baseDir}/scripts/tesla.py default-car My Model 3
单行摘要(最适合聊天场景)
python3 {baseDir}/scripts/tesla.py summary
python3 {baseDir}/scripts/tesla.py summary --no-wake # 不唤醒休眠车辆
JSON 格式摘要(保护隐私)
与 status --json 不同,此命令输出一个经过清理的小型对象(不含位置信息)。
当车辆报告时,包含 usablelevelpercent。
python3 {baseDir}/scripts/tesla.py summary --json
python3 {baseDir}/scripts/tesla.py summary --json --raw-json # 原始 vehicle_data(可能包含位置信息)
单屏报告(适合聊天,更详细)
包含电池/充电/气候信息 +(可用时)TPMS 胎压信息。
当车辆报告时,包含可用电池信息(有助于了解电池健康/衰减情况)。
可用时,还包含快速的车门/后备箱/前备箱/车窗状态摘要。
可用时,包含紧凑的座椅加热器摘要行。
当车辆报告时,包含预定出发/预处理/非高峰充电状态。
python3 {baseDir}/scripts/tesla.py report
python3 {baseDir}/scripts/tesla.py report --no-wake
详细状态
python3 {baseDir}/scripts/tesla.py status
python3 {baseDir}/scripts/tesla.py status --no-wake
python3 {baseDir}/scripts/tesla.py status --summary # 包含单行摘要 + 详细输出
python3 {baseDir}/scripts/tesla.py --car My Model 3 status
JSON 输出(仅输出 JSON;适合管道传输/解析)
注意:status --json 输出 原始 vehicle_data,可能包含位置/驾驶状态信息。
除非明确需要原始数据,否则建议使用 summary --json(已清理)或 report --json(已清理)。
python3 {baseDir}/scripts/tesla.py summary --json # 已清理的摘要对象(不含位置信息)
python3 {baseDir}/scripts/tesla.py report --json # 已清理的报告对象(不含位置信息;包含预定充电 + 充电口状态)
python3 {baseDir}/scripts/tesla.py status --json # 原始 vehicle_data(可能包含位置信息)
python3 {baseDir}/scripts/tesla.py report --json --raw-json # 原始 vehicle_data(可能包含位置信息)
python3 {baseDir}/scripts/tesla.py summary --json --raw-json # 原始 vehicle_data(可能包含位置信息)
python3 {baseDir}/scripts/tesla.py charge status --json # 包含可用电池 +(充电时)功率详情(kW/V/A)
锁定/解锁
python3 {baseDir}/scripts/tesla.py lock
python3 {baseDir}/scripts/tesla.py unlock
气候控制(状态为只读)
python3 {baseDir}/scripts/tesla.py climate status
python3 {baseDir}/scripts/tesla.py climate status --no-wake
python3 {baseDir}/scripts/tesla.py climate on
python3 {baseDir}/scripts/tesla.py climate off
python3 {baseDir}/scripts/tesla.py climate defrost on
python3 {baseDir}/scripts/tesla.py climate defrost off
python3 {baseDir}/scripts/tesla.py climate temp 72 # 默认:°F
python3 {baseDir}/scripts/tesla.py climate temp 22 --celsius
充电
python3 {baseDir}/scripts/tesla.py charge status
python3 {baseDir}/scripts/tesla.py charge status --no-wake
python3 {baseDir}/scripts/tesla.py charge start --yes
python3 {baseDir}/scripts/tesla.py charge stop --yes
python3 {baseDir}/scripts/tesla.py charge limit 80 --yes # 50–100
python3 {baseDir}/scripts/tesla.py charge amps 16 --yes # 1–48(保守限制)
预定充电(设置/关闭需安全确认)
python3 {baseDir}/scripts/tesla.py scheduled-charging status
python3 {baseDir}/scripts/tesla.py scheduled-charging status --no-wake
python3 {baseDir}/scripts/tesla.py scheduled-charging set 23:30 --yes
python3 {baseDir}/scripts/tesla.py scheduled-charging off --yes
预定出发(只读)
显示预定出发、预处理和非高峰充电标志(当车辆报告时)。
python3 {baseDir}/scripts/tesla.py scheduled-departure status
python3 {baseDir}/scripts/tesla.py scheduled-departure status --no-wake
python3 {baseDir}/scripts/tesla.py --json scheduled-departure status
位置信息(默认近似;使用 --yes 获取精确坐标)
python3 {baseDir}/scripts/tesla.py location
python3 {baseDir}/scripts/tesla.py location --no-wake
python3 {baseDir}/scripts/tesla.py location --digits 1 # 更粗略的四舍五入
python3 {baseDir}/scripts/tesla.py location --digits 3 # 稍微精确一些(仍为近似值)
python3 {baseDir}/scripts/tesla.py location --yes
胎压(TPMS)
python3 {baseDir}/scripts/tesla.py tires
python3 {baseDir}/scripts/tesla.py tires --no-wake
开口状态(车门/后备箱/车窗)
python3 {baseDir}/scripts/tesla.py openings
python3 {baseDir}/scripts/tesla.py openings --no-wake
python3 {baseDir}/scripts/tesla.py openings --json
后备箱/前备箱(需安全确认)
python3 {baseDir}/scripts/tesla.py trunk trunk --yes
python3 {baseDir}/scripts/tesla.py trunk frunk --yes
车窗
python3 {baseDir}/scripts/tesla.py windows status
python3 {baseDir}/scripts/tesla.py windows status --no-wake
python3 {baseDir}/scripts/tesla.py windows status --json
车窗控制(需安全确认)
python3 {baseDir}/scripts/tesla.py windows vent --yes
python3 {baseDir}/scripts/tesla.py windows close --yes
座椅加热
python3 {baseDir}/scripts/tesla.py seats status
python3 {baseDir}/scripts/tesla.py seats status --no-wake
python3 {baseDir}/scripts/tesla.py seats status --json
座椅加热控制(需安全确认)
座椅:driver|passenger|rear-left|rear-center|rear