Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

GitHub Release GitHub Activity License Project Maintenance

Donate via PayPal Sponsor on GitHub

Garmin Connect

The Garmin Connect integration connects your Garmin Connect cloud service to Home Assistant, enabling users to monitor their health and fitness data from Garmin wearable devices directly in Home Assistant.

The integration provides 130+ sensors across the following categories:

  • Daily health metrics — Steps, distance, floors climbed, calories burned
  • Heart rate monitoring — Resting, min, max, and 7-day average heart rate
  • HRV (Heart Rate Variability) — Status, weekly/nightly averages, baseline metrics
  • Stress tracking — Average/max stress levels, stress duration breakdowns
  • Sleep analysis — Total sleep, deep/light/REM sleep, sleep score, sleep need, bedtime/wake targets
  • Body Battery — Current level, charged/drained values
  • Body composition — Weight, BMI, body fat, muscle mass, bone mass, hydration
  • Training metrics — Training readiness, training status, lactate threshold, endurance/hill scores, power-to-weight and FTP by sport
  • Activities & workouts — Last activity, recent activities list, workout tracking
  • Goals & badges — Active/future goals, goal history, earned badges
  • Blood pressure — Systolic, diastolic, pulse measurements
  • Menstrual cycle tracking — Cycle phase, day, fertile window (disabled by default)
  • Gear tracking — Dynamic sensors for shoes, bikes, and other equipment
  • Hydration — Daily intake, goals, sweat loss

screenshot

Prerequisites

  • A Garmin Connect account
  • At least one Garmin device synced to your account
  • If you have MFA (Multi-Factor Authentication) enabled, you'll need access to your authentication method during setup

Installation

HACS (Recommended)

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

Alternatively:

  1. Install HACS if not already installed
  2. Search for "Garmin Connect" in HACS
  3. Click Download
  4. Restart Home Assistant
  5. Add via SettingsDevices & Services

Manual Installation

  1. Copy custom_components/garmin_connect to your <config>/custom_components/ directory
  2. Restart Home Assistant
  3. Add via SettingsDevices & Services

Configuration

  1. Navigate to SettingsDevices & Services
  2. Click + Add Integration
  3. Search for "Garmin Connect"
  4. Enter your Garmin Connect email and password
  5. If MFA is enabled, enter the verification code when prompted

Options

After setup, configure these options via the integration's Configure button:

OptionDefaultDescription
Scan interval300How often to fetch data in seconds (60–3600)

Data updates

The integration uses cloud polling to fetch data from Garmin Connect servers. Data is refreshed based on the configured scan interval (default: 5 minutes). Nine independent coordinators fetch data in parallel:

CoordinatorData
CoreSteps, distance, calories, heart rate, stress, sleep, body battery, SpO2, respiration, intensity
ActivityLast activity, recent activities, workouts
TrainingTraining readiness/status, HRV, lactate threshold, endurance/hill scores, power-to-weight and FTP by sport
BodyWeight, BMI, body fat, muscle mass, hydration, fitness age
GoalsActive/future goals, goal history, badges, user points
GearShoes, bikes, equipment usage and distance
Blood PressureSystolic, diastolic, pulse
MenstrualCycle phase, day, fertile window
NutritionConsumed calories & macros, goals, per-meal breakdown (Connect+, disabled by default)

Tip: Garmin devices sync to Garmin Connect when in Bluetooth range of the paired phone or via WiFi. Sensors update after your device syncs to Garmin Connect and the integration polls for new data.

Sensors

All sensors are created under a single "Garmin Connect" device. Entity IDs follow the pattern sensor.garmin_connect_[sensor_name].

Note: Most sensors are enabled by default. Menstrual cycle and nutrition sensors are disabled by default and can be enabled in the entity settings. Sensor values depend on your Garmin devices and connected apps — not all data may be available for your account.

Activity & Steps

