Sync Apple Health Data to Home Assistant

Integrate your health data with Home Assistant.

Last updated: February 5, 2026

Home Assistant automations allow you to automatically sync your health data to Home Assistant as sensor states. This integration enables you to use your health data in Home Assistant automations, dashboards, and other integrations.

Overview

Home Assistant automations send your health metrics to Home Assistants REST API, creating or updating sensor states that can be used throughout your Home Assistant instance. The data is formatted specifically for Home Assistant's /states/ API.

Use Cases:

  • Display health metrics on Home Assistant dashboards
  • Create automations based on health data
  • Integrate health data with other smart home devices
  • Track health trends over time in Home Assistant

Key Features:

  • Automatic sensor state creation
  • JSON format only (optimized for Home Assistant)
  • Health Metrics data type only
  • Simple URL configuration

Limitations

  • Health Data Access: Apps are not allowed to access health data while iPhone is locked. Automations will only run during periods when your device is unlocked. This can affect data freshness. See instructions for manual syncing to keep data up to date.

  • Background Processing: iOS limits background processing to preserve battery life. Automations rely on Background App Refresh and may not run immediately if:

    • Background App Refresh is disabled for the app
    • The device is in Low Power Mode
    • The device has been inactive for extended periods
    • System resources are constrained
    • Multiple apps are competing for background execution time
  • Only supports Health Metrics data type

  • JSON format only (cannot be changed)

Prerequisites

  • A Home Assistant instance running and accessible on your network
  • Home Assistant API access token (Long-Lived Access Token)
  • Network connectivity to your Home Assistant instance
  • Home Assistant version that supports REST API

Configuration

Navigate to the Automated Exports screen from the main navigation, then tap "New Automation" and select "Home Assistant" as the Automation Type.

Automation Name

Enter a descriptive name for your automation. This name will be used to generate the sensor entity ID in Home Assistant.

Note: The automation name will be converted to lowercase with spaces removed to create the entity ID. For example, "My Health Data" becomes hae.myhealthdata.

Notifications

Configure when you want to receive notifications:

  • Notify on Cache Update - Receive a notification when cached data is updated
  • Notify When Run - Receive a notification each time the automation executes

Home Assistant URL

Enter the base URL of your Home Assistant instance. This should include the protocol and port if not using the default.

Example URLs:

  • http://homeassistant.local:8123
  • http://192.168.1.100:8123

Note: The URL must be accessible from your device. If using HTTPS, ensure your certificate is valid or add an exception.

Auto-Generated Endpoint

The app automatically generates the full API endpoint based on your automation name:

{your_url}/api/states/hae.{automation_name}

For example, if your URL is http://homeassistant.local:8123 and your automation name is "Health Metrics", the endpoint will be:

http://homeassistant.local:8123/api/states/hae.healthmetrics

This endpoint is displayed below the URL field for reference.

Request Timeout

Select a timeout interval for HTTP requests to Home Assistant.

Available timeout options:

  • 60 seconds - Default, suitable for most Home Assistant instances
  • 300 seconds (5 minutes) - For slower Home Assistant instances
  • 1800 seconds (30 minutes) - For very slow processing
  • 3600 seconds (1 hour) - Maximum recommended timeout

HTTP Headers

Add authentication headers for Home Assistant API access. You'll need to add an Authorization header with your Long-Lived Access Token.

Required Header:

  • Authorization: Bearer YOUR_LONG_LIVED_ACCESS_TOKEN

To get a Long-Lived Access Token:

  1. Open Home Assistant
  2. Go to your profile (click your name in the bottom left)
  3. Scroll down to "Long-Lived Access Tokens"
  4. Click "Create Token"
  5. Give it a name (e.g., "Health Auto Export")
  6. Copy the token and paste it in the header value field

Optional Headers:
You can add additional headers if needed for your Home Assistant setup.

To add headers:

  1. Tap "Add Headers"
  2. Enter the header key in the left field
  3. Enter the header value in the right field
  4. Repeat for additional headers

Important: Each header key must have a corresponding value. Empty headers will be ignored.

Data Type Settings

Data Type

Note: Home Assistant automations only support Health Metrics data type. This setting cannot be changed and is automatically set to Health Metrics.

Health Metrics Configuration

Select Health Metrics - Choose which specific metrics to include. You can select all available metrics or choose specific ones.

