← 返回 Skills 市场
kesslerio

Fitbit Analytics

作者 kesslerio · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
2462
总下载
1
收藏
2
当前安装
3
版本数
在 OpenClaw 中安装
/install fitbit-analytics
功能描述
Fitbit health and fitness data integration. Fetch steps, heart rate, sleep, activity, calories, and trends from Fitbit Web API. Generate automated health reports and alerts. Requires FITBIT_CLIENT_ID, FITBIT_CLIENT_SECRET, FITBIT_ACCESS_TOKEN, FITBIT_REFRESH_TOKEN.
使用说明 (SKILL.md)

Fitbit Analytics

Quick Start

# Set Fitbit API credentials
export FITBIT_CLIENT_ID="your_client_id"
export FITBIT_CLIENT_SECRET="your_client_secret"
export FITBIT_ACCESS_TOKEN="your_access_token"
export FITBIT_REFRESH_TOKEN="your_refresh_token"

# Generate morning briefing with Active Zone Minutes
python scripts/fitbit_briefing.py

# Fetch daily steps
python scripts/fitbit_api.py steps --days 7

# Get heart rate data
python scripts/fitbit_api.py heartrate --days 7

# Sleep summary
python scripts/fitbit_api.py sleep --days 7

# Generate weekly health report
python scripts/fitbit_api.py report --type weekly

# Get activity summary
python scripts/fitbit_api.py summary --days 7

When to Use

Use this skill when:

  • Fetching Fitbit metrics (steps, calories, heart rate, sleep)
  • Analyzing activity trends over time
  • Setting up alerts for inactivity or abnormal heart rate
  • Generating daily/weekly health reports

Core Workflows

1. Daily Briefing

# Generate morning health briefing (includes Active Zone Minutes)
python scripts/fitbit_briefing.py                    # Today's briefing
python scripts/fitbit_briefing.py --date 2026-01-20  # Specific date
python scripts/fitbit_briefing.py --format brief     # 3-line summary
python scripts/fitbit_briefing.py --format json      # JSON output

# Example output includes:
# - Yesterday's activities (logged exercises)
# - Yesterday's Active Zone Minutes (total, Fat Burn, Cardio, Peak)
# - Today's activity summary (steps, calories, floors, distance)
# - Heart rate (resting, average, zones)
# - Sleep (duration, efficiency, awake episodes)
# - Trends vs 7-day average

Example JSON output:

{
  "date": "2026-01-21",
  "steps_today": 8543,
  "calories_today": 2340,
  "distance_today": 6.8,
  "floors_today": 12,
  "active_minutes": 47,
  "resting_hr": 58,
  "avg_hr": 72,
  "sleep_hours": 7.2,
  "sleep_efficiency": 89,
  "awake_minutes": 12,
  "yesterday_activities": [
    {"name": "Run", "duration": 35, "calories": 320}
  ],
  "yesterday_azm": {
    "activeZoneMinutes": 61,
    "fatBurnActiveZoneMinutes": 39,
    "cardioActiveZoneMinutes": 22
  }
}

Note: Cardio Load is NOT available via Fitbit API - it's a Fitbit Premium feature only visible in the mobile app.

2. Data Fetching (CLI)

# Available commands:
python scripts/fitbit_api.py steps --days 7
python scripts/fitbit_api.py calories --days 7
python scripts/fitbit_api.py heartrate --days 7
python scripts/fitbit_api.py sleep --days 7
python scripts/fitbit_api.py summary --days 7
python scripts/fitbit_api.py report --type weekly

3. Data Fetching (Python API)

export PYTHONPATH="{baseDir}/scripts"
python - \x3C\x3C'PY'
from fitbit_api import FitbitClient

client = FitbitClient()  # Uses env vars for credentials

# Fetch data (requires start_date and end_date)
steps_data = client.get_steps(start_date="2026-01-01", end_date="2026-01-16")
hr_data = client.get_heartrate(start_date="2026-01-01", end_date="2026-01-16")
sleep_data = client.get_sleep(start_date="2026-01-01", end_date="2026-01-16")
activity_summary = client.get_activity_summary(start_date="2026-01-01", end_date="2026-01-16")
PY

4. Analysis

export PYTHONPATH="{baseDir}/scripts"
python - \x3C\x3C'PY'
from fitbit_api import FitbitAnalyzer

analyzer = FitbitAnalyzer(steps_data, hr_data)
summary = analyzer.summary()
print(summary)  # Returns: avg_steps, avg_resting_hr, step_trend
PY

5. Alerts

python {baseDir}/scripts/alerts.py --days 7 --steps 8000 --sleep 7

Scripts

  • scripts/fitbit_api.py - Fitbit Web API wrapper, CLI, and analysis
  • scripts/fitbit_briefing.py - Morning briefing CLI (text/brief/json output)
  • scripts/alerts.py - Threshold-based notifications

Available API Methods

Method Description
get_steps(start, end) Daily step counts
get_calories(start, end) Daily calories burned
get_distance(start, end) Daily distance
get_activity_summary(start, end) Activity summary
get_heartrate(start, end) Heart rate data
get_sleep(start, end) Sleep data
get_sleep_stages(start, end) Detailed sleep stages
get_spo2(start, end) Blood oxygen levels
get_weight(start, end) Weight measurements
get_active_zone_minutes(start, end) Active Zone Minutes (AZM) breakdown

References

  • references/api.md - Fitbit Web API documentation
  • references/metrics.md - Metric definitions and interpretations

Authentication

Fitbit API requires OAuth 2.0 authentication:

  1. Create app at: https://dev.fitbit.com/apps
  2. Get client_id and client_secret
  3. Complete OAuth flow to get access_token and refresh_token
  4. Set environment variables or pass to scripts

