feat: support custom bpm heart-rate range in create_run_workout - #224
Merged
Conversation
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
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applies the changes from contributor PR #202 (by @mmccomiskey). Adds optional
hr_min/hr_maxparameters tocreate_run_workoutfor creating workouts with custom heart-rate bpm targets rather than named zones.Changes
workout_builders.py: add_hr_target()helper that builds the correcttargetTypedict for either a custom bpm range (hr_min+hr_max) or a named HR zone (hr_zone)workout_builders.py: addhr_minandhr_maxoptional parameters tobuild_run_json()andcreate_run_workout()Tests
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_boundstest_create_run_workout_custom_hr_range🤖 Generated with Claude Code