Tip: Selecting only the metrics you need can improve processing time and reduce data size sent to Home Assistant.

Preferred Sources - Configure which data sources take priority when multiple sources provide the same metric.

Export Settings

Export Format

Note: Home Assistant automations only support JSON format. This setting cannot be changed and is automatically set to JSON.

Export Version

Note: Export Version is not available for Home Assistant automations as the format is optimized specifically for Home Assistant's state API.

Date Range

Select when data should be exported:

  • Default - Syncs data for the full previous day plus data up to the current date and time
  • Today - Syncs all data for the current date up to the current time
  • Yesterday - Syncs all data for the full previous day

Note: Home Assistant automations do not support "Real Time", "Since Last Sync", or "Previous 7 Days" options.

Summarize Data

Toggle Summarize Data ON or OFF for Health Metrics.

  • ON - Provides aggregated data summaries (default)
  • OFF - Provides disaggregated data where possible

Note: This setting only applies to Health Metrics data type.

Time Grouping

When Summarize Data is enabled, select how data should be aggregated:

  • Default - No aggregation, raw data points
  • Days - Groups data by day (recommended)

Sync Cadence

Configure how often the automation should sync data to Home Assistant:

Select a number and interval.

Testing & Verification

Manual Testing

  1. Tap "Manual Export" in the automation configuration screen
  2. Select a date range
  3. Tap "Export" to send a test request
  4. Check Home Assistant to verify the sensor state was created/updated

Verifying in Home Assistant

  1. Open Home Assistant
  2. Go to Developer Tools > States
  3. Search for hae.{your_automation_name} (lowercase, no spaces)
  4. Verify the sensor state shows your health data
  5. Check the "Last Updated" timestamp to confirm recent syncs

Viewing Activity Logs

  1. Tap "View Activity Logs" in the automation configuration screen
  2. Review recent automation runs
  3. Check for any errors or warnings
  4. Verify request timestamps and response status

Checking Home Assistant Logs

If data isn't appearing in Home Assistant:

  1. Open Home Assistant
  2. Go to Settings > System > Logs
  3. Look for errors related to the REST API or sensor states
  4. Check for authentication errors or invalid data format

Troubleshooting

Common Issues

Authentication Errors

  • Verify your Long-Lived Access Token is correct
  • Ensure the Authorization header is formatted as: Bearer YOUR_TOKEN
  • Check that the token hasn't expired or been revoked
  • Verify the token has appropriate permissions in Home Assistant

Sensor Not Appearing in Home Assistant

  • Check that the automation name doesn't contain special characters
  • Verify the entity ID format: hae.{automation_name} (lowercase, no spaces)
  • Check Home Assistant logs for errors
  • Ensure the API request was successful (check Activity Logs)

Data Not Updating

  • Check that the automation is enabled
  • Review Activity Logs for errors
  • Ensure network connectivity to Home Assistant

Connection Timeout

  • Verify Home Assistant is running and accessible
  • Check network connectivity
  • Increase the Request Timeout setting if Home Assistant is slow to respond
  • Verify the URL and port are correct

Error Messages

The app will display error messages if:

  • The URL is invalid or unreachable
  • Authentication fails (check the Authorization header)
  • Home Assistant returns an error status code
  • Network connectivity is unavailable

Check the Activity Logs for detailed error information including HTTP status codes and error messages from Home Assistant.

Home Assistant Integration Tips

Using Health Data in Automations

Once your health data is synced to Home Assistant, you can use it in automations:

automation:
  - alias: "Good Sleep Quality"
    trigger:
      - platform: numeric_state
        entity_id: sensor.hae_myhealthdata_sleep_total
        above: 7
    action:
      - service: notify.mobile_app_your_phone
        data:
          message: "Great sleep last night!"

Creating Dashboards

Add health metrics to your Home Assistant dashboard:

  1. Go to your dashboard
  2. Add a new card
  3. Select "Entities" or "Gauge" card type
  4. Add the hae.{your_automation_name} sensor entities

Sensor State Structure

The sensor state in Home Assistant contains:

  • state: The current value or status
  • attributes: Additional data including:
    • Timestamp information
    • Data structure matching the exported JSON format
    • Unit information where applicable

Tips and Best Practices

  1. Naming:

    • Avoid special characters that might cause issues
  2. Data Selection:

    • Select only the metrics you need