Environment

Required:

  • FITBIT_CLIENT_ID
  • FITBIT_CLIENT_SECRET
  • FITBIT_ACCESS_TOKEN
  • FITBIT_REFRESH_TOKEN

Automation (Cron Jobs)

Cron jobs are configured in OpenClaw's gateway, not in this repo. Add these to your OpenClaw setup:

Daily Morning Briefing (8:00 AM)

openclaw cron add \
  --name "Morning Fitbit Health Report" \
  --cron "0 8 * * *" \
  --tz "America/Los_Angeles" \
  --session isolated \
  --wake next-heartbeat \
  --deliver \
  --channel telegram \
  --target "\x3CYOUR_TELEGRAM_CHAT_ID>" \
  --message "python3 /path/to/your/scripts/fitbit_briefing.py --format text"

Note: Replace /path/to/your/ with your actual path and \x3CYOUR_TELEGRAM_CHAT_ID> with your Telegram channel/group ID.

安全使用建议
This skill appears to implement Fitbit API access and reporting as described, but review the following before installing: - The code will read from and write to ~/.config/systemd/user/secrets.conf (and will create ~/.fitbit-analytics/tokens.json). If you run it, it will attempt to persist refreshed access/refresh tokens into that secrets.conf file and set file permissions. Ensure that file is not used for unrelated secrets you don't want overwritten. - If you prefer not to have tokens persisted to that shared secrets file, run scripts with explicit env vars (export FITBIT_ACCESS_TOKEN and FITBIT_REFRESH_TOKEN) or modify the code to use a dedicated secrets file. Inspect scripts/fitbit_api.py to confirm exactly what will be written. - The skill contacts only Fitbit endpoints (api.fitbit.com) for data and dev.fitbit.com for setup — there are no other remote endpoints in the code. Still, review the files yourself before granting client_secret/refresh token access. - Limit the permissions of the Fitbit app to only the scopes you need. Treat client_secret and refresh token as sensitive: store them in a dedicated, secure secrets store if possible. - If you are unsure, run the scripts in an isolated account or container and observe file writes (secrets.conf, ~/.fitbit-analytics) to confirm behavior before enabling automation/cron or granting persistent access.
功能分析
Type: OpenClaw Skill Name: fitbit-analytics Version: 1.0.0 The skill is designed to integrate with the Fitbit API, fetching and analyzing health data. It is classified as suspicious due to the `scripts/fitbit_api.py` script's capability to read from and write updated Fitbit API tokens to sensitive user configuration files: `~/.config/systemd/user/secrets.conf` and `~/.fitbit-analytics/tokens.json`. While this behavior is intended for legitimate token persistence and auto-refresh, modifying system-level or user-specific secrets files represents a high-risk capability that could be exploited if not handled with extreme care, even though the current implementation appears to set appropriate file permissions (owner-only read/write).
能力评估
Purpose & Capability
Name, description, required env vars (FITBIT_CLIENT_ID, FITBIT_CLIENT_SECRET, FITBIT_ACCESS_TOKEN, FITBIT_REFRESH_TOKEN) and required binary (python3) all align with a Fitbit Web API integration. The included scripts implement Fitbit endpoints and reporting features described in the SKILL.md.
Instruction Scope
SKILL.md instructs running the included Python scripts and setting env vars — consistent with purpose. It also suggests OpenClaw cron automation delivering outputs to channels (e.g., Telegram). The runtime instructions and CLI usages stay within Fitbit data collection and reporting; they do not instruct collection of unrelated system files or network endpoints beyond Fitbit/dev.fitbit.com.
Install Mechanism
No install spec or external downloads are used; this is an instruction-only skill with Python scripts included. Risk from install mechanism is low because nothing is fetched from arbitrary URLs and no package managers are invoked.
Credentials
Although the declared env vars match Fitbit, the code also reads and writes a secrets file at ~/.config/systemd/user/secrets.conf and persists tokens to ~/.fitbit-analytics/tokens.json. The registry metadata did not declare these config paths. Writing to a user secrets file in the home directory (and updating tokens there) is a broader filesystem/credential footprint than the SKILL.md explicitly declares and could overwrite or mix with other stored secrets.
Persistence & Privilege
The client auto-refreshes tokens and persists them to disk (secrets.conf and a token cache), and sets file permissions. Persisting refresh tokens and access tokens on the user's filesystem is expected for long-running integrations, but it is a permanent change to user files and therefore higher privilege than a read-only skill. This behavior should be disclosed up-front in the registry metadata (required config paths) and verified by the user.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install fitbit-analytics
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /fitbit-analytics 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial ClawHub release
v0.1.1
Update ClawdHub badge to listed and add GitHub repo link
v0.1.0
Initial release: docs alignment + metadata
元数据
Slug fitbit-analytics
版本 1.0.0
许可证
累计安装 2
当前安装数 2
历史版本数 3
常见问题

Fitbit Analytics 是什么?

Fitbit health and fitness data integration. Fetch steps, heart rate, sleep, activity, calories, and trends from Fitbit Web API. Generate automated health reports and alerts. Requires FITBIT_CLIENT_ID, FITBIT_CLIENT_SECRET, FITBIT_ACCESS_TOKEN, FITBIT_REFRESH_TOKEN. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 2462 次。

如何安装 Fitbit Analytics?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install fitbit-analytics」即可一键安装,无需额外配置。

Fitbit Analytics 是免费的吗?

是的,Fitbit Analytics 完全免费(开源免费),可自由下载、安装和使用。

Fitbit Analytics 支持哪些平台?

Fitbit Analytics 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Fitbit Analytics?

由 kesslerio(@kesslerio)开发并维护,当前版本 v1.0.0。

💬 留言讨论