Garmin Health Report
Generate professional daily health reports from Garmin Connect data with advanced running analysis.
Features:
- - Sleep Analysis: Duration, stages (deep/light/REM), scores, and 7-dimension quality ratings
- Heart Rate Monitoring: Resting HR with recovery status
- Activity Tracking: Steps, distance, floors, goal completion
- Professional Running Metrics:
- Heart Rate Zones (Zone 1-5 distribution)
- TRIMP (Training Impulse) load calculation
- Jack Daniels VDOT estimation with training paces
- Personalized recovery and training advice
- - 7-Day Trend Analysis: Activity patterns and consistency tracking
- Personalized Recommendations: Sleep tips, step goals, training insights
Regional Support: Works with both Garmin.com (international) and Garmin.cn (China region) accounts.
Quick Start
1. Install Dependencies
This skill requires Python 3.8 or higher and garth library:
CODEBLOCK0
2. Authenticate with Garmin Connect
First time setup requires authentication with Garmin Connect:
CODEBLOCK1
Follow prompts to enter your Garmin Connect username and password. Tokens will be securely stored in ~/.garmin-health-report/tokens.json.
For China Region Users (garmin.cn):
Create a config file before authenticating:
CODEBLOCK2
Then run python3 authenticate.py.
3. Generate Health Report
Generate a report for today or any specific date:
CODEBLOCK3
4. (Optional) Automate with Cron
To automatically generate daily health reports, add to your crontab:
CODEBLOCK4
Usage Examples
CODEBLOCK5
Understanding the Metrics
Heart Rate Zones
| Zone | Intensity | Purpose | % HRR |
|---|
| 1 | Recovery | Warm-up, recovery | <50% |
| 2 |
Aerobic Base | Build foundation | 50-60% |
| 3 | Aerobic Endurance | Improve endurance | 60-70% |
| 4 | Lactate Threshold | Raise threshold | 70-80% |
| 5 | VO2Max | Maximal intensity | >80% |
TRIMP (Training Impulse)
A measure of training load combining duration and intensity:
- - <100: Light load - recovery days
- 100-200: Moderate load - daily training
- 200-300: High load - needs recovery
- >300: Very high load - recommend rest
VDOT (VDot O₂max)
Estimate of running aerobic capacity (based on Jack Daniels' Running Formula). Higher VDOT = faster race pace potential.
VDOT is used to calculate optimal training paces:
- - E (Easy): Recovery and base building
- M (Marathon): Marathon race pace
- T (Threshold): Tempo/lactate threshold
- I (Interval): Speed intervals
- R (Repetition): Repetitions/sprints
Output Format
The report generates a beautifully formatted text output:
CODEBLOCK6
Configuration
Edit the configuration section at the top of health_daily_report.py:
CODEBLOCK7
Setting USER_RESTING_HR and USER_AGE improves accuracy of:
- - Heart rate zone calculations
- TRIMP (Training Impulse) estimation
- Recovery status assessment
If not set, defaults will be used (Age: 30, Resting HR: 60).
Troubleshooting
Error: garth not installed
CODEBLOCK8
Solution: Install garth:
CODEBLOCK9
Error: Not authenticated
CODEBLOCK10
Solution: Run python3 authenticate.py to authenticate with Garmin Connect.
China Region Issues
CODEBLOCK11
Privacy & Data
- - All data is retrieved from your personal Garmin Connect account
- Tokens are stored locally in INLINECODE7
- No data is sent to third-party servers beyond Garmin's API
- Health history is stored locally in INLINECODE8
- Token files have restricted permissions (600: owner read/write only)
Differences from Original (garmer-based Version)
This version uses garth directly instead of garmer:
✅ Simpler dependency - Only requires garth (a single library)
✅ Same features - All original functionality preserved:
- Sleep analysis
- Heart rate monitoring
- Steps tracking
- Activity analysis
- Professional running metrics (HR Zones, TRIMP, VDOT)
- 7-day trend analysis
- Personalized recommendations
Why the change?
- - Removes complex dependency chain (garmer → garth)
- Uses the underlying Garmin Connect library directly
- Easier to install (
pip3 install garth vs dealing with garmer's issues) - Better error handling and debugging
License
MIT License - See LICENSE file for details.
Credits
- - Uses garth library for Garmin Connect API access
- Jack Daniels VDOT formulas based on "Daniels' Running Formula"
- TRIMP calculation using Banister's equation
Garmin Health Report
从Garmin Connect数据生成专业的每日健康报告,并包含高级跑步分析功能。
功能特性:
- - 睡眠分析:睡眠时长、阶段(深睡/浅睡/快速眼动)、评分及7维度质量评级
- 心率监测:静息心率及恢复状态
- 活动追踪:步数、距离、楼层数、目标完成度
- 专业跑步指标:
- 心率区间(第1-5区间分布)
- TRIMP(训练冲量)负荷计算
- Jack Daniels VDOT估算及训练配速
- 个性化恢复与训练建议
- - 7天趋势分析:活动模式与一致性追踪
- 个性化建议:睡眠建议、步数目标、训练洞察
区域支持:支持Garmin.com(国际版)和Garmin.cn(中国区)账号。
快速开始
1. 安装依赖
本技能需要Python 3.8或更高版本以及garth库:
bash
安装garth(Garmin Connect认证库)
pip3 install garth
验证安装
python3 -c import garth; print(garth安装成功)
2. 认证Garmin Connect
首次使用需要进行Garmin Connect认证:
bash
进入技能目录
cd ~/.agents/skills/garmin-health-report
运行认证脚本
python3 authenticate.py
按照提示输入您的Garmin Connect用户名和密码。令牌将安全存储在~/.garmin-health-report/tokens.json中。
中国区用户(garmin.cn):
在认证前创建配置文件:
bash
mkdir -p ~/.garmin-health-report
cat > ~/.garmin-health-report/config.json << EOF
{
is_cn: true,
log_level: INFO
}
EOF
然后运行python3 authenticate.py。
3. 生成健康报告
生成今日或任意指定日期的报告:
bash
今日报告
python3 health
dailyreport.py
指定日期
python3 health
dailyreport.py 2025-01-15
保存到文件
python3 health
dailyreport.py > ~/health
report$(date +%Y-%m-%d).txt
4. (可选)使用Cron自动化
要自动生成每日健康报告,请添加到crontab:
bash
crontab -e
添加此行以在23:00生成每日报告
0 23
* /usr/bin/python3 /path/to/health
dailyreport.py >> /path/to/health_report.log 2>&1
使用示例
bash
生成今日报告
python3 health
dailyreport.py
生成指定日期报告
python3 health
dailyreport.py 2026-03-01
检查认证状态
python3 authenticate.py
退出登录并删除已保存的令牌
python3 authenticate.py
然后按提示选择y退出登录
指标解读
心率区间
有氧基础 | 建立基础 | 50-60% |
| 3 | 有氧耐力 | 提升耐力 | 60-70% |
| 4 | 乳酸阈值 | 提高阈值 | 70-80% |
| 5 | 最大摄氧量 | 最大强度 | >80% |
TRIMP(训练冲量)
结合时长和强度的训练负荷衡量指标:
- - <100:轻度负荷 - 恢复日
- 100-200:中度负荷 - 日常训练
- 200-300:高负荷 - 需要恢复
- >300:极高负荷 - 建议休息
VDOT(最大摄氧量估值)
跑步有氧能力估算(基于Jack Daniels跑步公式)。VDOT越高,比赛配速潜力越大。
VDOT用于计算最佳训练配速:
- - E(轻松跑):恢复和基础建设
- M(马拉松配速):马拉松比赛配速
- T(阈值跑):节奏跑/乳酸阈值
- I(间歇跑):速度间歇
- R(重复跑):重复跑/冲刺
输出格式
报告生成格式精美的文本输出:
📅 2026-03-01 健康日报
============================================================
😴 睡眠质量
总睡眠:7.7 小时
└─ 深睡:1.4h (18%) | 浅睡:4.5h (58%) | REM:1.9h (24%)
睡眠评分:82 (良好)
💓 心率监测
静息心率:57 bpm 💙
👟 活动量
今日步数:13620 步
步数目标:10000 步
完成度:136.2%
...
💪 运动数据分析(专业版)
... (详细心率区间、TRIMP、VDOT分析)
💡 J.A.R.V.I.S.有话说
... (个性化洞察)
📈 长期趋势(过去7天)
... (7天模式分析)
============================================================
💪 今天运动量很充足!继续保持!
✨ 明天加油!💪
配置
编辑healthdailyreport.py顶部的配置部分:
python
健康历史文件(用于7天趋势分析)
HISTORY
FILE = os.path.expanduser(~/.garminhealth_report/history.json)
用户资料(可选,用于更准确的心率区间计算)
USER
RESTINGHR = None # 例如:53
USER_AGE = None # 例如:25
设置USERRESTINGHR和USER_AGE可提高以下方面的准确性:
- - 心率区间计算
- TRIMP(训练冲量)估算
- 恢复状态评估
如果未设置,将使用默认值(年龄:30,静息心率:60)。
故障排除
错误:garth未安装
ModuleNotFoundError: No module named garth
解决方案: 安装garth:
bash
pip3 install garth
错误:未认证
Error: Not authenticated.
Run python3 authenticate.py first.
解决方案: 运行python3 authenticate.py进行Garmin Connect认证。
中国区问题
bash
验证配置
cat ~/.garmin-health-report/config.json
应显示:{is_cn: true, ...}
清除令牌并重新认证
rm ~/.garmin-health-report/tokens.json
python3 authenticate.py
隐私与数据
- - 所有数据均从您的个人Garmin Connect账户获取
- 令牌本地存储在~/.garmin-health-report/tokens.json
- 除Garmin API外,不会向第三方服务器发送数据
- 健康历史本地存储在~/.garminhealthreport/history.json
- 令牌文件具有受限权限(600:仅所有者读写)
与原版(基于garmer版本)的区别
此版本直接使用garth而非garmer:
✅ 更简单的依赖 - 仅需garth(单一库)
✅ 相同功能 - 保留所有原始功能:
- 睡眠分析
- 心率监测
- 步数追踪
- 活动分析
- 专业跑步指标(心率区间、TRIMP、VDOT)
- 7天趋势分析
- 个性化建议
变更原因:
- - 移除复杂的依赖链(garmer → garth)
- 直接使用底层Garmin Connect库
- 更易安装(pip3 install garth vs 处理garmer的问题)
- 更好的错误处理和调试
许可证
MIT许可证 - 详见LICENSE文件。
致谢
- - 使用garth库访问Garmin Connect API
- Jack Daniels VDOT公式基于《丹尼尔斯跑步公式》
- TRIMP计算使用Banister方程