Fitbit Connector Skill (Tool Provider)
Use this skill when OpenClaw needs Fitbit or unified health data.
This is the canonical front door for health / Fitbit retrieval in OpenClaw.
If a user asks for latest Fitbit numbers, recovery signals, readiness trends, sleep/HRV/resting-HR patterns, or recent health metrics for training interpretation, start here.
This skill is data-plane only:
- - it authenticates,
- fetches Fitbit data,
- syncs/cache stores normalized metrics,
- returns compact JSON.
OpenClaw handles interpretation, decisions, and coaching language.
Canonical usage rule
For ordinary question-answering, prefer this skill first.
Do not start by searching the workspace for Fitbit paths if this skill is available.
Do not prefer older opinionated helper scripts over this interface.
For training questions, combine this skill with memory/training-continuity.md:
- - this skill = latest health/recovery data
- INLINECODE1 = training state, progression rules, recent workout context
Setup
- 1. Create Fitbit developer app (type
Personal). - Redirect URI:
http://127.0.0.1:8787/callback. - Create
.env from references/env.example. - Run auth bootstrap:
-
python3 scripts/fitbit_auth.py auth-url
- approve in browser, copy
code + returned
state
- INLINECODE9
Primary front-door interface (recommended)
For most OpenClaw usage, call the narrow front door first:
This keeps retrieval typed and low-ambiguity.
Backend tool interface (compact JSON)
Direct backend contract/schema:
- - INLINECODE11
- Auth status:
-
python3 scripts/fitbit_tools.py auth-status
- - Endpoint catalog (broad API surface):
-
python3 scripts/fitbit_tools.py catalog
- - Capability discovery across last N days (rate-limit aware):
-
python3 scripts/fitbit_tools.py discover-capabilities --days 14 --sleep-ms 500 --stop-on-429
- - Direct Fitbit endpoint fetch (generic exposure):
-
python3 scripts/fitbit_tools.py fetch-endpoint --path sleep/date/YYYY-MM-DD.json --normalize
-
python3 scripts/fitbit_tools.py fetch-day --date YYYY-MM-DD
- add
--raw for full Fitbit payload
- - Fetch cached date range (field-filtered):
-
python3 scripts/fitbit_tools.py fetch-range --start YYYY-MM-DD --end YYYY-MM-DD --metrics hrv_rmssd,resting_hr,sleep_minutes,data_quality
- add
--ensure-fresh to auto-sync that range before reading
- - Fetch latest N cached days:
-
python3 scripts/fitbit_tools.py fetch-latest --days 5 --metrics hrv_rmssd,resting_hr,sleep_minutes,data_quality
- add
--ensure-fresh to auto-sync the last N days before reading
- - Sync one day from Fitbit API to cache:
-
python3 scripts/fitbit_tools.py store-sync-day --date YYYY-MM-DD
- - Sync date range from Fitbit API to cache:
-
python3 scripts/fitbit_tools.py store-sync-range --start YYYY-MM-DD --end YYYY-MM-DD
- - Query sync quality flags:
-
python3 scripts/fitbit_tools.py quality-flags --days 7
- - Unified DB status (Apple + Fitbit):
-
python3 scripts/fitbit_tools.py unified-status
- - Unified latest daily rows with source preference:
- INLINECODE26
Canonical QA patterns
Latest Fitbit / recovery snapshot
For questions like:
- - "What do my latest Fitbit numbers suggest?"
- "How does recovery look today?"
- "Give me my newest HRV / sleep / resting HR"
Prefer:
Unified health snapshot
For questions that may blend Fitbit + Apple Health:
Trend / confidence checks
When freshness or quality confidence matters:
Training interpretation
For questions like:
- - "Should I train today?"
- "How did yesterday compare to recovery?"
- "Has recovery improved since earlier this week?"
Use both:
- 1. this skill for current/recent health signals
- INLINECODE30 for training rules, progression, and recent exercise context
Notes
- - Output contract: compact JSON (machine-optimized, minimal token usage).
- Prefer narrow
--metrics lists to keep token usage low. - SQLite cache is local reliability layer; Fitbit API remains source-of-truth.
- No medical diagnosis. This skill only provides data.
Anti-patterns
If this skill is available, avoid these failure modes:
- - searching the workspace first just to locate Fitbit functionality
- asking the user where the connector lives
- preferring
fitbit_query.py over fitbit_tools.py for normal QA - treating memory references as the primary source of live Fitbit data
- using orchestrator files as the first discovery surface for ordinary health questions
Legacy scripts
Older opinionated scripts remain only for backward compatibility and should be treated as non-canonical for ordinary OpenClaw reasoning:
- - INLINECODE34
- INLINECODE35
If a normal user question can be answered through fitbit_tools.py, do that instead.
Fitbit 连接器技能(工具提供者)
当 OpenClaw 需要 Fitbit 或统一健康数据时使用此技能。
这是 OpenClaw 中健康/Fitbit 数据检索的规范主入口。
如果用户询问最新的 Fitbit 数据、恢复信号、准备趋势、睡眠/HRV/静息心率模式,或用于训练解读的近期健康指标,请从这里开始。
此技能仅处理数据层面:
- - 进行身份验证,
- 获取 Fitbit 数据,
- 同步/缓存存储标准化指标,
- 返回紧凑 JSON。
OpenClaw 负责解读、决策和教练语言。
规范使用规则
对于常规问答,优先使用此技能。
如果此技能可用,不要先在工作区中搜索 Fitbit 路径。
不要优先使用旧的固执己见的辅助脚本而非此接口。
对于训练相关问题,将此技能与 memory/training-continuity.md 结合使用:
- - 此技能 = 最新健康/恢复数据
- memory/training-continuity.md = 训练状态、进度规则、近期训练背景
设置
- 1. 创建 Fitbit 开发者应用(类型为 Personal)。
- 重定向 URI:http://127.0.0.1:8787/callback。
- 从 references/env.example 创建 .env。
- 运行身份验证引导:
- python3 scripts/fitbit_auth.py auth-url
- 在浏览器中批准,复制 code 和返回的 state
- python3 scripts/fitbit_auth.py exchange --code
--state
主要前端接口(推荐)
对于大多数 OpenClaw 使用场景,首先调用窄前端接口:
- - node ../skills/health-training-frontdoor/scripts/request.js {action:latest_recovery}
这使检索保持类型化且低歧义性。
后端工具接口(紧凑 JSON)
直接后端合约/模式:
- - python3 scripts/fitbit_tools.py schema
- 身份验证状态:
- python3 scripts/fitbit_tools.py auth-status
- python3 scripts/fitbit_tools.py catalog
- python3 scripts/fitbit_tools.py discover-capabilities --days 14 --sleep-ms 500 --stop-on-429
- python3 scripts/fitbit_tools.py fetch-endpoint --path sleep/date/YYYY-MM-DD.json --normalize
- python3 scripts/fitbit_tools.py fetch-day --date YYYY-MM-DD
- 添加 --raw 获取完整 Fitbit 负载
- python3 scripts/fitbittools.py fetch-range --start YYYY-MM-DD --end YYYY-MM-DD --metrics hrvrmssd,restinghr,sleepminutes,data_quality
- 添加 --ensure-fresh 在读取前自动同步该范围
- python3 scripts/fitbittools.py fetch-latest --days 5 --metrics hrvrmssd,restinghr,sleepminutes,data_quality
- 添加 --ensure-fresh 在读取前自动同步最近 N 天
- python3 scripts/fitbit_tools.py store-sync-day --date YYYY-MM-DD
- - 从 Fitbit API 同步日期范围到缓存:
- python3 scripts/fitbit_tools.py store-sync-range --start YYYY-MM-DD --end YYYY-MM-DD
- python3 scripts/fitbit_tools.py quality-flags --days 7
- - 统一数据库状态(Apple + Fitbit):
- python3 scripts/fitbit_tools.py unified-status
- python3 scripts/fitbit_tools.py unified-fetch-latest --days 14 --source best
规范问答模式
最新 Fitbit / 恢复快照
对于如下问题:
- - 我最新的 Fitbit 数据说明了什么?
- 今天的恢复情况如何?
- 给我最新的 HRV / 睡眠 / 静息心率
优先使用:
- - python3 scripts/fitbittools.py fetch-latest --days 3 --metrics hrvrmssd,restinghr,sleepminutes,data_quality --ensure-fresh
统一健康快照
对于可能混合 Fitbit + Apple Health 的问题:
- - python3 scripts/fitbit_tools.py unified-fetch-latest --days 14 --source best
趋势 / 置信度检查
当新鲜度或质量置信度重要时:
- - python3 scripts/fitbit_tools.py quality-flags --days 7
训练解读
对于如下问题:
- - 我今天应该训练吗?
- 昨天与恢复情况相比如何?
- 自本周早些时候以来恢复情况有所改善吗?
同时使用:
- 1. 此技能获取当前/近期健康信号
- memory/training-continuity.md 获取训练规则、进度和近期运动背景
注意事项
- - 输出合约:紧凑 JSON(机器优化,最小化 token 使用)。
- 优先使用窄 --metrics 列表以保持低 token 使用量。
- SQLite 缓存是本地可靠性层;Fitbit API 保持为数据源。
- 不提供医疗诊断。此技能仅提供数据。
反模式
如果此技能可用,避免以下失败模式:
- - 首先搜索工作区以定位 Fitbit 功能
- 询问用户连接器所在位置
- 在常规问答中优先使用 fitbitquery.py 而非 fitbittools.py
- 将内存引用视为实时 Fitbit 数据的主要来源
- 使用编排器文件作为常规健康问题的首要发现界面
遗留脚本
旧的固执己见的脚本仅保留用于向后兼容,在常规 OpenClaw 推理中应被视为非规范:
- - fitbitquery.py
- fitbitcoach_view.py
如果普通用户问题可以通过 fitbit_tools.py 回答,请使用该方式。