How to Sync Apple Health Data to Home Assistant

This guide outlines how you can use Health Auto Export to automate Apple Health data exports to Home Assistant.

This Home Assistant integration uses the /api/states/entity_id endpoint in Home Assistant.

Setup Walkthrough

Create the Automation

  • Navigate to the Automations screen in Health Auto Export.

  • Create a new automation then select it.

  • Enable the automation.

  • Enable notifications to be alerted when your automation fetches updated data and/or when data is sent to Home Assistant.

  • Set Home Assistant as the automation type.

Set the URL and Request Headers

  • Enter the URL of your Home Assistant endpoint. This should be the root address of your Home Assistant endpoint. Health Auto Export will append the /api/states/entity_id path to your URL automatically using the automation name you have provided. A preview of the URL is shown beneath the input field.

  • Obtain an authorization token for the Home Assistant API by following the instructions outlined here.

  • Add the token to the configuration headers as shown where Authorization is the key and Bearer <your_auth_token> is the value (ensure there is a space between Bearer and your token value).

Complete the Setup

  • Set the Data Type. For Home Assistant, only Health Metrics are currently supported (Use the REST API automation to sync workouts to your database of choice.

  • Select Health Metrics if you are only interested in a subset of measurements.

  • Preferred Sources: set a preferred source corresponding to a health metric if desired. This setting applies globally (this will be modified in a future update).

  • Sync Cadence: set a minimum time between data exports. e.g. set 30 minutes to sync data at most twice per hour. See the FAQ for a detailed explanation of the sync cadence setting.

  • Update to save any changes you’ve made to your automation.

  • Export: run the export manually to trigger a data sync to your configured URL. Any errors will be displayed in the message fields.

Configure the Automations Widget

  • Add Health Auto Export’s “Automations” widget to your Home Screen in order to assist automations running in the background.

  • You must edit the widget to select a corresponding automation that it will run.

  • Add multiple widgets to your Home Screen if you need to run multiple automations.

 

FAQ

About Sync Cadence & Background Syncing

Consider this the desired minimum time between exports. Execution time is not guaranteed and is ultimately determined by the system. Select a Quantity and interval for your desired sync frequency. The app will make a best effort to run at the configured interval. Remember, automations will not be able to access new data and will not run while your device is locked.


Please note iOS does not allow apps to execute background tasks at a specified time. Heath Auto Export will make a best attempt to run in the background according to the specified sync cadence. Furthermore, new health data can only be accessed during periods when your device is unlocked. Enable notifications on your automation if you need to be certain of when automations have run in the background.

Still need help? Get in touch with your questions or issues.

Projects

Need inspiration? Check out these projects shared by community members.

Have a project you’d like to share? Get in touch and it’ll be highlighted on the blog and GitHub repository.

Previous
Previous

How to Sync Apple Health Data to Dropbox

Next
Next

Apple Health Data on Apple Vision Pro