SensorDescription
StepsDaily step count
Daily Step GoalYour configured step target
DistanceDistance walked/run in meters
Yesterday Steps / DistancePrevious day's complete totals
Weekly Step / Distance Avg7-day averages
Floors Ascended / DescendedFloors climbed and descended
Floors Ascended DistanceVertical distance climbed in meters

Calories

SensorDescription
CaloriesTotal daily calories
Active CaloriesCalories from activity
BMR CaloriesBasal metabolic rate calories
Burned / Consumed / Remaining CaloriesCalorie tracking

Heart Rate

SensorDescription
Resting Heart RateDaily resting HR
Min / Max Heart RateDaily HR range
7-Day Average Resting Heart RateWeekly resting HR average
Min / Max Average Heart RateAverage min/max HR
Abnormal Heart Rate AlertsCount of abnormal HR alerts

HRV (Heart Rate Variability)

SensorDescription
HRV StatusCurrent HRV status (balanced, low, etc.)
HRV Weekly Average7-day HRV average
HRV Last Night AverageOvernight HRV average
HRV Last Night 5-Min HighPeak 5-minute HRV during sleep
HRV BaselinePersonal HRV baseline range

Stress & Recovery

SensorDescription
Average / Max Stress LevelStress measurements
Stress QualifierOverall stress descriptor
Total Stress DurationTotal time in stress
Rest / Activity / Low / Medium / High Stress DurationDuration breakdowns
Stress PercentagePercentage breakdowns by category

Sleep

SensorDescription
Sleep ScoreOverall sleep quality score
Sleep NeedTarget sleep need in minutes
Sleep DurationTotal time asleep
Total Sleep DurationTotal sleep window duration
Awake DurationTime awake during sleep
Deep / Light / REM SleepTime in each sleep stage
Bedtime / Wake TimeActual bedtime and wake timestamps
Optimal Bedtime / Optimal Wake TimeRecommended sleep timing timestamps
Nap TimeDaytime nap duration
Unmeasurable SleepUnclassified sleep time

Body Battery

SensorDescription
Body BatteryCurrent energy level (0–100)
Charged / DrainedEnergy gained and spent
Highest / LowestDaily peak and low

Body Composition

SensorDescription
WeightBody weight in kg
BMIBody Mass Index
Body Fat / Body WaterPercentage measurements
Muscle Mass / Bone MassMass measurements in kg
Visceral FatVisceral fat percentage
Physique RatingBody physique rating
Metabolic AgeEstimated metabolic age

Hydration

SensorDescription
HydrationDaily water intake (ml)
Hydration GoalTarget intake
Hydration Daily AverageAverage daily intake
Hydration Sweat LossEstimated fluid loss
Hydration Activity IntakeIntake during activities

Blood Pressure

SensorDescription
SystolicSystolic blood pressure (mmHg)
DiastolicDiastolic blood pressure (mmHg)
PulsePulse from blood pressure reading (bpm)

Health Monitoring

SensorDescription
Average / Lowest / Latest SpO2Blood oxygen levels
Latest SpO2 TimeWhen SpO2 was last measured
Highest / Lowest / Latest RespirationBreathing rate (brpm)
Latest Respiration TimeWhen respiration was last measured
Average Sleep RespirationBreathing rate averaged over the sleep window (brpm)
Average AltitudeAverage monitoring altitude

Fitness & Training

SensorDescription
Fitness Age / Achievable / Previous Fitness AgeEstimated fitness ages
Chronological AgeYour actual age
Endurance ScoreOverall endurance rating
Hill ScoreHill running/climbing score
Training ReadinessTraining readiness score (%)
Morning Training ReadinessWake-up readiness score (%)
Training StatusCurrent training status phrase
VO2 MaxMost recent VO2 Max value (mL/(kg·min))
Lactate Threshold HRLactate threshold heart rate (bpm)
Lactate Threshold SpeedLactate threshold pace (m/s)
Power to Weight [Sport]Dynamic per-sport power-to-weight sensor (W/kg), e.g. Running, Cycling
FTP [Sport]Dynamic per-sport functional threshold power sensor (W), e.g. Running, Cycling
Next AlarmNext scheduled alarm time
Solar IntensitySolar charging utilization (%) at the moment of the last sync, for solar-capable devices
Average Solar IntensitySolar charging utilization (%) averaged over today's readings so far
Solar Time GainedExtra battery time gained from solar today (minutes), resets daily
DevicesNumber of registered Garmin devices, with per-device details and last used device as attributes
Connected SensorsNumber of paired ANT+/BLE sensors (power meters, HR straps, etc.), with per-sensor id and battery status as attributes

