fix: read sleep respiration average from the correct API field - #427
Conversation
daily_sleep.avg_respiration_value was aliased to 'avgRespirationValue', which never matches anything in a real Garmin response. Confirmed live against cyberjunky/home-assistant-garmin_connect's ha-garmin client (same bug, same root cause, fixed there in ha-garmin#28): Garmin's sleep-service dailySleepData nests the sleep-window average under 'averageRespirationValue'. lowestRespirationValue/highestRespirationValue were already correct - only the average field name was wrong.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughThe sleep DTO now maps ChangesSleep respiration alias
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The focused alias correction is covered by its updated test and presents no actionable merge risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
Summary
DailySleepDTO.avg_respiration_valueis aliased to"avgRespirationValue", which never matches a real Garmin response — the sleep-servicedailySleepDataendpoint nests the sleep-window average underaverageRespirationValue.lowestRespirationValue/highestRespirationValuewere already correct; only the average was wrong.Found and confirmed live via a debug-log capture in cyberjunky/home-assistant-garmin_connect's
ha-garminclient, which had the exact same bug (same field, same wrong name) — fixed there in cyberjunky/ha-garmin#28. Real response had'averageRespirationValue': 15.0alongside workingdeepSleepSeconds,sleepScores, etc., proving the endpoint itself is fine and only this one field alias was wrong.Fix
Alias corrected to
averageRespirationValue. Test fixture/assertion updated to match the real field name.Summary by CodeRabbit
Bug Fixes
Tests