Skip to content

feat: support custom bpm heart-rate range in create_run_workout - #224

Merged
Taxuspt merged 2 commits into
mainfrom
apply/202-custom-hr-bpm-range
Jul 28, 2026
Merged

feat: support custom bpm heart-rate range in create_run_workout#224
Taxuspt merged 2 commits into
mainfrom
apply/202-custom-hr-bpm-range

Conversation

@Taxuspt

@Taxuspt Taxuspt commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Applies the changes from contributor PR #202 (by @mmccomiskey). Adds optional hr_min/hr_max parameters to create_run_workout for creating workouts with custom heart-rate bpm targets rather than named zones.

Changes

  • workout_builders.py: add _hr_target() helper that builds the correct targetType dict for either a custom bpm range (hr_min+hr_max) or a named HR zone (hr_zone)
  • workout_builders.py: add hr_min and hr_max optional parameters to build_run_json() and create_run_workout()
  • Validation: both bounds must be provided together; min must be less than max

Tests

  • Unit: test_build_run_json_custom_hr_range, test_build_run_json_custom_hr_range_requires_both_bounds, test_build_run_json_custom_hr_range_rejects_inverted_bounds
  • Integration: test_create_run_workout_custom_hr_range
  • All 13 tests pass

🤖 Generated with Claude Code

mmccomiskey and others added 2 commits July 21, 2026 10:48
Named Garmin zones (Z1-Z5) don't always match a real training target -
e.g. a 136-148 bpm Zone 2 goal straddles Garmin's Z2 (118-137) and Z3
(138-157). Previously create_run_workout only accepted hr_zone, so the
watch would show "in range" for the whole zone (up to 157 bpm) even
when the actual target ceiling was lower, silently misleading the
in-workout HR feedback.

Add optional hr_min/hr_max params that build a custom bpm-range target
(targetValueOne/targetValueTwo) instead of a zoneNumber, matching a
range Garmin Connect already supports natively but this tool didn't
expose. hr_zone remains the default and is ignored when a range is
given. Verified against the live Garmin Connect API: the custom range
round-trips correctly with no zoneNumber set.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…n-workout' into apply/202-custom-hr-bpm-range
@Taxuspt
Taxuspt merged commit d38dd64 into main Jul 28, 2026
9 checks passed
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.

2 participants