Power-to-weight and FTP sensors are created dynamically for each available sport in your Garmin training data. Names are formatted like Power to Weight Running and FTP Running.

Goals & Achievements

SensorDescription
Active GoalsNumber of in-progress goals with progress
Future GoalsUpcoming scheduled goals
Goals HistoryLast 10 completed goals with status
BadgesTotal badges earned
User Points / User LevelGamification metrics

Goal sensors include detailed attributes: goalType, targetValue, currentValue, progressPercent, startDate, endDate, and activityType.

Activity Tracking

SensorDescription
Last ActivityMost recent activity with details
Last ActivitiesRecent activities list (attributes)
Last Workout / WorkoutsScheduled/planned training sessions
Today's Scheduled WorkoutToday's training-calendar session, e.g. from a Garmin Coach plan
Next Scheduled WorkoutThe next upcoming training-calendar session (today or later)
Training Plan Goal EventActive plan's goal race: name, target distance, target date, projected/predicted time
Last SyncedLast device sync timestamp

Scheduled workouts (including Garmin Coach / adaptive training plan sessions) are also exposed as a calendar.garmin_connect_scheduled_workouts calendar entity — usable with HA's built-in Calendar dashboard card, calendar.get_events, and trigger: calendar automations.

Known limitation: this data comes from Garmin's calendar-service endpoint, the same one used elsewhere in this integration. For adaptive/Coach plans, the Garmin Connect app can show upcoming days further out than this endpoint returns — that fuller view lives behind a different Garmin API that requires session-cookie authentication this integration doesn't support. Expect these sensors and the calendar entity to sometimes show fewer upcoming sessions than the app does, or none at all, even inside the current/next month window.

Blood Pressure

Requires a Garmin blood pressure device (e.g., Index BPM). Sensors are populated from the most recent measurement.

SensorDescription
Blood Pressure SystolicSystolic blood pressure (mmHg)
Blood Pressure DiastolicDiastolic blood pressure (mmHg)
Blood Pressure PulsePulse from blood pressure reading (bpm)
Blood Pressure CategoryCategory name (e.g., Normal, Elevated)
Blood Pressure Measurement TimeLocal timestamp of the measurement

Menstrual Cycle Tracking

SensorDescription
Cycle PhaseCurrent menstrual phase
Cycle DayDay of the current cycle
Cycle TypeType of cycle tracking
Cycle StartStart date of current cycle
Period LengthPeriod length (days)
Days Until Next PhaseDays remaining in current phase
Fertile Window Start / EndPredicted fertile window
Next Predicted Cycle StartPredicted start of next cycle

Menstrual cycle sensors are disabled by default and only available if tracking is enabled in your Garmin Connect account.

Nutrition

Requires a Garmin Connect+ subscription with nutrition logging set up in the Garmin Connect app. Without Connect+, sensors report unknown — enable them in entity settings after confirming your account has nutrition data.

SensorUnitNotes
Nutrition consumed calorieskcalPer-meal breakdown in meals attribute
Nutrition consumed protein / fat / carbsgDaily totals from nutrition log
Nutrition calorie / protein / fat / carbs goalkcal / gTargets from your meal plan
Nutrition remaining calorieskcalGoal minus consumed (may be negative)
Nutrition logged entriesentriesCount of food log entries today
Nutrition last loggedtimestampMost recent log entry (UTC)

Nutrition sensors are disabled by default. Enable them under Settings → Devices & services → Garmin Connect → Entities.

Statistics caveat: Editing or deleting meals in the Garmin app can decrease daily totals. Long-term statistics may not reflect retroactive changes accurately.

