How to Sync Apple Health Data to MQTT

This guide outlines how you can use Health Auto Export to automate Apple Health data exports to an MQTT Broker. This facilitates custom implementations and purpose-built applications that integrate with Health Auto Export.

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 the broker.

  • Set MQTT as the automation type.

Configure the MQTT

  • Configure your MQTT connection with appropriate details.

  • At minimum, the IP Address, port number and topic are required.

Select Data Type

  • Select the Data Type associated with the automation. Create additional automations in order to export multiple data types.

  • Health Metrics:

    • Select Health Metrics to filter if you are interested in only a subset of health metric data.

    • 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)

  • Workouts:

    • Export Version: versioning is available to prevent sudden breaking changes to workflows as the app evolves. Always use the latest version if possible.

    • Include Workout Metadata in order to gather additional data associated with your workout, such as heart rate data, step count, cycling or swimming data associated with the workout session.

  • Metadata Aggregation determines the granularity of the exported metadata (e.g. minute-by-minute or second-by-second data).

Export Settings

Export Format: for MQTT, the only available format is JSON.

  • The Period determines the time period for data contained in each export file.

    • Default: includes data for entire previous calendar day and data for the current calendar day up until the current time

    • Since Last Sync: only includes data created after the last successful sync 

    • Today: includes data for the current calendar day up to the current time

    • Yesterday: includes data for the previous ful calendar day

    • Previous 7 Days: includes data for the previous seven calendar days

  • Aggregation determines the granularity of the exported data (e.g. minute-by-minute, or day-by-day)

  • 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.

Complete the Setup

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

  • Export: run the export manually to trigger a data sync to your configured endpoint. 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.

Next
Next

How to Sync Apple Health Data to via REST API