{"id":27858,"library":"ha-garmin","title":"ha-garmin","description":"Python client for the Garmin Connect API. Version 0.1.19 supports Garmin SSO/Loading (OAuth1/OAuth2) authentication and provides methods to fetch activities, body composition, daily summaries, heart rate, sleep, stress, fitness age, training readiness, and more. Features include automatic token refresh and activity upload. Released under MIT license, with regular updates.","status":"active","version":"0.1.19","language":"python","source_language":"en","source_url":"https://github.com/cyberjunky/ha-garmin","tags":["garmin","fitness","api-client","health"],"install":[{"cmd":"pip install ha-garmin","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for bypassing Cloudflare protection on Garmin endpoints.","package":"cloudscraper","optional":false},{"reason":"HTTP library for API calls.","package":"requests","optional":false},{"reason":"Used for OAuth1 flow.","package":"requests_oauthlib","optional":false},{"reason":"Date parsing utilities.","package":"python-dateutil","optional":false}],"imports":[{"note":"PyPI package name is ha-garmin, but import uses garminconnect. Do not use underscore.","wrong":"from ha_garmin import Garmin","symbol":"Garmin","correct":"from garminconnect import Garmin"}],"quickstart":{"code":"import os\nfrom garminconnect import Garmin\n\napi = Garmin(\n    email=os.environ.get('GARMIN_EMAIL', ''),\n    password=os.environ.get('GARMIN_PASSWORD', '')\n)\napi.login()\n\n# Fetch today's activities\nactivities = api.get_activities(0, 10)\nprint(activities)\n\n# Fetch daily summary\nsummary = api.get_daily_summary('2025-01-15')\nprint(summary)","lang":"python","description":"Basic login and data retrieval. Set environment variables GARMIN_EMAIL and GARMIN_PASSWORD."},"warnings":[{"fix":"Update to v0.1.19: pip install --upgrade ha-garmin","message":"In v0.1.18 and earlier, the 'get_lactate_threshold' method could discard heart rate data. Upgrade to v0.1.17+ for fixed behavior.","severity":"breaking","affected_versions":"<=0.1.17"},{"fix":"Upgrade to v0.1.16+.","message":"In v0.1.16, Chinese accounts must use the correct domain. The fix routes diauth to diauth.garmin.cn. If you got '400 invalid_grant', upgrade to v0.1.16+.","severity":"breaking","affected_versions":"<0.1.16"},{"fix":"Upgrade to v0.1.17+.","message":"The Garmin API sometimes returns 'mostRecentVO2Max' as a bare float instead of a dict. In older versions this caused AttributeError.","severity":"gotcha","affected_versions":"<0.1.17"},{"fix":"Always call api.login() after creating a new instance, or catch exceptions.","message":"Token refresh is automatic, but if you clear tokens or have network issues, login may fail. Ensure 'is_logged_in' check before sensitive operations.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Upgrade to v0.1.16+ which routes to diauth.garmin.cn.","cause":"Chinese Garmin accounts need CN-specific endpoint.","error":"400 invalid_grant"},{"fix":"Upgrade to v0.1.17+.","cause":"Garmin API returns mostRecentVO2Max as float instead of dict in some cases.","error":"AttributeError: 'float' object has no attribute 'get'"},{"fix":"Use 'from garminconnect import Garmin' (not 'ha_garmin').","cause":"Installed package 'ha-garmin' but used wrong import path.","error":"ModuleNotFoundError: No module named 'garminconnect'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}