Meals logged via the add_nutrition_log service appear after the next poll (default 5 minutes).

Automation example — evening protein reminder:

alias: Low protein reminder
trigger:
  - platform: time
    at: "20:00:00"
condition:
  - condition: template
    value_template: >
      {{ states('sensor.garmin_connect_nutrition_consumed_protein') | float(0)
         < states('sensor.garmin_connect_nutrition_protein_goal') | float(1) * 0.8 }}
action:
  - service: notify.mobile_app
    data:
      message: "You're below 80% of your protein goal today."

Gear Tracking

Gear sensors are dynamically created for each piece of equipment registered in Garmin Connect (shoes, bikes, etc.). They track total distance in meters and include attributes like gear_uuid, total_activities, gear_make_name, gear_model_name, and default_for_activity.

Activity Route Map

The Last Activity Route sensor (sensor.garmin_connect_last_activity_route) contains a polyline attribute with GPS coordinates when the activity has GPS data. This can be displayed on a map using the included custom Lovelace card.

Installation:

  1. Copy all three files from the www/ folder to your <config>/www/ folder:
    • garmin-polyline-card.js
    • leaflet.js
    • leaflet.css
  2. Add the card as a resource: Settings → Dashboards → ⋮ → Resources → Add Resource
    • URL: /local/garmin-polyline-card.js
    • Type: JavaScript Module
  3. Hard refresh your browser (Ctrl+Shift+R)

Usage:

type: custom:garmin-polyline-card
entity: sensor.YOUR_PREFIX_last_activity_route
attribute: polyline
title: Last Activity Route
height: 400px
color: "#FF5722"

Note: The entity ID depends on your account name. Find yours in Settings → Devices & Services → Garmin Connect or search for last_activity_route in Developer Tools → States.

OptionDefaultDescription
entity(required)Sensor entity with polyline attribute
attributepolylineAttribute containing GPS coordinates
titleActivity RouteCard title
height300pxMap height
color#FF5722Route line color
weight4Route line thickness

Activity Route Map

Actions (Services)

garmin_connect.set_active_gear

Set gear as the default for an activity type.

ParameterRequiredDescription
gear_uuidNo*UUID of the gear (from sensor attributes)
entity_idNo*Alternatively, select a gear sensor entity
activity_typeYesrunning, cycling, hiking, walking, swimming, other
settingNoset this as default, unset others / set as default / unset default

*Either gear_uuid or entity_id is required.

action: garmin_connect.set_active_gear
data:
  entity_id: sensor.garmin_connect_my_running_shoes
  activity_type: running
  setting: "set this as default, unset others"

garmin_connect.add_body_composition

Record body composition metrics to Garmin Connect.

ParameterRequiredDescription
entity_idNoGarmin Connect entity whose account should receive the measurement
weightYesWeight in kg
timestampNoISO datetime (defaults to now)
bmiNoBody Mass Index
percent_fatNoBody fat percentage
percent_hydrationNoHydration percentage
visceral_fat_massNoVisceral fat in kg
bone_massNoBone mass in kg
muscle_massNoMuscle mass in kg
basal_metNoBasal metabolic rate (kcal)
active_metNoActive metabolic rate (kcal)
physique_ratingNoPhysique rating (1–9)
metabolic_ageNoMetabolic age (years)
visceral_fat_ratingNoVisceral fat rating (1–59)
action: garmin_connect.add_body_composition
data:
  entity_id: sensor.garmin_connect_weight
  weight: 82.3
  percent_fat: 23.6
  muscle_mass: 35.5

garmin_connect.add_blood_pressure

Record a blood pressure measurement.

ParameterRequiredDescription
entity_idNoGarmin Connect entity whose account should receive the measurement
systolicYesSystolic pressure (60–250 mmHg)
diastolicYesDiastolic pressure (40–150 mmHg)
pulseYesPulse rate (30–220 bpm)
timestampNoISO datetime (defaults to now)
notesNoAdditional notes
action: garmin_connect.add_blood_pressure
data:
  entity_id: sensor.garmin_connect_blood_pressure_systolic
  systolic: 120
  diastolic: 80
  pulse: 60
  notes: "Morning measurement"

