Skip to content

Add heart rate and power zone endpoints#378

Open
dragilla wants to merge 1 commit into
cyberjunky:masterfrom
dragilla:add-training-zone-endpoints
Open

Add heart rate and power zone endpoints#378
dragilla wants to merge 1 commit into
cyberjunky:masterfrom
dragilla:add-training-zone-endpoints

Conversation

@dragilla

@dragilla dragilla commented Jul 13, 2026

Copy link
Copy Markdown

Summary

  • add get_heart_rate_zones() for configured heart-rate profiles
  • add get_power_zones() for power zones across all supported sports
  • add get_power_zones_for_sport() with normalized and validated Garmin sport keys
  • expose the methods in the demo and update API coverage counts

Validation

  • pytest -q — 152 passed, 2 skipped
  • ruff check .
  • isort --check-only . --skip-gitignore
  • black -l 88 --check --diff .
  • mypy garminconnect tests
  • codespell README.md demo.py garminconnect/__init__.py tests/test_garmin_unit.py

Summary by CodeRabbit

  • New Features

    • Added access to configured heart-rate zones across sport profiles.
    • Added access to power zones for all supported sports or a selected sport.
    • Expanded the demonstration menu with options for viewing heart-rate, power, and cycling power zones.
    • Added input validation and normalization for sport selections.
  • Documentation

    • Updated API coverage statistics to reflect 137+ methods, including 15 advanced health metrics.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 809cc0cb-c2be-4478-b553-46a186d80667

📥 Commits

Reviewing files that changed from the base of the PR and between 2ae0eb5 and 7a1ce47.

📒 Files selected for processing (4)
  • README.md
  • demo.py
  • garminconnect/__init__.py
  • tests/test_garmin_unit.py

Walkthrough

Adds Garmin heart-rate and power-zone API methods, exposes them in the demo CLI, tests endpoint and validation behavior, and updates README API coverage statistics.

Changes

Heart-rate and power-zone API support

Layer / File(s) Summary
Zone endpoints and accessors
garminconnect/__init__.py, README.md
Adds biometric zone endpoints and accessors for heart-rate, all-sport power, and sport-specific power zones; updates documented API counts.
Demo menu integration
demo.py
Adds three Advanced Health Metrics menu options and dispatches them to the corresponding Garmin methods.
Endpoint and input validation tests
tests/test_garmin_unit.py
Verifies endpoint paths, payload passthrough, sport normalization, and invalid sport validation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Demo as execute_api_call
  participant Garmin as Garmin
  participant API as connectapi
  Demo->>Garmin: Invoke zone accessor
  Garmin->>API: Request zone endpoint
  API-->>Garmin: Return zone payload
  Garmin-->>Demo: Display payload
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding heart rate and power zone endpoints.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant