OA0 = Omni AI 0
OA0 是一个探索 AI 的论坛
现在注册
已注册用户请  登录
OA0  ›  技能包  ›  my-tesla: 通过 Tesla Owner API 从 macOS 远程控制特斯拉车辆

my-tesla: 通过 Tesla Owner API 从 macOS 远程控制特斯拉车辆

 
  extension ·  2026-02-03 08:35:07 · 3 次点击  · 0 条评论  

名称: my-tesla
描述: 通过 Tesla Owner API 和 teslapy 库,从 macOS 控制特斯拉车辆(认证、车辆列表、状态、锁定/解锁、空调、充电、位置及额外功能)。适用于查看车辆状态或执行安全的远程指令。专为 Parth Maniar (@officialpm) 设计,具备本地认证缓存、破坏性操作的确认机制,以及适合聊天场景的状态输出。


My Tesla

作者: Parth Maniar — @officialpm

基于 teslapy 构建的 Clawdbot 实用特斯拉控制技能。

设置

要求

  • 设置环境变量 TESLA_EMAIL(您的特斯拉账户邮箱)
  • Python 3.10+

首次认证

TESLA_EMAIL="you@email.com" python3 {baseDir}/scripts/tesla.py auth

此命令将打开特斯拉登录 URL。登录后,将回调 URL 粘贴回 CLI。

  • 令牌缓存:~/.tesla_cache.json(仅限本地;尽力设置 chmod 0600 权限)
  • 可选:通过环境变量 MY_TESLA_DEFAULT_CAR 设置车辆显示名称以指定默认车辆
  • 或通过以下命令持久化本地默认设置:python3 {baseDir}/scripts/tesla.py default-car "Name"(写入 ~/.my_tesla.json;尽力设置 chmod 0600 权限)

命令

# 列出车辆
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 获取完整回溯
# (或设置 MY_TESLA_DEBUG=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` 不同,此命令输出精简的脱敏对象(不含位置信息)。
# 当车辆报告时,包含 `usable_level_percent`。
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

# 座椅加热(需安全确认)
# seat: driver|passenger|rear-left|rear-center|rear-right|3rd-left|3rd-right(或 0–6)
# level: 0–3(0=关闭)
python3 {baseDir}/scripts/tesla.py seats set driver 3 --yes

# 哨兵模式(状态为只读;开启/关闭需安全确认)
python3 {baseDir}/scripts/tesla.py sentry status
python3 {baseDir}/scripts/tesla.py sentry status --no-wake
python3 {baseDir}/scripts/tesla.py sentry on  --yes
python3 {baseDir}/scripts/tesla.py sentry off --yes

# 充电口盖
python3 {baseDir}/scripts/tesla.py charge-port status
python3 {baseDir}/scripts/tesla.py charge-port status --no-wake
python3 {baseDir}/scripts/tesla.py charge-port status --json

# 里程追踪(里程表)— 本地 SQLite
python3 {baseDir}/scripts/tesla.py mileage init
python3 {baseDir}/scripts/tesla.py mileage record --no-wake --auto-wake-after-hours 24
python3 {baseDir}/scripts/tesla.py mileage status
python3 {baseDir}/scripts/tesla.py mileage export --format csv
python3 {baseDir}/scripts/tesla.py mileage export --format csv --since-days 7
python3 {baseDir}/scripts/tesla.py mileage export --format json
python3 {baseDir}/scripts/tesla.py mileage export --format json --since-ts 1738195200

# 充电口盖打开/关闭(需安全确认)
python3 {baseDir}/scripts/tesla.py charge-port open  --yes
python3 {baseDir}/scripts/tesla.py charge-port close --yes

# 趣味 / 吸引注意
python3 {baseDir}/scripts/tesla.py honk   --yes
python3 {baseDir}/scripts/tesla.py flash  --yes

安全默认设置

部分操作需要显式确认标志:
- unlockcharge start|stop|limit|ampstrunkwindowsseats setsentry on|offhonkflashcharge-port open|closescheduled-charging set|off 需要 --yes
- location 默认输出近似位置;添加 --yes 获取精确坐标(或使用 --digits N 控制舍入精度)

隐私

  • 凭据仅本地缓存(~/.tesla_cache.json)。
  • 请勿提交令牌、日志、VIN 或位置输出。
3 次点击  ∙  0 人收藏  
登录后收藏  
目前尚无回复
0 条回复
About   ·   Help   ·    
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
Developed with Cursor