garmin_connect.add_hydration

Log a hydration intake to Garmin Connect. Use a negative value to subtract from today's total.

ParameterRequiredDescription
entity_idNoGarmin Connect entity whose account should receive the measurement
value_in_mlYesAmount in millilitres (negative to subtract)
timestampNoISO datetime (defaults to now)
action: garmin_connect.add_hydration
data:
  entity_id: sensor.garmin_connect_hydration
  value_in_ml: 250

garmin_connect.create_activity

Create a manual activity in Garmin Connect.

ParameterRequiredDescription
entity_idNoGarmin Connect entity whose account should receive the activity
activity_nameYesName of the activity
activity_typeYesrunning, cycling, walking, hiking, swimming, fitness_equipment, other
duration_minYesDuration in minutes (1–1440)
start_datetimeNoISO datetime (defaults to now)
distance_kmNoDistance in kilometres
time_zoneNoTime zone (defaults to HA config)
action: garmin_connect.create_activity
data:
  entity_id: sensor.garmin_connect_last_activity
  activity_name: "Morning Run"
  activity_type: running
  duration_min: 30
  distance_km: 5.0

garmin_connect.upload_activity

Upload an activity file (FIT, GPX, TCX) to Garmin Connect.

ParameterRequiredDescription
entity_idNoGarmin Connect entity whose account should receive the upload
file_pathYesAbsolute path or relative to HA config directory
action: garmin_connect.upload_activity
data:
  entity_id: sensor.garmin_connect_last_activity
  file_path: "activities/morning_run.fit"

garmin_connect.download_activity

Download an activity file from Garmin Connect and save it on the HA host. Supports response data with the saved path and size.

ParameterRequiredDescription
entity_idNoGarmin Connect entity whose account owns the activity
activity_idYesGarmin activity ID (see last_activity sensor attributes)
file_formatNofit (default, extracted from original zip), original (raw zip), tcx, gpx, kml, csv
file_pathNoTarget file or directory. Custom paths must be in allowlist_external_dirs. Defaults to <config>/garmin_activities/activity_<id>.<format>
action: garmin_connect.download_activity
data:
  activity_id: 23545484677
  file_format: gpx
response_variable: download

garmin_connect.add_nutrition_log

Log a Quick Add nutrition entry to Garmin Connect. Requires a Connect+ subscription and initial nutrition setup in the Garmin Connect app.

ParameterRequiredDescription
entity_idNoGarmin Connect entity whose account should receive the entry
caloriesYesCalories (0–10000 kcal)
carbsNoCarbohydrates in grams
proteinNoProtein in grams
fatNoFat in grams
nameNoLabel for the entry (defaults to Quick Add)
timestampNoISO datetime (defaults to now)
action: garmin_connect.add_nutrition_log
data:
  entity_id: sensor.garmin_connect_calories
  calories: 650
  carbs: 80
  protein: 35
  fat: 20
  name: "Lunch"

garmin_connect.add_gear_to_activity

Associate gear with a specific activity.

ParameterRequiredDescription
activity_idYesActivity ID (from last_activity sensor attributes)
gear_uuidNo*UUID of the gear
entity_idNo*Alternatively, select a gear sensor entity

*Either gear_uuid or entity_id is required.

action: garmin_connect.add_gear_to_activity
data:
  activity_id: 12345678901
  entity_id: sensor.garmin_connect_my_running_shoes

Automation Examples

Sync Withings scale data to Garmin

alias: "Sync Withings to Garmin"
triggers:
  - trigger: state
    entity_id: sensor.withings_weight
conditions:
  - condition: numeric_state
    entity_id: sensor.withings_weight
    above: 40
    below: 200
actions:
  - action: garmin_connect.add_body_composition
    data:
      weight: "{{ states('sensor.withings_weight') }}"
      timestamp: "{{ now().isoformat() }}"
      bmi: "{{ (states('sensor.withings_weight') | float(0) / 1.72**2) | round(1) }}"
      bone_mass: "{{ states('sensor.withings_bone_mass') }}"
      muscle_mass: "{{ states('sensor.withings_muscle_mass') }}"
      percent_fat: "{{ states('sensor.withings_fat_ratio') }}"

Auto-assign running shoes after a run

alias: "Assign shoes to running activity"
triggers:
  - trigger: state
    entity_id: sensor.garmin_connect_last_activity
conditions:
  - condition: template
    value_template: "{{ state_attr('sensor.garmin_connect_last_activity', 'activityType') == 'running' }}"
actions:
  - action: garmin_connect.add_gear_to_activity
    data:
      activity_id: "{{ state_attr('sensor.garmin_connect_last_activity', 'activityId') }}"
      entity_id: sensor.garmin_connect_my_running_shoes

Daily running distance template sensor

template:
  - sensor:
      - name: "Today's Running Distance"
        unit_of_measurement: "km"
        state: >
          {% set today = now().strftime('%Y-%m-%d') %}
          {% set activities = state_attr('sensor.garmin_connect_last_activities', 'last_activities') | default([]) %}
          {% set running = namespace(total=0) %}
          {% for a in activities if a.activityType == 'running' and (a.startTime | as_datetime | as_local).strftime('%Y-%m-%d') == today %}
            {% set running.total = running.total + a.distance %}
          {% endfor %}
          {{ (running.total / 1000) | round(2) }}

Migration from v1

If you're upgrading from an older version of this integration (which used the garminconnect / garth library), the integration will automatically:

  1. Migrate entity unique IDs so your existing entity IDs are preserved (automations and dashboards keep working)
  2. Request re-authentication since the authentication method has changed
  3. Entity naming entities now have default prefix 'Garmin Connect' we try to convert them, you can change it afterwards, this may break automations and dashboards

After upgrading, go to SettingsDevices & Services, find Garmin Connect, and complete the re-authentication flow. If you have multiple Garmin accounts configured, each will prompt separately.

Known Limitations

  • Cloud-based — Requires internet connection; data depends on Garmin servers availability
  • Polling delay — Data updates only when your device syncs to Garmin Connect and the integration polls
  • MFA sessions — MFA sessions may expire, requiring re-authentication
  • Rate limiting — Excessive polling may trigger Garmin's rate limits; minimum interval is 60 seconds
  • China region — Users with .cn Garmin accounts can enable the "Use Garmin Connect China" option during setup or reconfiguration

Troubleshooting

Re-authentication required

  1. Go to SettingsDevices & Services
  2. Find Garmin Connect and click Reconfigure
  3. Enter your credentials and MFA code if prompted

Sensors show "unknown" or "unavailable"

  • Check if your Garmin device has synced recently
  • Verify the Garmin Connect website/app shows current data
  • Not all data may be available depending on your Garmin device model
  • Check Home Assistant logs for error messages

Rate limit errors

If you see 429 or rate limit errors wait 5-30 minutes before reloading the integration

Enable debug logging

logger:
  default: info
  logs:
    custom_components.garmin_connect: debug

Or enable via the UI: SettingsDevices & ServicesGarmin ConnectEnable debug logging.

Enable Debug Logging

Then perform any steps to reproduce the issue and disable debug logging again. It will download the relevant log file automatically.

Support This Project

If you find this integration useful, please consider supporting its development:

Donate via PayPal Sponsor on GitHub

  • Star this repository
  • Report issues
  • Share with other Home Assistant users

License

This project is licensed under the MIT License — see the LICENSE file for details.


关于 About

This Garmin Connect integration allows you to expose and upload data from and to Garmin Connect to Home Assistant.
garmin-connecthome-assistanthome-assistant-component

语言 Languages

Python90.4%
CSS4.9%
JavaScript3.3%
Shell1.4%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
320
Total Commits
峰值: 61次/周
Less
More

核心贡献者 Contributors